@tsparticles/shape-cards 4.0.0-alpha.5 → 4.0.0-beta.0

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.
Files changed (120) hide show
  1. package/111.min.js +1 -0
  2. package/222.min.js +1 -0
  3. package/499.min.js +1 -0
  4. package/631.min.js +1 -0
  5. package/841.min.js +1 -0
  6. package/README.md +1 -1
  7. package/browser/CardValue.js +16 -0
  8. package/browser/SuitType.js +7 -0
  9. package/browser/cards/CardDrawer.js +21 -0
  10. package/browser/cards/index.js +9 -0
  11. package/browser/clubs/ClubDrawer.js +4 -5
  12. package/browser/clubs/index.js +7 -5
  13. package/browser/diamonds/DiamondDrawer.js +4 -5
  14. package/browser/diamonds/index.js +7 -5
  15. package/browser/hearts/HeartDrawer.js +4 -5
  16. package/browser/hearts/index.js +7 -5
  17. package/browser/index.js +24 -6
  18. package/browser/paths.js +174 -0
  19. package/browser/spades/SpadeDrawer.js +4 -5
  20. package/browser/spades/index.js +7 -5
  21. package/browser/utils.js +100 -0
  22. package/cjs/CardParticle.js +1 -0
  23. package/cjs/CardValue.js +16 -0
  24. package/cjs/ICardData.js +1 -0
  25. package/cjs/ICardSuitsPath.js +1 -0
  26. package/cjs/SuitType.js +7 -0
  27. package/cjs/cards/CardDrawer.js +21 -0
  28. package/cjs/cards/index.js +9 -0
  29. package/cjs/clubs/ClubDrawer.js +4 -5
  30. package/cjs/clubs/index.js +7 -5
  31. package/cjs/diamonds/DiamondDrawer.js +4 -5
  32. package/cjs/diamonds/index.js +7 -5
  33. package/cjs/hearts/HeartDrawer.js +4 -5
  34. package/cjs/hearts/index.js +7 -5
  35. package/cjs/index.js +24 -6
  36. package/cjs/paths.js +174 -0
  37. package/cjs/spades/SpadeDrawer.js +4 -5
  38. package/cjs/spades/index.js +7 -5
  39. package/cjs/utils.js +100 -0
  40. package/dist_browser_cards_CardDrawer_js.js +60 -0
  41. package/dist_browser_clubs_ClubDrawer_js.js +17 -7
  42. package/dist_browser_diamonds_DiamondDrawer_js.js +17 -7
  43. package/dist_browser_hearts_HeartDrawer_js.js +17 -7
  44. package/dist_browser_spades_SpadeDrawer_js.js +15 -5
  45. package/esm/CardParticle.js +1 -0
  46. package/esm/CardValue.js +16 -0
  47. package/esm/ICardData.js +1 -0
  48. package/esm/ICardSuitsPath.js +1 -0
  49. package/esm/SuitType.js +7 -0
  50. package/esm/cards/CardDrawer.js +21 -0
  51. package/esm/cards/index.js +9 -0
  52. package/esm/clubs/ClubDrawer.js +4 -5
  53. package/esm/clubs/index.js +7 -5
  54. package/esm/diamonds/DiamondDrawer.js +4 -5
  55. package/esm/diamonds/index.js +7 -5
  56. package/esm/hearts/HeartDrawer.js +4 -5
  57. package/esm/hearts/index.js +7 -5
  58. package/esm/index.js +24 -6
  59. package/esm/paths.js +174 -0
  60. package/esm/spades/SpadeDrawer.js +4 -5
  61. package/esm/spades/index.js +7 -5
  62. package/esm/utils.js +100 -0
  63. package/package.json +3 -2
  64. package/report.html +3 -3
  65. package/tsparticles.shape.cards.js +60 -18
  66. package/tsparticles.shape.cards.min.js +2 -2
  67. package/types/CardParticle.d.ts +5 -0
  68. package/types/CardValue.d.ts +15 -0
  69. package/types/ICardData.d.ts +7 -0
  70. package/types/ICardSuitsPath.d.ts +3 -0
  71. package/types/SuitType.d.ts +6 -0
  72. package/types/cards/CardDrawer.d.ts +6 -0
  73. package/types/cards/index.d.ts +2 -0
  74. package/types/clubs/ClubDrawer.d.ts +0 -1
  75. package/types/clubs/index.d.ts +1 -1
  76. package/types/diamonds/DiamondDrawer.d.ts +0 -1
  77. package/types/diamonds/index.d.ts +1 -1
  78. package/types/hearts/HeartDrawer.d.ts +0 -1
  79. package/types/hearts/index.d.ts +1 -1
  80. package/types/index.d.ts +2 -0
  81. package/types/paths.d.ts +7 -0
  82. package/types/spades/SpadeDrawer.d.ts +0 -1
  83. package/types/spades/index.d.ts +1 -1
  84. package/types/utils.d.ts +2 -0
  85. package/umd/CardValue.js +29 -0
  86. package/umd/ICardData.js +12 -0
  87. package/umd/ICardSuitsPath.js +12 -0
  88. package/umd/SuitType.js +20 -0
  89. package/umd/cards/CardDrawer.js +35 -0
  90. package/umd/cards/index.js +56 -0
  91. package/umd/clubs/ClubDrawer.js +5 -6
  92. package/umd/clubs/index.js +8 -6
  93. package/umd/diamonds/DiamondDrawer.js +5 -6
  94. package/umd/diamonds/index.js +8 -6
  95. package/umd/hearts/HeartDrawer.js +5 -6
  96. package/umd/hearts/index.js +8 -6
  97. package/umd/index.js +26 -7
  98. package/umd/paths.js +187 -0
  99. package/umd/spades/SpadeDrawer.js +5 -6
  100. package/umd/spades/index.js +8 -6
  101. package/umd/utils.js +113 -0
  102. package/475.min.js +0 -2
  103. package/475.min.js.LICENSE.txt +0 -1
  104. package/505.min.js +0 -2
  105. package/505.min.js.LICENSE.txt +0 -1
  106. package/657.min.js +0 -2
  107. package/657.min.js.LICENSE.txt +0 -1
  108. package/741.min.js +0 -2
  109. package/741.min.js.LICENSE.txt +0 -1
  110. package/browser/Utils.js +0 -161
  111. package/cjs/Utils.js +0 -161
  112. package/esm/Utils.js +0 -161
  113. package/tsparticles.shape.cards.min.js.LICENSE.txt +0 -1
  114. package/types/ICardsPath.d.ts +0 -13
  115. package/types/Utils.d.ts +0 -4
  116. package/umd/Utils.js +0 -175
  117. /package/browser/{ICardsPath.js → CardParticle.js} +0 -0
  118. /package/{cjs/ICardsPath.js → browser/ICardData.js} +0 -0
  119. /package/{esm/ICardsPath.js → browser/ICardSuitsPath.js} +0 -0
  120. /package/umd/{ICardsPath.js → CardParticle.js} +0 -0
