@tsparticles/shape-cards 4.0.0-alpha.5 → 4.0.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/35.min.js +2 -0
- package/35.min.js.LICENSE.txt +1 -0
- package/475.min.js +1 -1
- package/475.min.js.LICENSE.txt +1 -1
- package/505.min.js +1 -1
- package/505.min.js.LICENSE.txt +1 -1
- package/657.min.js +1 -1
- package/657.min.js.LICENSE.txt +1 -1
- package/741.min.js +1 -1
- package/741.min.js.LICENSE.txt +1 -1
- package/README.md +1 -1
- package/browser/CardValue.js +16 -0
- package/browser/SuitType.js +7 -0
- package/browser/cards/CardDrawer.js +21 -0
- package/browser/cards/index.js +7 -0
- package/browser/clubs/ClubDrawer.js +4 -2
- package/browser/clubs/index.js +2 -2
- package/browser/diamonds/DiamondDrawer.js +4 -2
- package/browser/diamonds/index.js +2 -2
- package/browser/hearts/HeartDrawer.js +4 -2
- package/browser/hearts/index.js +2 -2
- package/browser/index.js +15 -6
- package/browser/paths.js +174 -0
- package/browser/spades/SpadeDrawer.js +4 -2
- package/browser/spades/index.js +2 -2
- package/browser/utils.js +90 -0
- package/cjs/CardParticle.js +1 -0
- package/cjs/CardValue.js +16 -0
- package/cjs/ICardData.js +1 -0
- package/cjs/ICardSuitsPath.js +1 -0
- package/cjs/SuitType.js +7 -0
- package/cjs/cards/CardDrawer.js +21 -0
- package/cjs/cards/index.js +7 -0
- package/cjs/clubs/ClubDrawer.js +4 -2
- package/cjs/clubs/index.js +2 -2
- package/cjs/diamonds/DiamondDrawer.js +4 -2
- package/cjs/diamonds/index.js +2 -2
- package/cjs/hearts/HeartDrawer.js +4 -2
- package/cjs/hearts/index.js +2 -2
- package/cjs/index.js +15 -6
- package/cjs/paths.js +174 -0
- package/cjs/spades/SpadeDrawer.js +4 -2
- package/cjs/spades/index.js +2 -2
- package/cjs/utils.js +90 -0
- package/dist_browser_cards_CardDrawer_js.js +60 -0
- package/dist_browser_clubs_ClubDrawer_js.js +17 -7
- package/dist_browser_diamonds_DiamondDrawer_js.js +17 -7
- package/dist_browser_hearts_HeartDrawer_js.js +17 -7
- package/dist_browser_spades_SpadeDrawer_js.js +15 -5
- package/esm/CardParticle.js +1 -0
- package/esm/CardValue.js +16 -0
- package/esm/ICardData.js +1 -0
- package/esm/ICardSuitsPath.js +1 -0
- package/esm/SuitType.js +7 -0
- package/esm/cards/CardDrawer.js +21 -0
- package/esm/cards/index.js +7 -0
- package/esm/clubs/ClubDrawer.js +4 -2
- package/esm/clubs/index.js +2 -2
- package/esm/diamonds/DiamondDrawer.js +4 -2
- package/esm/diamonds/index.js +2 -2
- package/esm/hearts/HeartDrawer.js +4 -2
- package/esm/hearts/index.js +2 -2
- package/esm/index.js +15 -6
- package/esm/paths.js +174 -0
- package/esm/spades/SpadeDrawer.js +4 -2
- package/esm/spades/index.js +2 -2
- package/esm/utils.js +90 -0
- package/package.json +3 -2
- package/report.html +3 -3
- package/tsparticles.shape.cards.js +40 -10
- package/tsparticles.shape.cards.min.js +1 -1
- package/tsparticles.shape.cards.min.js.LICENSE.txt +1 -1
- package/types/CardParticle.d.ts +5 -0
- package/types/CardValue.d.ts +15 -0
- package/types/ICardData.d.ts +7 -0
- package/types/ICardSuitsPath.d.ts +3 -0
- package/types/SuitType.d.ts +6 -0
- package/types/cards/CardDrawer.d.ts +7 -0
- package/types/cards/index.d.ts +2 -0
- package/types/clubs/index.d.ts +1 -1
- package/types/diamonds/index.d.ts +1 -1
- package/types/hearts/index.d.ts +1 -1
- package/types/index.d.ts +2 -0
- package/types/paths.d.ts +7 -0
- package/types/spades/index.d.ts +1 -1
- package/types/utils.d.ts +2 -0
- package/umd/CardValue.js +29 -0
- package/umd/ICardData.js +12 -0
- package/umd/ICardSuitsPath.js +12 -0
- package/umd/SuitType.js +20 -0
- package/umd/cards/CardDrawer.js +35 -0
- package/umd/cards/index.js +54 -0
- package/umd/clubs/ClubDrawer.js +5 -3
- package/umd/clubs/index.js +3 -3
- package/umd/diamonds/DiamondDrawer.js +5 -3
- package/umd/diamonds/index.js +3 -3
- package/umd/hearts/HeartDrawer.js +5 -3
- package/umd/hearts/index.js +3 -3
- package/umd/index.js +17 -7
- package/umd/paths.js +187 -0
- package/umd/spades/SpadeDrawer.js +5 -3
- package/umd/spades/index.js +3 -3
- package/umd/utils.js +103 -0
- package/browser/Utils.js +0 -161
- package/cjs/Utils.js +0 -161
- package/esm/Utils.js +0 -161
- package/types/ICardsPath.d.ts +0 -13
- package/types/Utils.d.ts +0 -4
- package/umd/Utils.js +0 -175
- /package/browser/{ICardsPath.js → CardParticle.js} +0 -0
- /package/{cjs/ICardsPath.js → browser/ICardData.js} +0 -0
- /package/{esm/ICardsPath.js → browser/ICardSuitsPath.js} +0 -0
- /package/umd/{ICardsPath.js → CardParticle.js} +0 -0
package/35.min.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see 35.min.js.LICENSE.txt */
|
|
2
|
+
(this.webpackChunk_tsparticles_shape_cards=this.webpackChunk_tsparticles_shape_cards||[]).push([[35],{35(e,t,y){y.d(t,{CardDrawer:()=>u});var a=y(303),s=y(355),r=y(580),l=y(792);const i=a.double*a.double/a.triple,n=a.double,p=new Map;function x(e,t,y,s,r){if(r)!function(e,t){m(e,t)}(e,t);else{const r=function(e,t){return`${e.toFixed(2)}-${t.suit}-${t.value}`}(t,y),l=t*i,x=t*n,m=l*a.half,u=x*a.half;if(!p.has(r)){const e=new OffscreenCanvas(l,x),a=e.getContext("2d");a&&(a.translate(m,u),o(a,t,y,s),p.set(r,e))}const g=p.get(r);g?e.drawImage(g,-m,-u,l,x):o(e,t,y,s)}}function o(e,t,y,p){const{suit:x,value:o}=y,u=t*n,g=t*i*a.half,c=u*a.half,d=.2*t,h=.4*t,f=.3*t,b=.9*t,v=.25*t,T=.1*t,S=x===s.U.hearts||x===s.U.diamonds?(0,a.getStyleFromRgb)({r:255,g:0,b:0},p):(0,a.getStyleFromRgb)({r:0,g:0,b:0},p);e.save(),m(e,t),e.fillStyle=(0,a.getStyleFromRgb)({r:255,g:255,b:255},p),e.fill(),e.strokeStyle=(0,a.getStyleFromRgb)({r:0,g:0,b:0},p),e.stroke(),e.fillStyle=S,e.font=`bold ${h.toString()}px Arial, serif`,e.textAlign="left",e.textBaseline="middle";const z=-g+d+T,P=-c+d+h*a.half;e.save(),e.translate(z,P),e.beginPath(),(0,r.drawPath)(e,f,l.f0[x]),e.fill(),e.restore(),e.fillText(o,z+v,P),e.save(),e.translate(g-d-T,c-d-h*a.half),e.rotate(Math.PI),e.save(),e.beginPath(),(0,r.drawPath)(e,f,l.f0[x]),e.fill(),e.restore(),e.fillText(o,a.originPoint.x+v,a.originPoint.y),e.restore(),e.save(),e.beginPath(),(0,r.drawPath)(e,b,l.f0[x]),e.fillStyle=S,e.fill(),e.restore(),e.beginPath(),e.arc(a.originPoint.x,a.originPoint.y,0,0,a.doublePI,!1),e.closePath(),e.restore()}function m(e,t){const y=t*n,s=t*i*a.half,r=y*a.half,l=.2*t;e.beginPath(),e.moveTo(-s+l,-r),e.lineTo(s-l,-r),e.quadraticCurveTo(s,-r,s,-r+l),e.lineTo(s,r-l),e.quadraticCurveTo(s,r,s-l,r),e.lineTo(-s+l,r),e.quadraticCurveTo(-s,r,-s,r-l),e.lineTo(-s,-r+l),e.quadraticCurveTo(-s,-r,-s+l,-r),e.closePath()}class u{constructor(){this.validTypes=["card"]}draw(e){const{context:t,particle:y,radius:a}=e;y.cardData&&x(t,a,y.cardData,y.container.hdr,y.isShowingBack())}particleInit(e,t){const y=t.shapeData;y&&(t.cardData=(0,a.deepExtend)({},y))}}},355(e,t,y){var a;y.d(t,{U:()=>a}),function(e){e.hearts="hearts",e.diamonds="diamonds",e.clubs="clubs",e.spades="spades"}(a||(a={}))},792(e,t,y){y.d(t,{f0:()=>h});var a=y(580),s=y(303),r=y(355);const l=s.quarter*s.half,i=s.half,n=i*s.half,p=-i,x=-n,o=i*l,m=i*s.threeQuarter,u={half:!0,segments:[{type:a.SegmentType.bezier,values:[{x:s.empty,y:p},{x:s.empty,y:p},{x:n,y:p},{x:n,y:x}]},{type:a.SegmentType.bezier,values:[{x:n,y:x},{x:n,y:x},{x:i,y:x},{x:i,y:s.empty}]},{type:a.SegmentType.bezier,values:[{x:i,y:s.empty},{x:i,y:s.empty},{x:i,y:n},{x:n,y:n}]},{type:a.SegmentType.bezier,values:[{x:n,y:n},{x:n,y:n},{x:o,y:n},{x:o,y:o}]},{type:a.SegmentType.bezier,values:[{x:o,y:o},{x:o,y:n},{x:n,y:i},{x:n,y:i}]},{type:a.SegmentType.bezier,values:[{x:n,y:i},{x:n,y:i},{x:s.empty,y:i},{x:s.empty,y:i}]}]},g={half:!0,segments:[{type:a.SegmentType.bezier,values:[{x:s.empty,y:i},{x:s.empty,y:i},{x:m,y:s.empty},{x:m,y:s.empty}]},{type:a.SegmentType.bezier,values:[{x:m,y:s.empty},{x:m,y:s.empty},{x:s.empty,y:p},{x:s.empty,y:p}]}]},c={half:!0,segments:[{type:a.SegmentType.bezier,values:[{x:s.empty,y:i},{x:s.empty,y:i},{x:i,y:s.empty},{x:i,y:x}]},{type:a.SegmentType.bezier,values:[{x:i,y:x},{x:i,y:x},{x:i,y:p},{x:n,y:p}]},{type:a.SegmentType.bezier,values:[{x:n,y:p},{x:n,y:p},{x:s.empty,y:p},{x:s.empty,y:x}]}]},d={half:!0,segments:[{type:a.SegmentType.bezier,values:[{x:s.empty,y:p},{x:s.empty,y:p},{x:i,y:x},{x:i,y:s.empty}]},{type:a.SegmentType.bezier,values:[{x:i,y:s.empty},{x:i,y:s.empty},{x:i,y:n},{x:n,y:n}]},{type:a.SegmentType.bezier,values:[{x:n,y:n},{x:n,y:n},{x:o,y:n},{x:o,y:o}]},{type:a.SegmentType.bezier,values:[{x:o,y:o},{x:o,y:n},{x:n,y:i},{x:n,y:i}]},{type:a.SegmentType.bezier,values:[{x:n,y:i},{x:n,y:i},{x:s.empty,y:i},{x:s.empty,y:i}]}]},h={[r.U.hearts]:c,[r.U.diamonds]:g,[r.U.clubs]:u,[r.U.spades]:d}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! tsParticles Cards Shape v4.0.0-alpha.8 by Matteo Bruni */
|
package/475.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see 475.min.js.LICENSE.txt */
|
|
2
|
-
(this.webpackChunk_tsparticles_shape_cards=this.webpackChunk_tsparticles_shape_cards||[]).push([[475],{
|
|
2
|
+
(this.webpackChunk_tsparticles_shape_cards=this.webpackChunk_tsparticles_shape_cards||[]).push([[475],{355(e,y,t){var p;t.d(y,{U:()=>p}),function(e){e.hearts="hearts",e.diamonds="diamonds",e.clubs="clubs",e.spades="spades"}(p||(p={}))},475(e,y,t){t.d(y,{SpadeDrawer:()=>s});var p=t(580),x=t(792);class s{constructor(){this.validTypes=["spade","spades"]}draw(e){const{context:y,radius:t}=e;(0,p.drawPath)(y,t,x.f0.spades)}}},792(e,y,t){t.d(y,{f0:()=>v});var p=t(580),x=t(303),s=t(355);const a=x.quarter*x.half,m=x.half,r=m*x.half,n=-m,l=-r,i=m*a,u=m*x.threeQuarter,d={half:!0,segments:[{type:p.SegmentType.bezier,values:[{x:x.empty,y:n},{x:x.empty,y:n},{x:r,y:n},{x:r,y:l}]},{type:p.SegmentType.bezier,values:[{x:r,y:l},{x:r,y:l},{x:m,y:l},{x:m,y:x.empty}]},{type:p.SegmentType.bezier,values:[{x:m,y:x.empty},{x:m,y:x.empty},{x:m,y:r},{x:r,y:r}]},{type:p.SegmentType.bezier,values:[{x:r,y:r},{x:r,y:r},{x:i,y:r},{x:i,y:i}]},{type:p.SegmentType.bezier,values:[{x:i,y:i},{x:i,y:r},{x:r,y:m},{x:r,y:m}]},{type:p.SegmentType.bezier,values:[{x:r,y:m},{x:r,y:m},{x:x.empty,y:m},{x:x.empty,y:m}]}]},b={half:!0,segments:[{type:p.SegmentType.bezier,values:[{x:x.empty,y:m},{x:x.empty,y:m},{x:u,y:x.empty},{x:u,y:x.empty}]},{type:p.SegmentType.bezier,values:[{x:u,y:x.empty},{x:u,y:x.empty},{x:x.empty,y:n},{x:x.empty,y:n}]}]},g={half:!0,segments:[{type:p.SegmentType.bezier,values:[{x:x.empty,y:m},{x:x.empty,y:m},{x:m,y:x.empty},{x:m,y:l}]},{type:p.SegmentType.bezier,values:[{x:m,y:l},{x:m,y:l},{x:m,y:n},{x:r,y:n}]},{type:p.SegmentType.bezier,values:[{x:r,y:n},{x:r,y:n},{x:x.empty,y:n},{x:x.empty,y:l}]}]},h={half:!0,segments:[{type:p.SegmentType.bezier,values:[{x:x.empty,y:n},{x:x.empty,y:n},{x:m,y:l},{x:m,y:x.empty}]},{type:p.SegmentType.bezier,values:[{x:m,y:x.empty},{x:m,y:x.empty},{x:m,y:r},{x:r,y:r}]},{type:p.SegmentType.bezier,values:[{x:r,y:r},{x:r,y:r},{x:i,y:r},{x:i,y:i}]},{type:p.SegmentType.bezier,values:[{x:i,y:i},{x:i,y:r},{x:r,y:m},{x:r,y:m}]},{type:p.SegmentType.bezier,values:[{x:r,y:m},{x:r,y:m},{x:x.empty,y:m},{x:x.empty,y:m}]}]},v={[s.U.hearts]:g,[s.U.diamonds]:b,[s.U.clubs]:d,[s.U.spades]:h}}}]);
|
package/475.min.js.LICENSE.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Cards Shape v4.0.0-alpha.
|
|
1
|
+
/*! tsParticles Cards Shape v4.0.0-alpha.8 by Matteo Bruni */
|
package/505.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see 505.min.js.LICENSE.txt */
|
|
2
|
-
(this.webpackChunk_tsparticles_shape_cards=this.webpackChunk_tsparticles_shape_cards||[]).push([[505],{
|
|
2
|
+
(this.webpackChunk_tsparticles_shape_cards=this.webpackChunk_tsparticles_shape_cards||[]).push([[505],{355(e,y,t){var p;t.d(y,{U:()=>p}),function(e){e.hearts="hearts",e.diamonds="diamonds",e.clubs="clubs",e.spades="spades"}(p||(p={}))},505(e,y,t){t.d(y,{DiamondDrawer:()=>s});var p=t(580),x=t(792);class s{constructor(){this.validTypes=["diamond","diamonds"]}draw(e){const{context:y,radius:t}=e;(0,p.drawPath)(y,t,x.f0.diamonds)}}},792(e,y,t){t.d(y,{f0:()=>v});var p=t(580),x=t(303),s=t(355);const a=x.quarter*x.half,m=x.half,r=m*x.half,n=-m,i=-r,l=m*a,u=m*x.threeQuarter,d={half:!0,segments:[{type:p.SegmentType.bezier,values:[{x:x.empty,y:n},{x:x.empty,y:n},{x:r,y:n},{x:r,y:i}]},{type:p.SegmentType.bezier,values:[{x:r,y:i},{x:r,y:i},{x:m,y:i},{x:m,y:x.empty}]},{type:p.SegmentType.bezier,values:[{x:m,y:x.empty},{x:m,y:x.empty},{x:m,y:r},{x:r,y:r}]},{type:p.SegmentType.bezier,values:[{x:r,y:r},{x:r,y:r},{x:l,y:r},{x:l,y:l}]},{type:p.SegmentType.bezier,values:[{x:l,y:l},{x:l,y:r},{x:r,y:m},{x:r,y:m}]},{type:p.SegmentType.bezier,values:[{x:r,y:m},{x:r,y:m},{x:x.empty,y:m},{x:x.empty,y:m}]}]},b={half:!0,segments:[{type:p.SegmentType.bezier,values:[{x:x.empty,y:m},{x:x.empty,y:m},{x:u,y:x.empty},{x:u,y:x.empty}]},{type:p.SegmentType.bezier,values:[{x:u,y:x.empty},{x:u,y:x.empty},{x:x.empty,y:n},{x:x.empty,y:n}]}]},g={half:!0,segments:[{type:p.SegmentType.bezier,values:[{x:x.empty,y:m},{x:x.empty,y:m},{x:m,y:x.empty},{x:m,y:i}]},{type:p.SegmentType.bezier,values:[{x:m,y:i},{x:m,y:i},{x:m,y:n},{x:r,y:n}]},{type:p.SegmentType.bezier,values:[{x:r,y:n},{x:r,y:n},{x:x.empty,y:n},{x:x.empty,y:i}]}]},h={half:!0,segments:[{type:p.SegmentType.bezier,values:[{x:x.empty,y:n},{x:x.empty,y:n},{x:m,y:i},{x:m,y:x.empty}]},{type:p.SegmentType.bezier,values:[{x:m,y:x.empty},{x:m,y:x.empty},{x:m,y:r},{x:r,y:r}]},{type:p.SegmentType.bezier,values:[{x:r,y:r},{x:r,y:r},{x:l,y:r},{x:l,y:l}]},{type:p.SegmentType.bezier,values:[{x:l,y:l},{x:l,y:r},{x:r,y:m},{x:r,y:m}]},{type:p.SegmentType.bezier,values:[{x:r,y:m},{x:r,y:m},{x:x.empty,y:m},{x:x.empty,y:m}]}]},v={[s.U.hearts]:g,[s.U.diamonds]:b,[s.U.clubs]:d,[s.U.spades]:h}}}]);
|
package/505.min.js.LICENSE.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Cards Shape v4.0.0-alpha.
|
|
1
|
+
/*! tsParticles Cards Shape v4.0.0-alpha.8 by Matteo Bruni */
|
package/657.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see 657.min.js.LICENSE.txt */
|
|
2
|
-
(this.webpackChunk_tsparticles_shape_cards=this.webpackChunk_tsparticles_shape_cards||[]).push([[657],{
|
|
2
|
+
(this.webpackChunk_tsparticles_shape_cards=this.webpackChunk_tsparticles_shape_cards||[]).push([[657],{355(e,y,t){var p;t.d(y,{U:()=>p}),function(e){e.hearts="hearts",e.diamonds="diamonds",e.clubs="clubs",e.spades="spades"}(p||(p={}))},657(e,y,t){t.d(y,{HeartDrawer:()=>s});var p=t(580),x=t(792);class s{constructor(){this.validTypes=["heart","hearts"]}draw(e){const{context:y,radius:t}=e;(0,p.drawPath)(y,t,x.f0.hearts)}}},792(e,y,t){t.d(y,{f0:()=>d});var p=t(580),x=t(303),s=t(355);const a=x.quarter*x.half,m=x.half,r=m*x.half,n=-m,l=-r,i=m*a,u=m*x.threeQuarter,h={half:!0,segments:[{type:p.SegmentType.bezier,values:[{x:x.empty,y:n},{x:x.empty,y:n},{x:r,y:n},{x:r,y:l}]},{type:p.SegmentType.bezier,values:[{x:r,y:l},{x:r,y:l},{x:m,y:l},{x:m,y:x.empty}]},{type:p.SegmentType.bezier,values:[{x:m,y:x.empty},{x:m,y:x.empty},{x:m,y:r},{x:r,y:r}]},{type:p.SegmentType.bezier,values:[{x:r,y:r},{x:r,y:r},{x:i,y:r},{x:i,y:i}]},{type:p.SegmentType.bezier,values:[{x:i,y:i},{x:i,y:r},{x:r,y:m},{x:r,y:m}]},{type:p.SegmentType.bezier,values:[{x:r,y:m},{x:r,y:m},{x:x.empty,y:m},{x:x.empty,y:m}]}]},b={half:!0,segments:[{type:p.SegmentType.bezier,values:[{x:x.empty,y:m},{x:x.empty,y:m},{x:u,y:x.empty},{x:u,y:x.empty}]},{type:p.SegmentType.bezier,values:[{x:u,y:x.empty},{x:u,y:x.empty},{x:x.empty,y:n},{x:x.empty,y:n}]}]},g={half:!0,segments:[{type:p.SegmentType.bezier,values:[{x:x.empty,y:m},{x:x.empty,y:m},{x:m,y:x.empty},{x:m,y:l}]},{type:p.SegmentType.bezier,values:[{x:m,y:l},{x:m,y:l},{x:m,y:n},{x:r,y:n}]},{type:p.SegmentType.bezier,values:[{x:r,y:n},{x:r,y:n},{x:x.empty,y:n},{x:x.empty,y:l}]}]},v={half:!0,segments:[{type:p.SegmentType.bezier,values:[{x:x.empty,y:n},{x:x.empty,y:n},{x:m,y:l},{x:m,y:x.empty}]},{type:p.SegmentType.bezier,values:[{x:m,y:x.empty},{x:m,y:x.empty},{x:m,y:r},{x:r,y:r}]},{type:p.SegmentType.bezier,values:[{x:r,y:r},{x:r,y:r},{x:i,y:r},{x:i,y:i}]},{type:p.SegmentType.bezier,values:[{x:i,y:i},{x:i,y:r},{x:r,y:m},{x:r,y:m}]},{type:p.SegmentType.bezier,values:[{x:r,y:m},{x:r,y:m},{x:x.empty,y:m},{x:x.empty,y:m}]}]},d={[s.U.hearts]:g,[s.U.diamonds]:b,[s.U.clubs]:h,[s.U.spades]:v}}}]);
|
package/657.min.js.LICENSE.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Cards Shape v4.0.0-alpha.
|
|
1
|
+
/*! tsParticles Cards Shape v4.0.0-alpha.8 by Matteo Bruni */
|
package/741.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see 741.min.js.LICENSE.txt */
|
|
2
|
-
(this.webpackChunk_tsparticles_shape_cards=this.webpackChunk_tsparticles_shape_cards||[]).push([[741],{
|
|
2
|
+
(this.webpackChunk_tsparticles_shape_cards=this.webpackChunk_tsparticles_shape_cards||[]).push([[741],{355(e,y,t){var p;t.d(y,{U:()=>p}),function(e){e.hearts="hearts",e.diamonds="diamonds",e.clubs="clubs",e.spades="spades"}(p||(p={}))},741(e,y,t){t.d(y,{ClubDrawer:()=>s});var p=t(580),x=t(792);class s{constructor(){this.validTypes=["club","clubs"]}draw(e){const{context:y,radius:t}=e;(0,p.drawPath)(y,t,x.f0.clubs)}}},792(e,y,t){t.d(y,{f0:()=>c});var p=t(580),x=t(303),s=t(355);const a=x.quarter*x.half,m=x.half,r=m*x.half,l=-m,n=-r,u=m*a,i=m*x.threeQuarter,b={half:!0,segments:[{type:p.SegmentType.bezier,values:[{x:x.empty,y:l},{x:x.empty,y:l},{x:r,y:l},{x:r,y:n}]},{type:p.SegmentType.bezier,values:[{x:r,y:n},{x:r,y:n},{x:m,y:n},{x:m,y:x.empty}]},{type:p.SegmentType.bezier,values:[{x:m,y:x.empty},{x:m,y:x.empty},{x:m,y:r},{x:r,y:r}]},{type:p.SegmentType.bezier,values:[{x:r,y:r},{x:r,y:r},{x:u,y:r},{x:u,y:u}]},{type:p.SegmentType.bezier,values:[{x:u,y:u},{x:u,y:r},{x:r,y:m},{x:r,y:m}]},{type:p.SegmentType.bezier,values:[{x:r,y:m},{x:r,y:m},{x:x.empty,y:m},{x:x.empty,y:m}]}]},g={half:!0,segments:[{type:p.SegmentType.bezier,values:[{x:x.empty,y:m},{x:x.empty,y:m},{x:i,y:x.empty},{x:i,y:x.empty}]},{type:p.SegmentType.bezier,values:[{x:i,y:x.empty},{x:i,y:x.empty},{x:x.empty,y:l},{x:x.empty,y:l}]}]},h={half:!0,segments:[{type:p.SegmentType.bezier,values:[{x:x.empty,y:m},{x:x.empty,y:m},{x:m,y:x.empty},{x:m,y:n}]},{type:p.SegmentType.bezier,values:[{x:m,y:n},{x:m,y:n},{x:m,y:l},{x:r,y:l}]},{type:p.SegmentType.bezier,values:[{x:r,y:l},{x:r,y:l},{x:x.empty,y:l},{x:x.empty,y:n}]}]},v={half:!0,segments:[{type:p.SegmentType.bezier,values:[{x:x.empty,y:l},{x:x.empty,y:l},{x:m,y:n},{x:m,y:x.empty}]},{type:p.SegmentType.bezier,values:[{x:m,y:x.empty},{x:m,y:x.empty},{x:m,y:r},{x:r,y:r}]},{type:p.SegmentType.bezier,values:[{x:r,y:r},{x:r,y:r},{x:u,y:r},{x:u,y:u}]},{type:p.SegmentType.bezier,values:[{x:u,y:u},{x:u,y:r},{x:r,y:m},{x:r,y:m}]},{type:p.SegmentType.bezier,values:[{x:r,y:m},{x:r,y:m},{x:x.empty,y:m},{x:x.empty,y:m}]}]},c={[s.U.hearts]:h,[s.U.diamonds]:g,[s.U.clubs]:b,[s.U.spades]:v}}}]);
|
package/741.min.js.LICENSE.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Cards Shape v4.0.0-alpha.
|
|
1
|
+
/*! tsParticles Cards Shape v4.0.0-alpha.8 by Matteo Bruni */
|
package/README.md
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export var CardValue;
|
|
2
|
+
(function (CardValue) {
|
|
3
|
+
CardValue["ace"] = "A";
|
|
4
|
+
CardValue["two"] = "2";
|
|
5
|
+
CardValue["three"] = "3";
|
|
6
|
+
CardValue["four"] = "4";
|
|
7
|
+
CardValue["five"] = "5";
|
|
8
|
+
CardValue["six"] = "6";
|
|
9
|
+
CardValue["seven"] = "7";
|
|
10
|
+
CardValue["eight"] = "8";
|
|
11
|
+
CardValue["nine"] = "9";
|
|
12
|
+
CardValue["ten"] = "10";
|
|
13
|
+
CardValue["jack"] = "J";
|
|
14
|
+
CardValue["queen"] = "Q";
|
|
15
|
+
CardValue["king"] = "K";
|
|
16
|
+
})(CardValue || (CardValue = {}));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { deepExtend } from "@tsparticles/engine";
|
|
2
|
+
import { drawRoundedCard } from "../utils.js";
|
|
3
|
+
export class CardDrawer {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.validTypes = ["card"];
|
|
6
|
+
}
|
|
7
|
+
draw(data) {
|
|
8
|
+
const { context, particle, radius } = data;
|
|
9
|
+
if (!particle.cardData) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
drawRoundedCard(context, radius, particle.cardData, particle.container.hdr, particle.isShowingBack());
|
|
13
|
+
}
|
|
14
|
+
particleInit(_container, particle) {
|
|
15
|
+
const shape = particle.shapeData;
|
|
16
|
+
if (!shape) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
particle.cardData = deepExtend({}, shape);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { drawPath
|
|
1
|
+
import { drawPath } from "@tsparticles/path-utils";
|
|
2
|
+
import { paths } from "../paths.js";
|
|
2
3
|
export class ClubDrawer {
|
|
3
4
|
constructor() {
|
|
4
5
|
this.validTypes = ["club", "clubs"];
|
|
5
6
|
}
|
|
6
7
|
draw(data) {
|
|
7
|
-
|
|
8
|
+
const { context, radius } = data;
|
|
9
|
+
drawPath(context, radius, paths.clubs);
|
|
8
10
|
}
|
|
9
11
|
}
|
package/browser/clubs/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export async function
|
|
2
|
-
engine.checkVersion("4.0.0-alpha.
|
|
1
|
+
export async function loadClubsSuitShape(engine) {
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.8");
|
|
3
3
|
await engine.register(async (e) => {
|
|
4
4
|
const { ClubDrawer } = await import("./ClubDrawer.js");
|
|
5
5
|
e.addShape(new ClubDrawer());
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { drawPath
|
|
1
|
+
import { drawPath } from "@tsparticles/path-utils";
|
|
2
|
+
import { paths } from "../paths.js";
|
|
2
3
|
export class DiamondDrawer {
|
|
3
4
|
constructor() {
|
|
4
5
|
this.validTypes = ["diamond", "diamonds"];
|
|
5
6
|
}
|
|
6
7
|
draw(data) {
|
|
7
|
-
|
|
8
|
+
const { context, radius } = data;
|
|
9
|
+
drawPath(context, radius, paths.diamonds);
|
|
8
10
|
}
|
|
9
11
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export async function
|
|
2
|
-
engine.checkVersion("4.0.0-alpha.
|
|
1
|
+
export async function loadDiamondsSuitShape(engine) {
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.8");
|
|
3
3
|
await engine.register(async (e) => {
|
|
4
4
|
const { DiamondDrawer } = await import("./DiamondDrawer.js");
|
|
5
5
|
e.addShape(new DiamondDrawer());
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { drawPath
|
|
1
|
+
import { drawPath } from "@tsparticles/path-utils";
|
|
2
|
+
import { paths } from "../paths.js";
|
|
2
3
|
export class HeartDrawer {
|
|
3
4
|
constructor() {
|
|
4
5
|
this.validTypes = ["heart", "hearts"];
|
|
5
6
|
}
|
|
6
7
|
draw(data) {
|
|
7
|
-
|
|
8
|
+
const { context, radius } = data;
|
|
9
|
+
drawPath(context, radius, paths.hearts);
|
|
8
10
|
}
|
|
9
11
|
}
|
package/browser/hearts/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export async function
|
|
2
|
-
engine.checkVersion("4.0.0-alpha.
|
|
1
|
+
export async function loadHeartsSuitShape(engine) {
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.8");
|
|
3
3
|
await engine.register(async (e) => {
|
|
4
4
|
const { HeartDrawer } = await import("./HeartDrawer.js");
|
|
5
5
|
e.addShape(new HeartDrawer());
|
package/browser/index.js
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
|
+
export async function loadCardSuitsShape(engine) {
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.8");
|
|
3
|
+
await engine.register(async (e) => {
|
|
4
|
+
const { loadClubsSuitShape } = await import("./clubs/index.js"), { loadDiamondsSuitShape } = await import("./diamonds/index.js"), { loadHeartsSuitShape } = await import("./hearts/index.js"), { loadSpadesSuitShape } = await import("./spades/index.js");
|
|
5
|
+
await loadClubsSuitShape(e);
|
|
6
|
+
await loadDiamondsSuitShape(e);
|
|
7
|
+
await loadHeartsSuitShape(e);
|
|
8
|
+
await loadSpadesSuitShape(e);
|
|
9
|
+
});
|
|
10
|
+
}
|
|
1
11
|
export async function loadCardsShape(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-alpha.
|
|
12
|
+
engine.checkVersion("4.0.0-alpha.8");
|
|
3
13
|
await engine.register(async (e) => {
|
|
4
|
-
const {
|
|
5
|
-
await
|
|
6
|
-
await
|
|
7
|
-
await loadHeartsCardsShape(e);
|
|
8
|
-
await loadSpadesCardsShape(e);
|
|
14
|
+
const { loadFullCardsShape } = await import("./cards/index.js");
|
|
15
|
+
await loadFullCardsShape(e);
|
|
16
|
+
await loadCardSuitsShape(e);
|
|
9
17
|
});
|
|
10
18
|
}
|
|
19
|
+
export * from "./cards/index.js";
|
|
11
20
|
export * from "./clubs/index.js";
|
|
12
21
|
export * from "./diamonds/index.js";
|
|
13
22
|
export * from "./hearts/index.js";
|
package/browser/paths.js
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { SegmentType } from "@tsparticles/path-utils";
|
|
2
|
+
import { empty, half, quarter, threeQuarter } from "@tsparticles/engine";
|
|
3
|
+
import { SuitType } from "./SuitType.js";
|
|
4
|
+
const eighth = quarter * half, n = half, halfN = n * half, oppositeN = -n, oppositeHalfN = -halfN, eighthN = n * eighth, threeQuarterN = n * threeQuarter;
|
|
5
|
+
export const club = {
|
|
6
|
+
half: true,
|
|
7
|
+
segments: [
|
|
8
|
+
{
|
|
9
|
+
type: SegmentType.bezier,
|
|
10
|
+
values: [
|
|
11
|
+
{ x: empty, y: oppositeN },
|
|
12
|
+
{ x: empty, y: oppositeN },
|
|
13
|
+
{ x: halfN, y: oppositeN },
|
|
14
|
+
{ x: halfN, y: oppositeHalfN },
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
type: SegmentType.bezier,
|
|
19
|
+
values: [
|
|
20
|
+
{ x: halfN, y: oppositeHalfN },
|
|
21
|
+
{ x: halfN, y: oppositeHalfN },
|
|
22
|
+
{ x: n, y: oppositeHalfN },
|
|
23
|
+
{ x: n, y: empty },
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: SegmentType.bezier,
|
|
28
|
+
values: [
|
|
29
|
+
{ x: n, y: empty },
|
|
30
|
+
{ x: n, y: empty },
|
|
31
|
+
{ x: n, y: halfN },
|
|
32
|
+
{ x: halfN, y: halfN },
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
type: SegmentType.bezier,
|
|
37
|
+
values: [
|
|
38
|
+
{ x: halfN, y: halfN },
|
|
39
|
+
{ x: halfN, y: halfN },
|
|
40
|
+
{ x: eighthN, y: halfN },
|
|
41
|
+
{ x: eighthN, y: eighthN },
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
type: SegmentType.bezier,
|
|
46
|
+
values: [
|
|
47
|
+
{ x: eighthN, y: eighthN },
|
|
48
|
+
{ x: eighthN, y: halfN },
|
|
49
|
+
{ x: halfN, y: n },
|
|
50
|
+
{ x: halfN, y: n },
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
type: SegmentType.bezier,
|
|
55
|
+
values: [
|
|
56
|
+
{ x: halfN, y: n },
|
|
57
|
+
{ x: halfN, y: n },
|
|
58
|
+
{ x: empty, y: n },
|
|
59
|
+
{ x: empty, y: n },
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
};
|
|
64
|
+
export const diamond = {
|
|
65
|
+
half: true,
|
|
66
|
+
segments: [
|
|
67
|
+
{
|
|
68
|
+
type: SegmentType.bezier,
|
|
69
|
+
values: [
|
|
70
|
+
{ x: empty, y: n },
|
|
71
|
+
{ x: empty, y: n },
|
|
72
|
+
{ x: threeQuarterN, y: empty },
|
|
73
|
+
{ x: threeQuarterN, y: empty },
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
type: SegmentType.bezier,
|
|
78
|
+
values: [
|
|
79
|
+
{ x: threeQuarterN, y: empty },
|
|
80
|
+
{ x: threeQuarterN, y: empty },
|
|
81
|
+
{ x: empty, y: oppositeN },
|
|
82
|
+
{ x: empty, y: oppositeN },
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
};
|
|
87
|
+
export const heart = {
|
|
88
|
+
half: true,
|
|
89
|
+
segments: [
|
|
90
|
+
{
|
|
91
|
+
type: SegmentType.bezier,
|
|
92
|
+
values: [
|
|
93
|
+
{ x: empty, y: n },
|
|
94
|
+
{ x: empty, y: n },
|
|
95
|
+
{ x: n, y: empty },
|
|
96
|
+
{ x: n, y: oppositeHalfN },
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
type: SegmentType.bezier,
|
|
101
|
+
values: [
|
|
102
|
+
{ x: n, y: oppositeHalfN },
|
|
103
|
+
{ x: n, y: oppositeHalfN },
|
|
104
|
+
{ x: n, y: oppositeN },
|
|
105
|
+
{ x: halfN, y: oppositeN },
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
type: SegmentType.bezier,
|
|
110
|
+
values: [
|
|
111
|
+
{ x: halfN, y: oppositeN },
|
|
112
|
+
{ x: halfN, y: oppositeN },
|
|
113
|
+
{ x: empty, y: oppositeN },
|
|
114
|
+
{ x: empty, y: oppositeHalfN },
|
|
115
|
+
],
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
};
|
|
119
|
+
export const spade = {
|
|
120
|
+
half: true,
|
|
121
|
+
segments: [
|
|
122
|
+
{
|
|
123
|
+
type: SegmentType.bezier,
|
|
124
|
+
values: [
|
|
125
|
+
{ x: empty, y: oppositeN },
|
|
126
|
+
{ x: empty, y: oppositeN },
|
|
127
|
+
{ x: n, y: oppositeHalfN },
|
|
128
|
+
{ x: n, y: empty },
|
|
129
|
+
],
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
type: SegmentType.bezier,
|
|
133
|
+
values: [
|
|
134
|
+
{ x: n, y: empty },
|
|
135
|
+
{ x: n, y: empty },
|
|
136
|
+
{ x: n, y: halfN },
|
|
137
|
+
{ x: halfN, y: halfN },
|
|
138
|
+
],
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
type: SegmentType.bezier,
|
|
142
|
+
values: [
|
|
143
|
+
{ x: halfN, y: halfN },
|
|
144
|
+
{ x: halfN, y: halfN },
|
|
145
|
+
{ x: eighthN, y: halfN },
|
|
146
|
+
{ x: eighthN, y: eighthN },
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
type: SegmentType.bezier,
|
|
151
|
+
values: [
|
|
152
|
+
{ x: eighthN, y: eighthN },
|
|
153
|
+
{ x: eighthN, y: halfN },
|
|
154
|
+
{ x: halfN, y: n },
|
|
155
|
+
{ x: halfN, y: n },
|
|
156
|
+
],
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
type: SegmentType.bezier,
|
|
160
|
+
values: [
|
|
161
|
+
{ x: halfN, y: n },
|
|
162
|
+
{ x: halfN, y: n },
|
|
163
|
+
{ x: empty, y: n },
|
|
164
|
+
{ x: empty, y: n },
|
|
165
|
+
],
|
|
166
|
+
},
|
|
167
|
+
],
|
|
168
|
+
};
|
|
169
|
+
export const paths = {
|
|
170
|
+
[SuitType.hearts]: heart,
|
|
171
|
+
[SuitType.diamonds]: diamond,
|
|
172
|
+
[SuitType.clubs]: club,
|
|
173
|
+
[SuitType.spades]: spade,
|
|
174
|
+
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { drawPath
|
|
1
|
+
import { drawPath } from "@tsparticles/path-utils";
|
|
2
|
+
import { paths } from "../paths.js";
|
|
2
3
|
export class SpadeDrawer {
|
|
3
4
|
constructor() {
|
|
4
5
|
this.validTypes = ["spade", "spades"];
|
|
5
6
|
}
|
|
6
7
|
draw(data) {
|
|
7
|
-
|
|
8
|
+
const { context, radius } = data;
|
|
9
|
+
drawPath(context, radius, paths.spades);
|
|
8
10
|
}
|
|
9
11
|
}
|
package/browser/spades/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export async function
|
|
2
|
-
engine.checkVersion("4.0.0-alpha.
|
|
1
|
+
export async function loadSpadesSuitShape(engine) {
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.8");
|
|
3
3
|
await engine.register(async (e) => {
|
|
4
4
|
const { SpadeDrawer } = await import("./SpadeDrawer.js");
|
|
5
5
|
e.addShape(new SpadeDrawer());
|
package/browser/utils.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { double, doublePI, getStyleFromRgb, half, originPoint, triple } from "@tsparticles/engine";
|
|
2
|
+
import { SuitType } from "./SuitType.js";
|
|
3
|
+
import { drawPath } from "@tsparticles/path-utils";
|
|
4
|
+
import { paths } from "./paths.js";
|
|
5
|
+
const cardWidthRatio = (double * double) / triple, cardHeightRatio = double, cornerRadiusRatio = 0.2, cornerFontRatio = 0.4, cornerSuitRatio = 0.3, centerSuitRatio = 0.9, cornerPaddingRatio = 0.2, textHorizontalOffsetRatio = 0.25, minRadius = 0, minAngle = 0, suitEdgeBufferFactor = 0.1, fixedCacheKey = 2, cardsCache = new Map();
|
|
6
|
+
export function drawRoundedCard(ctx, radius, cardData, hdr, flipped) {
|
|
7
|
+
if (flipped) {
|
|
8
|
+
drawRoundedCardBack(ctx, radius);
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
const cacheKey = getCacheKey(radius, cardData), cardWidth = radius * cardWidthRatio, cardHeight = radius * cardHeightRatio, halfWidth = cardWidth * half, halfHeight = cardHeight * half;
|
|
12
|
+
if (!cardsCache.has(cacheKey)) {
|
|
13
|
+
const canvas = new OffscreenCanvas(cardWidth, cardHeight), offCtx = canvas.getContext("2d");
|
|
14
|
+
if (offCtx) {
|
|
15
|
+
offCtx.translate(halfWidth, halfHeight);
|
|
16
|
+
drawRoundedCardFront(offCtx, radius, cardData, hdr);
|
|
17
|
+
cardsCache.set(cacheKey, canvas);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const cachedCanvas = cardsCache.get(cacheKey);
|
|
21
|
+
if (cachedCanvas) {
|
|
22
|
+
ctx.drawImage(cachedCanvas, -halfWidth, -halfHeight, cardWidth, cardHeight);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
drawRoundedCardFront(ctx, radius, cardData, hdr);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function getCacheKey(radius, cardData) {
|
|
30
|
+
return `${radius.toFixed(fixedCacheKey)}-${cardData.suit}-${cardData.value}`;
|
|
31
|
+
}
|
|
32
|
+
function drawRoundedCardBack(ctx, radius) {
|
|
33
|
+
drawCardBody(ctx, radius);
|
|
34
|
+
}
|
|
35
|
+
function drawRoundedCardFront(ctx, radius, cardData, hdr) {
|
|
36
|
+
const { suit, value } = cardData, cardWidth = radius * cardWidthRatio, cardHeight = radius * cardHeightRatio, halfWidth = cardWidth * half, halfHeight = cardHeight * half, cornerPadding = radius * cornerPaddingRatio, cornerFontSize = radius * cornerFontRatio, cornerSuitSize = radius * cornerSuitRatio, centerSuitSize = radius * centerSuitRatio, textOffset = radius * textHorizontalOffsetRatio, suitEdgeBuffer = radius * suitEdgeBufferFactor, isRed = suit === SuitType.hearts || suit === SuitType.diamonds, color = isRed ? getStyleFromRgb({ r: 255, g: 0, b: 0 }, hdr) : getStyleFromRgb({ r: 0, g: 0, b: 0 }, hdr);
|
|
37
|
+
ctx.save();
|
|
38
|
+
drawCardBody(ctx, radius);
|
|
39
|
+
ctx.fillStyle = getStyleFromRgb({ r: 255, g: 255, b: 255 }, hdr);
|
|
40
|
+
ctx.fill();
|
|
41
|
+
ctx.strokeStyle = getStyleFromRgb({ r: 0, g: 0, b: 0 }, hdr);
|
|
42
|
+
ctx.stroke();
|
|
43
|
+
ctx.fillStyle = color;
|
|
44
|
+
ctx.font = `bold ${cornerFontSize.toString()}px Arial, serif`;
|
|
45
|
+
ctx.textAlign = "left";
|
|
46
|
+
ctx.textBaseline = "middle";
|
|
47
|
+
const topLeftX = -halfWidth + cornerPadding + suitEdgeBuffer;
|
|
48
|
+
const topLeftY = -halfHeight + cornerPadding + cornerFontSize * half;
|
|
49
|
+
ctx.save();
|
|
50
|
+
ctx.translate(topLeftX, topLeftY);
|
|
51
|
+
ctx.beginPath();
|
|
52
|
+
drawPath(ctx, cornerSuitSize, paths[suit]);
|
|
53
|
+
ctx.fill();
|
|
54
|
+
ctx.restore();
|
|
55
|
+
ctx.fillText(value, topLeftX + textOffset, topLeftY);
|
|
56
|
+
ctx.save();
|
|
57
|
+
ctx.translate(halfWidth - cornerPadding - suitEdgeBuffer, halfHeight - cornerPadding - cornerFontSize * half);
|
|
58
|
+
ctx.rotate(Math.PI);
|
|
59
|
+
ctx.save();
|
|
60
|
+
ctx.beginPath();
|
|
61
|
+
drawPath(ctx, cornerSuitSize, paths[suit]);
|
|
62
|
+
ctx.fill();
|
|
63
|
+
ctx.restore();
|
|
64
|
+
ctx.fillText(value, originPoint.x + textOffset, originPoint.y);
|
|
65
|
+
ctx.restore();
|
|
66
|
+
ctx.save();
|
|
67
|
+
ctx.beginPath();
|
|
68
|
+
drawPath(ctx, centerSuitSize, paths[suit]);
|
|
69
|
+
ctx.fillStyle = color;
|
|
70
|
+
ctx.fill();
|
|
71
|
+
ctx.restore();
|
|
72
|
+
ctx.beginPath();
|
|
73
|
+
ctx.arc(originPoint.x, originPoint.y, minRadius, minAngle, doublePI, false);
|
|
74
|
+
ctx.closePath();
|
|
75
|
+
ctx.restore();
|
|
76
|
+
}
|
|
77
|
+
function drawCardBody(ctx, radius) {
|
|
78
|
+
const cardWidth = radius * cardWidthRatio, cardHeight = radius * cardHeightRatio, halfWidth = cardWidth * half, halfHeight = cardHeight * half, cornerRadius = radius * cornerRadiusRatio;
|
|
79
|
+
ctx.beginPath();
|
|
80
|
+
ctx.moveTo(-halfWidth + cornerRadius, -halfHeight);
|
|
81
|
+
ctx.lineTo(halfWidth - cornerRadius, -halfHeight);
|
|
82
|
+
ctx.quadraticCurveTo(halfWidth, -halfHeight, halfWidth, -halfHeight + cornerRadius);
|
|
83
|
+
ctx.lineTo(halfWidth, halfHeight - cornerRadius);
|
|
84
|
+
ctx.quadraticCurveTo(halfWidth, halfHeight, halfWidth - cornerRadius, halfHeight);
|
|
85
|
+
ctx.lineTo(-halfWidth + cornerRadius, halfHeight);
|
|
86
|
+
ctx.quadraticCurveTo(-halfWidth, halfHeight, -halfWidth, halfHeight - cornerRadius);
|
|
87
|
+
ctx.lineTo(-halfWidth, -halfHeight + cornerRadius);
|
|
88
|
+
ctx.quadraticCurveTo(-halfWidth, -halfHeight, -halfWidth + cornerRadius, -halfHeight);
|
|
89
|
+
ctx.closePath();
|
|
90
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/cjs/CardValue.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export var CardValue;
|
|
2
|
+
(function (CardValue) {
|
|
3
|
+
CardValue["ace"] = "A";
|
|
4
|
+
CardValue["two"] = "2";
|
|
5
|
+
CardValue["three"] = "3";
|
|
6
|
+
CardValue["four"] = "4";
|
|
7
|
+
CardValue["five"] = "5";
|
|
8
|
+
CardValue["six"] = "6";
|
|
9
|
+
CardValue["seven"] = "7";
|
|
10
|
+
CardValue["eight"] = "8";
|
|
11
|
+
CardValue["nine"] = "9";
|
|
12
|
+
CardValue["ten"] = "10";
|
|
13
|
+
CardValue["jack"] = "J";
|
|
14
|
+
CardValue["queen"] = "Q";
|
|
15
|
+
CardValue["king"] = "K";
|
|
16
|
+
})(CardValue || (CardValue = {}));
|
package/cjs/ICardData.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/cjs/SuitType.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { deepExtend } from "@tsparticles/engine";
|
|
2
|
+
import { drawRoundedCard } from "../utils.js";
|
|
3
|
+
export class CardDrawer {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.validTypes = ["card"];
|
|
6
|
+
}
|
|
7
|
+
draw(data) {
|
|
8
|
+
const { context, particle, radius } = data;
|
|
9
|
+
if (!particle.cardData) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
drawRoundedCard(context, radius, particle.cardData, particle.container.hdr, particle.isShowingBack());
|
|
13
|
+
}
|
|
14
|
+
particleInit(_container, particle) {
|
|
15
|
+
const shape = particle.shapeData;
|
|
16
|
+
if (!shape) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
particle.cardData = deepExtend({}, shape);
|
|
20
|
+
}
|
|
21
|
+
}
|