@@ -1,9 +1,8 @@
1
- import { drawPath, paths } from "../Utils.js";
1
+ import { drawPath } from "@tsparticles/path-utils";
2
+ import { paths } from "../paths.js";
2
3
  export class DiamondDrawer {
3
- constructor() {
4
- this.validTypes = ["diamond", "diamonds"];
5
- }
6
4
  draw(data) {
7
- drawPath(data, paths.diamond);
5
+ const { context, radius } = data;
6
+ drawPath(context, radius, paths.diamonds);
8
7
  }
9
8
  }
@@ -1,7 +1,9 @@
1
- export async function loadDiamondsCardsShape(engine) {
2
- engine.checkVersion("4.0.0-alpha.5");
3
- await engine.register(async (e) => {
4
- const { DiamondDrawer } = await import("./DiamondDrawer.js");
5
- e.addShape(new DiamondDrawer());
1
+ export async function loadDiamondsSuitShape(engine) {
2
+ engine.checkVersion("4.0.0-beta.0");
3
+ await engine.register(e => {
4
+ e.addShape(["diamond", "diamonds"], async () => {
5
+ const { DiamondDrawer } = await import("./DiamondDrawer.js");
6
+ return new DiamondDrawer();
7
+ });
6
8
  });
7
9
  }
@@ -1,9 +1,8 @@
1
- import { drawPath, paths } from "../Utils.js";
1
+ import { drawPath } from "@tsparticles/path-utils";
2
+ import { paths } from "../paths.js";
2
3
  export class HeartDrawer {
3
- constructor() {
4
- this.validTypes = ["heart", "hearts"];
5
- }
6
4
  draw(data) {
7
- drawPath(data, paths.heart);
5
+ const { context, radius } = data;
6
+ drawPath(context, radius, paths.hearts);
8
7
  }
9
8
  }
@@ -1,7 +1,9 @@
1
- export async function loadHeartsCardsShape(engine) {
2
- engine.checkVersion("4.0.0-alpha.5");
3
- await engine.register(async (e) => {
4
- const { HeartDrawer } = await import("./HeartDrawer.js");
5
- e.addShape(new HeartDrawer());
1
+ export async function loadHeartsSuitShape(engine) {
2
+ engine.checkVersion("4.0.0-beta.0");
3
+ await engine.register(e => {
4
+ e.addShape(["heart", "hearts"], async () => {
5
+ const { HeartDrawer } = await import("./HeartDrawer.js");
6
+ return new HeartDrawer();
7
+ });
6
8
  });
7
9
  }
package/cjs/index.js CHANGED
@@ -1,13 +1,31 @@
1
+ export async function loadCardSuitsShape(engine) {
2
+ engine.checkVersion("4.0.0-beta.0");
3
+ await engine.register(async (e) => {
4
+ const [{ loadClubsSuitShape }, { loadDiamondsSuitShape }, { loadHeartsSuitShape }, { loadSpadesSuitShape },] = await Promise.all([
5
+ import("./clubs/index.js"),
6
+ import("./diamonds/index.js"),
7
+ import("./hearts/index.js"),
8
+ import("./spades/index.js"),
9
+ ]);
10
+ await Promise.all([
11
+ loadClubsSuitShape(e),
12
+ loadDiamondsSuitShape(e),
13
+ loadHeartsSuitShape(e),
14
+ loadSpadesSuitShape(e),
15
+ ]);
16
+ });
17
+ }
1
18
  export async function loadCardsShape(engine) {
2
- engine.checkVersion("4.0.0-alpha.5");
19
+ engine.checkVersion("4.0.0-beta.0");
3
20
  await engine.register(async (e) => {
4
- const { loadClubsCardsShape } = await import("./clubs/index.js"), { loadDiamondsCardsShape } = await import("./diamonds/index.js"), { loadHeartsCardsShape } = await import("./hearts/index.js"), { loadSpadesCardsShape } = await import("./spades/index.js");
5
- await loadClubsCardsShape(e);
6
- await loadDiamondsCardsShape(e);
7
- await loadHeartsCardsShape(e);
8
- await loadSpadesCardsShape(e);
21
+ const { loadFullCardsShape } = await import("./cards/index.js");
22
+ await Promise.all([
23
+ loadFullCardsShape(e),
24
+ loadCardSuitsShape(e),
25
+ ]);
9
26
  });
10
27
  }
28
+ export * from "./cards/index.js";
11
29
  export * from "./clubs/index.js";
12
30
  export * from "./diamonds/index.js";
13
31
  export * from "./hearts/index.js";
package/cjs/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,8 @@
1
- import { drawPath, paths } from "../Utils.js";
1
+ import { drawPath } from "@tsparticles/path-utils";
2
+ import { paths } from "../paths.js";
2
3
  export class SpadeDrawer {
3
- constructor() {
4
- this.validTypes = ["spade", "spades"];
5
- }
6
4
  draw(data) {
7
- drawPath(data, paths.spade);
5
+ const { context, radius } = data;
6
+ drawPath(context, radius, paths.spades);
8
7
  }
9
8
  }
@@ -1,7 +1,9 @@
1
- export async function loadSpadesCardsShape(engine) {
2
- engine.checkVersion("4.0.0-alpha.5");
3
- await engine.register(async (e) => {
4
- const { SpadeDrawer } = await import("./SpadeDrawer.js");
5
- e.addShape(new SpadeDrawer());
1
+ export async function loadSpadesSuitShape(engine) {
2
+ engine.checkVersion("4.0.0-beta.0");
3
+ await engine.register(e => {
4
+ e.addShape(["spade", "spades"], async () => {
5
+ const { SpadeDrawer } = await import("./SpadeDrawer.js");
6
+ return new SpadeDrawer();
7
+ });
6
8
  });
7
9
  }
package/cjs/utils.js ADDED
@@ -0,0 +1,100 @@
1
+ import { double, doublePI, getStyleFromRgb, half, originPoint, safeDocument, 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.7, cornerPaddingRatio = 0.2, textHorizontalOffsetRatio = 0.25, minRadius = 0, minAngle = 0, suitEdgeBufferFactor = 0.1, fixedCacheKey = 2, cardsCache = new Map(), redSuitColor = { r: 215, g: 20, b: 20 }, blackSuitColor = { r: 18, g: 18, b: 18 };
6
+ export function drawRoundedCard(ctx, radius, cardData, hdr, flipped, canvasSettings) {
7
+ if (flipped) {
8
+ drawRoundedCardBack(ctx, radius);
9
+ }
10
+ else {
11
+ const cacheKey = getCacheKey(radius, hdr, cardData), cardWidth = radius * cardWidthRatio, cardHeight = radius * cardHeightRatio, halfWidth = cardWidth * half, halfHeight = cardHeight * half;
12
+ let cachedData = cardsCache.get(cacheKey);
13
+ if (!cachedData) {
14
+ let cacheCanvas, cacheCtx;
15
+ if (typeof OffscreenCanvas === "undefined") {
16
+ cacheCanvas = safeDocument().createElement("canvas");
17
+ cacheCanvas.width = cardWidth;
18
+ cacheCanvas.height = cardHeight;
19
+ cacheCtx = cacheCanvas.getContext("2d", canvasSettings);
20
+ }
21
+ else {
22
+ cacheCanvas = new OffscreenCanvas(cardWidth, cardHeight);
23
+ cacheCtx = cacheCanvas.getContext("2d", canvasSettings);
24
+ }
25
+ if (cacheCtx) {
26
+ cacheCtx.translate(halfWidth, halfHeight);
27
+ drawRoundedCardFront(cacheCtx, radius, cardData, hdr);
28
+ cachedData = cacheCanvas instanceof HTMLCanvasElement ? cacheCanvas : cacheCanvas.transferToImageBitmap();
29
+ cardsCache.set(cacheKey, cachedData);
30
+ }
31
+ }
32
+ if (cachedData) {
33
+ ctx.drawImage(cachedData, -halfWidth, -halfHeight, cardWidth, cardHeight);
34
+ }
35
+ else {
36
+ drawRoundedCardFront(ctx, radius, cardData, hdr);
37
+ }
38
+ }
39
+ }
40
+ function getCacheKey(radius, hdr, cardData) {
41
+ return `${radius.toFixed(fixedCacheKey)}-${hdr ? "hdr" : "sdr"}-${cardData.suit}-${cardData.value}`;
42
+ }
43
+ function drawRoundedCardBack(ctx, radius) {
44
+ drawCardBody(ctx, radius);
45
+ }
46
+ function drawRoundedCardFront(ctx, radius, cardData, hdr) {
47
+ 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(redSuitColor, hdr) : getStyleFromRgb(blackSuitColor, hdr);
48
+ ctx.save();
49
+ drawCardBody(ctx, radius);
50
+ ctx.fillStyle = getStyleFromRgb({ r: 255, g: 255, b: 255 }, hdr);
51
+ ctx.fill();
52
+ ctx.strokeStyle = getStyleFromRgb({ r: 0, g: 0, b: 0 }, hdr);
53
+ ctx.stroke();
54
+ ctx.fillStyle = color;
55
+ ctx.font = `bold ${cornerFontSize.toString()}px Arial, serif`;
56
+ ctx.textAlign = "left";
57
+ ctx.textBaseline = "middle";
58
+ const topLeftX = -halfWidth + cornerPadding + suitEdgeBuffer, topLeftY = -halfHeight + cornerPadding + cornerFontSize * half;
59
+ ctx.save();
60
+ ctx.translate(topLeftX, topLeftY);
61
+ ctx.beginPath();
62
+ drawPath(ctx, cornerSuitSize, paths[suit]);
63
+ ctx.fill();
64
+ ctx.restore();
65
+ ctx.fillText(value, topLeftX + textOffset, topLeftY);
66
+ ctx.save();
67
+ ctx.translate(halfWidth - cornerPadding - suitEdgeBuffer, halfHeight - cornerPadding - cornerFontSize * half);
68
+ ctx.rotate(Math.PI);
69
+ ctx.save();
70
+ ctx.beginPath();
71
+ drawPath(ctx, cornerSuitSize, paths[suit]);
72
+ ctx.fill();
73
+ ctx.restore();
74
+ ctx.fillText(value, originPoint.x + textOffset, originPoint.y);
75
+ ctx.restore();
76
+ ctx.save();
77
+ ctx.beginPath();
78
+ drawPath(ctx, centerSuitSize, paths[suit]);
79
+ ctx.fillStyle = color;
80
+ ctx.fill();
81
+ ctx.restore();
82
+ ctx.beginPath();
83
+ ctx.arc(originPoint.x, originPoint.y, minRadius, minAngle, doublePI, false);
84
+ ctx.closePath();
85
+ ctx.restore();
86
+ }
87
+ function drawCardBody(ctx, radius) {
88
+ const cardWidth = radius * cardWidthRatio, cardHeight = radius * cardHeightRatio, halfWidth = cardWidth * half, halfHeight = cardHeight * half, cornerRadius = radius * cornerRadiusRatio;
89
+ ctx.beginPath();
90
+ ctx.moveTo(-halfWidth + cornerRadius, -halfHeight);
91
+ ctx.lineTo(halfWidth - cornerRadius, -halfHeight);
92
+ ctx.quadraticCurveTo(halfWidth, -halfHeight, halfWidth, -halfHeight + cornerRadius);
93
+ ctx.lineTo(halfWidth, halfHeight - cornerRadius);
94
+ ctx.quadraticCurveTo(halfWidth, halfHeight, halfWidth - cornerRadius, halfHeight);
95
+ ctx.lineTo(-halfWidth + cornerRadius, halfHeight);
96
+ ctx.quadraticCurveTo(-halfWidth, halfHeight, -halfWidth, halfHeight - cornerRadius);
97
+ ctx.lineTo(-halfWidth, -halfHeight + cornerRadius);
98
+ ctx.quadraticCurveTo(-halfWidth, -halfHeight, -halfWidth + cornerRadius, -halfHeight);
99
+ ctx.closePath();
100
+ }
@@ -0,0 +1,60 @@
1
+ /*!
2
+ * Author : Matteo Bruni
3
+ * MIT license: https://opensource.org/licenses/MIT
4
+ * Demo / Generator : https://particles.js.org/
5
+ * GitHub : https://www.github.com/matteobruni/tsparticles
6
+ * How to use? : Check the GitHub README
7
+ * v4.0.0-beta.0
8
+ */
9
+ "use strict";
10
+ /*
11
+ * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
12
+ * This devtool is neither made for production nor for readable output files.
13
+ * It uses "eval()" calls to create a separate source file in the browser devtools.
14
+ * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
15
+ * or disable the default devtool with "devtool: false".
16
+ * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
17
+ */
18
+ (this["webpackChunk_tsparticles_shape_cards"] = this["webpackChunk_tsparticles_shape_cards"] || []).push([["dist_browser_cards_CardDrawer_js"],{
19
+
20
+ /***/ "./dist/browser/SuitType.js"
21
+ /*!**********************************!*\
22
+ !*** ./dist/browser/SuitType.js ***!
23
+ \**********************************/
24
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
25
+
26
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SuitType: () => (/* binding */ SuitType)\n/* harmony export */ });\nvar SuitType;\n(function(SuitType) {\n SuitType[\"hearts\"] = \"hearts\";\n SuitType[\"diamonds\"] = \"diamonds\";\n SuitType[\"clubs\"] = \"clubs\";\n SuitType[\"spades\"] = \"spades\";\n})(SuitType || (SuitType = {}));\n\n\n//# sourceURL=webpack://@tsparticles/shape-cards/./dist/browser/SuitType.js?\n}");
27
+
28
+ /***/ },
29
+
30
+ /***/ "./dist/browser/cards/CardDrawer.js"
31
+ /*!******************************************!*\
32
+ !*** ./dist/browser/cards/CardDrawer.js ***!
33
+ \******************************************/
34
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
35
+
36
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CardDrawer: () => (/* binding */ CardDrawer)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils.js */ \"./dist/browser/utils.js\");\n\n\nclass CardDrawer {\n draw(data) {\n const { context, particle, opacity, radius } = data;\n if (!particle.cardData) {\n return;\n }\n const defaultOpacity = context.globalAlpha;\n context.globalAlpha = opacity;\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.drawRoundedCard)(context, radius, particle.cardData, particle.container.hdr, particle.isShowingBack(), particle.container.canvas.settings);\n context.globalAlpha = defaultOpacity;\n }\n particleInit(_container, particle) {\n const shape = particle.shapeData;\n if (!shape) {\n return;\n }\n particle.cardData = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.deepExtend)({}, shape);\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/shape-cards/./dist/browser/cards/CardDrawer.js?\n}");
37
+
38
+ /***/ },
39
+
40
+ /***/ "./dist/browser/paths.js"
41
+ /*!*******************************!*\
42
+ !*** ./dist/browser/paths.js ***!
43
+ \*******************************/
44
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
45
+
46
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ club: () => (/* binding */ club),\n/* harmony export */ diamond: () => (/* binding */ diamond),\n/* harmony export */ heart: () => (/* binding */ heart),\n/* harmony export */ paths: () => (/* binding */ paths),\n/* harmony export */ spade: () => (/* binding */ spade)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/path-utils */ \"@tsparticles/path-utils\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _SuitType_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SuitType.js */ \"./dist/browser/SuitType.js\");\n\n\n\nconst eighth = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.quarter * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.half, n = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.half, halfN = n * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.half, oppositeN = -n, oppositeHalfN = -halfN, eighthN = n * eighth, threeQuarterN = n * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.threeQuarter;\nconst club = {\n half: true,\n segments: [\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: oppositeN\n },\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: oppositeN\n },\n {\n x: halfN,\n y: oppositeN\n },\n {\n x: halfN,\n y: oppositeHalfN\n }\n ]\n },\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: halfN,\n y: oppositeHalfN\n },\n {\n x: halfN,\n y: oppositeHalfN\n },\n {\n x: n,\n y: oppositeHalfN\n },\n {\n x: n,\n y: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty\n }\n ]\n },\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: n,\n y: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty\n },\n {\n x: n,\n y: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty\n },\n {\n x: n,\n y: halfN\n },\n {\n x: halfN,\n y: halfN\n }\n ]\n },\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: halfN,\n y: halfN\n },\n {\n x: halfN,\n y: halfN\n },\n {\n x: eighthN,\n y: halfN\n },\n {\n x: eighthN,\n y: eighthN\n }\n ]\n },\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: eighthN,\n y: eighthN\n },\n {\n x: eighthN,\n y: halfN\n },\n {\n x: halfN,\n y: n\n },\n {\n x: halfN,\n y: n\n }\n ]\n },\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: halfN,\n y: n\n },\n {\n x: halfN,\n y: n\n },\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: n\n },\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: n\n }\n ]\n }\n ]\n};\nconst diamond = {\n half: true,\n segments: [\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: n\n },\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: n\n },\n {\n x: threeQuarterN,\n y: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty\n },\n {\n x: threeQuarterN,\n y: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty\n }\n ]\n },\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: threeQuarterN,\n y: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty\n },\n {\n x: threeQuarterN,\n y: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty\n },\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: oppositeN\n },\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: oppositeN\n }\n ]\n }\n ]\n};\nconst heart = {\n half: true,\n segments: [\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: n\n },\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: n\n },\n {\n x: n,\n y: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty\n },\n {\n x: n,\n y: oppositeHalfN\n }\n ]\n },\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: n,\n y: oppositeHalfN\n },\n {\n x: n,\n y: oppositeHalfN\n },\n {\n x: n,\n y: oppositeN\n },\n {\n x: halfN,\n y: oppositeN\n }\n ]\n },\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: halfN,\n y: oppositeN\n },\n {\n x: halfN,\n y: oppositeN\n },\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: oppositeN\n },\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: oppositeHalfN\n }\n ]\n }\n ]\n};\nconst spade = {\n half: true,\n segments: [\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: oppositeN\n },\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: oppositeN\n },\n {\n x: n,\n y: oppositeHalfN\n },\n {\n x: n,\n y: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty\n }\n ]\n },\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: n,\n y: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty\n },\n {\n x: n,\n y: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty\n },\n {\n x: n,\n y: halfN\n },\n {\n x: halfN,\n y: halfN\n }\n ]\n },\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: halfN,\n y: halfN\n },\n {\n x: halfN,\n y: halfN\n },\n {\n x: eighthN,\n y: halfN\n },\n {\n x: eighthN,\n y: eighthN\n }\n ]\n },\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: eighthN,\n y: eighthN\n },\n {\n x: eighthN,\n y: halfN\n },\n {\n x: halfN,\n y: n\n },\n {\n x: halfN,\n y: n\n }\n ]\n },\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: halfN,\n y: n\n },\n {\n x: halfN,\n y: n\n },\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: n\n },\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: n\n }\n ]\n }\n ]\n};\nconst paths = {\n [_SuitType_js__WEBPACK_IMPORTED_MODULE_2__.SuitType.hearts]: heart,\n [_SuitType_js__WEBPACK_IMPORTED_MODULE_2__.SuitType.diamonds]: diamond,\n [_SuitType_js__WEBPACK_IMPORTED_MODULE_2__.SuitType.clubs]: club,\n [_SuitType_js__WEBPACK_IMPORTED_MODULE_2__.SuitType.spades]: spade\n};\n\n\n//# sourceURL=webpack://@tsparticles/shape-cards/./dist/browser/paths.js?\n}");
47
+
48
+ /***/ },
49
+
50
+ /***/ "./dist/browser/utils.js"
51
+ /*!*******************************!*\
52
+ !*** ./dist/browser/utils.js ***!
53
+ \*******************************/
54
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
55
+
56
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ drawRoundedCard: () => (/* binding */ drawRoundedCard)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _SuitType_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./SuitType.js */ \"./dist/browser/SuitType.js\");\n/* harmony import */ var _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @tsparticles/path-utils */ \"@tsparticles/path-utils\");\n/* harmony import */ var _paths_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./paths.js */ \"./dist/browser/paths.js\");\n\n\n\n\nconst cardWidthRatio = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.double * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.double / _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.triple, cardHeightRatio = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.double, cornerRadiusRatio = 0.2, cornerFontRatio = 0.4, cornerSuitRatio = 0.3, centerSuitRatio = 0.7, cornerPaddingRatio = 0.2, textHorizontalOffsetRatio = 0.25, minRadius = 0, minAngle = 0, suitEdgeBufferFactor = 0.1, fixedCacheKey = 2, cardsCache = new Map(), redSuitColor = {\n r: 215,\n g: 20,\n b: 20\n}, blackSuitColor = {\n r: 18,\n g: 18,\n b: 18\n};\nfunction drawRoundedCard(ctx, radius, cardData, hdr, flipped, canvasSettings) {\n if (flipped) {\n drawRoundedCardBack(ctx, radius);\n } else {\n const cacheKey = getCacheKey(radius, hdr, cardData), cardWidth = radius * cardWidthRatio, cardHeight = radius * cardHeightRatio, halfWidth = cardWidth * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half, halfHeight = cardHeight * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half;\n let cachedData = cardsCache.get(cacheKey);\n if (!cachedData) {\n let cacheCanvas, cacheCtx;\n if (typeof OffscreenCanvas === \"undefined\") {\n cacheCanvas = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.safeDocument)().createElement(\"canvas\");\n cacheCanvas.width = cardWidth;\n cacheCanvas.height = cardHeight;\n cacheCtx = cacheCanvas.getContext(\"2d\", canvasSettings);\n } else {\n cacheCanvas = new OffscreenCanvas(cardWidth, cardHeight);\n cacheCtx = cacheCanvas.getContext(\"2d\", canvasSettings);\n }\n if (cacheCtx) {\n cacheCtx.translate(halfWidth, halfHeight);\n drawRoundedCardFront(cacheCtx, radius, cardData, hdr);\n cachedData = cacheCanvas instanceof HTMLCanvasElement ? cacheCanvas : cacheCanvas.transferToImageBitmap();\n cardsCache.set(cacheKey, cachedData);\n }\n }\n if (cachedData) {\n ctx.drawImage(cachedData, -halfWidth, -halfHeight, cardWidth, cardHeight);\n } else {\n drawRoundedCardFront(ctx, radius, cardData, hdr);\n }\n }\n}\nfunction getCacheKey(radius, hdr, cardData) {\n return `${radius.toFixed(fixedCacheKey)}-${hdr ? \"hdr\" : \"sdr\"}-${cardData.suit}-${cardData.value}`;\n}\nfunction drawRoundedCardBack(ctx, radius) {\n drawCardBody(ctx, radius);\n}\nfunction drawRoundedCardFront(ctx, radius, cardData, hdr) {\n const { suit, value } = cardData, cardWidth = radius * cardWidthRatio, cardHeight = radius * cardHeightRatio, halfWidth = cardWidth * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half, halfHeight = cardHeight * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half, cornerPadding = radius * cornerPaddingRatio, cornerFontSize = radius * cornerFontRatio, cornerSuitSize = radius * cornerSuitRatio, centerSuitSize = radius * centerSuitRatio, textOffset = radius * textHorizontalOffsetRatio, suitEdgeBuffer = radius * suitEdgeBufferFactor, isRed = suit === _SuitType_js__WEBPACK_IMPORTED_MODULE_1__.SuitType.hearts || suit === _SuitType_js__WEBPACK_IMPORTED_MODULE_1__.SuitType.diamonds, color = isRed ? (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getStyleFromRgb)(redSuitColor, hdr) : (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getStyleFromRgb)(blackSuitColor, hdr);\n ctx.save();\n drawCardBody(ctx, radius);\n ctx.fillStyle = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getStyleFromRgb)({\n r: 255,\n g: 255,\n b: 255\n }, hdr);\n ctx.fill();\n ctx.strokeStyle = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getStyleFromRgb)({\n r: 0,\n g: 0,\n b: 0\n }, hdr);\n ctx.stroke();\n ctx.fillStyle = color;\n ctx.font = `bold ${cornerFontSize.toString()}px Arial, serif`;\n ctx.textAlign = \"left\";\n ctx.textBaseline = \"middle\";\n const topLeftX = -halfWidth + cornerPadding + suitEdgeBuffer, topLeftY = -halfHeight + cornerPadding + cornerFontSize * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half;\n ctx.save();\n ctx.translate(topLeftX, topLeftY);\n ctx.beginPath();\n (0,_tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_2__.drawPath)(ctx, cornerSuitSize, _paths_js__WEBPACK_IMPORTED_MODULE_3__.paths[suit]);\n ctx.fill();\n ctx.restore();\n ctx.fillText(value, topLeftX + textOffset, topLeftY);\n ctx.save();\n ctx.translate(halfWidth - cornerPadding - suitEdgeBuffer, halfHeight - cornerPadding - cornerFontSize * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half);\n ctx.rotate(Math.PI);\n ctx.save();\n ctx.beginPath();\n (0,_tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_2__.drawPath)(ctx, cornerSuitSize, _paths_js__WEBPACK_IMPORTED_MODULE_3__.paths[suit]);\n ctx.fill();\n ctx.restore();\n ctx.fillText(value, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.x + textOffset, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.y);\n ctx.restore();\n ctx.save();\n ctx.beginPath();\n (0,_tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_2__.drawPath)(ctx, centerSuitSize, _paths_js__WEBPACK_IMPORTED_MODULE_3__.paths[suit]);\n ctx.fillStyle = color;\n ctx.fill();\n ctx.restore();\n ctx.beginPath();\n ctx.arc(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.x, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.y, minRadius, minAngle, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.doublePI, false);\n ctx.closePath();\n ctx.restore();\n}\nfunction drawCardBody(ctx, radius) {\n const cardWidth = radius * cardWidthRatio, cardHeight = radius * cardHeightRatio, halfWidth = cardWidth * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half, halfHeight = cardHeight * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half, cornerRadius = radius * cornerRadiusRatio;\n ctx.beginPath();\n ctx.moveTo(-halfWidth + cornerRadius, -halfHeight);\n ctx.lineTo(halfWidth - cornerRadius, -halfHeight);\n ctx.quadraticCurveTo(halfWidth, -halfHeight, halfWidth, -halfHeight + cornerRadius);\n ctx.lineTo(halfWidth, halfHeight - cornerRadius);\n ctx.quadraticCurveTo(halfWidth, halfHeight, halfWidth - cornerRadius, halfHeight);\n ctx.lineTo(-halfWidth + cornerRadius, halfHeight);\n ctx.quadraticCurveTo(-halfWidth, halfHeight, -halfWidth, halfHeight - cornerRadius);\n ctx.lineTo(-halfWidth, -halfHeight + cornerRadius);\n ctx.quadraticCurveTo(-halfWidth, -halfHeight, -halfWidth + cornerRadius, -halfHeight);\n ctx.closePath();\n}\n\n\n//# sourceURL=webpack://@tsparticles/shape-cards/./dist/browser/utils.js?\n}");
57
+
58
+ /***/ }
59
+
60
+ }]);
@@ -4,7 +4,7 @@
4
4
  * Demo / Generator : https://particles.js.org/
5
5
  * GitHub : https://www.github.com/matteobruni/tsparticles
6
6
  * How to use? : Check the GitHub README
7
- * v4.0.0-alpha.5
7
+ * v4.0.0-beta.0
8
8
  */
9
9
  "use strict";
10
10
  /*
@@ -17,13 +17,13 @@
17
17
  */
18
18
  (this["webpackChunk_tsparticles_shape_cards"] = this["webpackChunk_tsparticles_shape_cards"] || []).push([["dist_browser_clubs_ClubDrawer_js"],{
19
19
 
20
- /***/ "./dist/browser/Utils.js"
21
- /*!*******************************!*\
22
- !*** ./dist/browser/Utils.js ***!
23
- \*******************************/
20
+ /***/ "./dist/browser/SuitType.js"
21
+ /*!**********************************!*\
22
+ !*** ./dist/browser/SuitType.js ***!
23
+ \**********************************/
24
24
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
25
25
 
26
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ drawPath: () => (/* binding */ drawPath),\n/* harmony export */ paths: () => (/* binding */ paths)\n/* harmony export */ });\nfunction drawPath(data, path) {\n if (!path.segments.length || !path.segments[0].values.length) {\n return;\n }\n const {\n context,\n radius\n } = data;\n context.moveTo(path.segments[0].values[0].x * radius, path.segments[0].values[0].y * radius);\n for (const segment of path.segments) {\n context.bezierCurveTo(segment.values[1].x * radius, segment.values[1].y * radius, segment.values[2].x * radius, segment.values[2].y * radius, segment.values[3].x * radius, segment.values[3].y * radius);\n }\n for (let i = path.segments.length - 1; i >= 0; i--) {\n const segment = path.segments[i];\n context.bezierCurveTo(-segment.values[2].x * radius, segment.values[2].y * radius, -segment.values[1].x * radius, segment.values[1].y * radius, -segment.values[0].x * radius, segment.values[0].y * radius);\n }\n}\nconst n = 0.5;\nconst paths = {\n heart: {\n segments: [{\n values: [{\n x: 0,\n y: n\n }, {\n x: 0,\n y: n\n }, {\n x: n,\n y: 0\n }, {\n x: n,\n y: -n / 2\n }]\n }, {\n values: [{\n x: n,\n y: -n / 2\n }, {\n x: n,\n y: -n / 2\n }, {\n x: n,\n y: -n\n }, {\n x: n / 2,\n y: -n\n }]\n }, {\n values: [{\n x: n / 2,\n y: -n\n }, {\n x: n / 2,\n y: -n\n }, {\n x: 0,\n y: -n\n }, {\n x: 0,\n y: -n / 2\n }]\n }]\n },\n diamond: {\n segments: [{\n values: [{\n x: 0,\n y: n\n }, {\n x: 0,\n y: n\n }, {\n x: 3 * n / 4,\n y: 0\n }, {\n x: 3 * n / 4,\n y: 0\n }]\n }, {\n values: [{\n x: 3 * n / 4,\n y: 0\n }, {\n x: 3 * n / 4,\n y: 0\n }, {\n x: 0,\n y: -n\n }, {\n x: 0,\n y: -n\n }]\n }]\n },\n club: {\n segments: [{\n values: [{\n x: 0,\n y: -n\n }, {\n x: 0,\n y: -n\n }, {\n x: n / 2,\n y: -n\n }, {\n x: n / 2,\n y: -n / 2\n }]\n }, {\n values: [{\n x: n / 2,\n y: -n / 2\n }, {\n x: n / 2,\n y: -n / 2\n }, {\n x: n,\n y: -n / 2\n }, {\n x: n,\n y: 0\n }]\n }, {\n values: [{\n x: n,\n y: 0\n }, {\n x: n,\n y: 0\n }, {\n x: n,\n y: n / 2\n }, {\n x: n / 2,\n y: n / 2\n }]\n }, {\n values: [{\n x: n / 2,\n y: n / 2\n }, {\n x: n / 2,\n y: n / 2\n }, {\n x: n / 8,\n y: n / 2\n }, {\n x: n / 8,\n y: n / 8\n }]\n }, {\n values: [{\n x: n / 8,\n y: n / 8\n }, {\n x: n / 8,\n y: n / 2\n }, {\n x: n / 2,\n y: n\n }, {\n x: n / 2,\n y: n\n }]\n }, {\n values: [{\n x: n / 2,\n y: n\n }, {\n x: n / 2,\n y: n\n }, {\n x: 0,\n y: n\n }, {\n x: 0,\n y: n\n }]\n }]\n },\n spade: {\n segments: [{\n values: [{\n x: 0,\n y: -n\n }, {\n x: 0,\n y: -n\n }, {\n x: n,\n y: -n / 2\n }, {\n x: n,\n y: 0\n }]\n }, {\n values: [{\n x: n,\n y: 0\n }, {\n x: n,\n y: 0\n }, {\n x: n,\n y: n / 2\n }, {\n x: n / 2,\n y: n / 2\n }]\n }, {\n values: [{\n x: n / 2,\n y: n / 2\n }, {\n x: n / 2,\n y: n / 2\n }, {\n x: n / 8,\n y: n / 2\n }, {\n x: n / 8,\n y: n / 8\n }]\n }, {\n values: [{\n x: n / 8,\n y: n / 8\n }, {\n x: n / 8,\n y: n / 2\n }, {\n x: n / 2,\n y: n\n }, {\n x: n / 2,\n y: n\n }]\n }, {\n values: [{\n x: n / 2,\n y: n\n }, {\n x: n / 2,\n y: n\n }, {\n x: 0,\n y: n\n }, {\n x: 0,\n y: n\n }]\n }]\n }\n};\n\n//# sourceURL=webpack://@tsparticles/shape-cards/./dist/browser/Utils.js?\n}");
26
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SuitType: () => (/* binding */ SuitType)\n/* harmony export */ });\nvar SuitType;\n(function(SuitType) {\n SuitType[\"hearts\"] = \"hearts\";\n SuitType[\"diamonds\"] = \"diamonds\";\n SuitType[\"clubs\"] = \"clubs\";\n SuitType[\"spades\"] = \"spades\";\n})(SuitType || (SuitType = {}));\n\n\n//# sourceURL=webpack://@tsparticles/shape-cards/./dist/browser/SuitType.js?\n}");
27
27
 
28
28
  /***/ },
29
29
 
@@ -33,7 +33,17 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
33
33
  \******************************************/
34
34
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
35
35
 
36
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ClubDrawer: () => (/* binding */ ClubDrawer)\n/* harmony export */ });\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Utils.js */ \"./dist/browser/Utils.js\");\n\nclass ClubDrawer {\n constructor() {\n this.validTypes = [\"club\", \"clubs\"];\n }\n draw(data) {\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_0__.drawPath)(data, _Utils_js__WEBPACK_IMPORTED_MODULE_0__.paths.club);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/shape-cards/./dist/browser/clubs/ClubDrawer.js?\n}");
36
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ClubDrawer: () => (/* binding */ ClubDrawer)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/path-utils */ \"@tsparticles/path-utils\");\n/* harmony import */ var _paths_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../paths.js */ \"./dist/browser/paths.js\");\n\n\nclass ClubDrawer {\n draw(data) {\n const { context, radius } = data;\n (0,_tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.drawPath)(context, radius, _paths_js__WEBPACK_IMPORTED_MODULE_1__.paths.clubs);\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/shape-cards/./dist/browser/clubs/ClubDrawer.js?\n}");
37
+
38
+ /***/ },
39
+
40
+ /***/ "./dist/browser/paths.js"
41
+ /*!*******************************!*\
42
+ !*** ./dist/browser/paths.js ***!
43
+ \*******************************/
44
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
45
+
46
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ club: () => (/* binding */ club),\n/* harmony export */ diamond: () => (/* binding */ diamond),\n/* harmony export */ heart: () => (/* binding */ heart),\n/* harmony export */ paths: () => (/* binding */ paths),\n/* harmony export */ spade: () => (/* binding */ spade)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/path-utils */ \"@tsparticles/path-utils\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _SuitType_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SuitType.js */ \"./dist/browser/SuitType.js\");\n\n\n\nconst eighth = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.quarter * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.half, n = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.half, halfN = n * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.half, oppositeN = -n, oppositeHalfN = -halfN, eighthN = n * eighth, threeQuarterN = n * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.threeQuarter;\nconst club = {\n half: true,\n segments: [\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: oppositeN\n },\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: oppositeN\n },\n {\n x: halfN,\n y: oppositeN\n },\n {\n x: halfN,\n y: oppositeHalfN\n }\n ]\n },\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: halfN,\n y: oppositeHalfN\n },\n {\n x: halfN,\n y: oppositeHalfN\n },\n {\n x: n,\n y: oppositeHalfN\n },\n {\n x: n,\n y: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty\n }\n ]\n },\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: n,\n y: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty\n },\n {\n x: n,\n y: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty\n },\n {\n x: n,\n y: halfN\n },\n {\n x: halfN,\n y: halfN\n }\n ]\n },\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: halfN,\n y: halfN\n },\n {\n x: halfN,\n y: halfN\n },\n {\n x: eighthN,\n y: halfN\n },\n {\n x: eighthN,\n y: eighthN\n }\n ]\n },\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: eighthN,\n y: eighthN\n },\n {\n x: eighthN,\n y: halfN\n },\n {\n x: halfN,\n y: n\n },\n {\n x: halfN,\n y: n\n }\n ]\n },\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: halfN,\n y: n\n },\n {\n x: halfN,\n y: n\n },\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: n\n },\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: n\n }\n ]\n }\n ]\n};\nconst diamond = {\n half: true,\n segments: [\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: n\n },\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: n\n },\n {\n x: threeQuarterN,\n y: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty\n },\n {\n x: threeQuarterN,\n y: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty\n }\n ]\n },\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: threeQuarterN,\n y: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty\n },\n {\n x: threeQuarterN,\n y: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty\n },\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: oppositeN\n },\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: oppositeN\n }\n ]\n }\n ]\n};\nconst heart = {\n half: true,\n segments: [\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: n\n },\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: n\n },\n {\n x: n,\n y: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty\n },\n {\n x: n,\n y: oppositeHalfN\n }\n ]\n },\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: n,\n y: oppositeHalfN\n },\n {\n x: n,\n y: oppositeHalfN\n },\n {\n x: n,\n y: oppositeN\n },\n {\n x: halfN,\n y: oppositeN\n }\n ]\n },\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: halfN,\n y: oppositeN\n },\n {\n x: halfN,\n y: oppositeN\n },\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: oppositeN\n },\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: oppositeHalfN\n }\n ]\n }\n ]\n};\nconst spade = {\n half: true,\n segments: [\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: oppositeN\n },\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: oppositeN\n },\n {\n x: n,\n y: oppositeHalfN\n },\n {\n x: n,\n y: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty\n }\n ]\n },\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: n,\n y: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty\n },\n {\n x: n,\n y: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty\n },\n {\n x: n,\n y: halfN\n },\n {\n x: halfN,\n y: halfN\n }\n ]\n },\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: halfN,\n y: halfN\n },\n {\n x: halfN,\n y: halfN\n },\n {\n x: eighthN,\n y: halfN\n },\n {\n x: eighthN,\n y: eighthN\n }\n ]\n },\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: eighthN,\n y: eighthN\n },\n {\n x: eighthN,\n y: halfN\n },\n {\n x: halfN,\n y: n\n },\n {\n x: halfN,\n y: n\n }\n ]\n },\n {\n type: _tsparticles_path_utils__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier,\n values: [\n {\n x: halfN,\n y: n\n },\n {\n x: halfN,\n y: n\n },\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: n\n },\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.empty,\n y: n\n }\n ]\n }\n ]\n};\nconst paths = {\n [_SuitType_js__WEBPACK_IMPORTED_MODULE_2__.SuitType.hearts]: heart,\n [_SuitType_js__WEBPACK_IMPORTED_MODULE_2__.SuitType.diamonds]: diamond,\n [_SuitType_js__WEBPACK_IMPORTED_MODULE_2__.SuitType.clubs]: club,\n [_SuitType_js__WEBPACK_IMPORTED_MODULE_2__.SuitType.spades]: spade\n};\n\n\n//# sourceURL=webpack://@tsparticles/shape-cards/./dist/browser/paths.js?\n}");
37
47
 
38
48
  /***/ }
39
49