@tsparticles/shape-cards 3.0.0-beta.1 → 3.0.0-beta.3
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/README.md +1 -1
- package/browser/CardsSuitsDrawers.js +8 -8
- package/browser/Utils.js +5 -4
- package/cjs/CardsSuitsDrawers.js +8 -8
- package/cjs/Utils.js +5 -4
- package/esm/CardsSuitsDrawers.js +8 -8
- package/esm/Utils.js +5 -4
- package/package.json +4 -4
- package/report.html +23 -5
- package/tsparticles.shape.cards.js +17 -13
- package/tsparticles.shape.cards.min.js +1 -1
- package/tsparticles.shape.cards.min.js.LICENSE.txt +1 -1
- package/types/CardsSuitsDrawers.d.ts +5 -5
- package/types/Utils.d.ts +2 -1
- package/umd/CardsSuitsDrawers.js +8 -8
- package/umd/Utils.js +5 -4
|
@@ -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
|
-
* v3.0.0-beta.
|
|
7
|
+
* v3.0.0-beta.3
|
|
8
8
|
*/
|
|
9
9
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
10
10
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -61,18 +61,22 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
61
61
|
});
|
|
62
62
|
|
|
63
63
|
;// CONCATENATED MODULE: ./dist/browser/Utils.js
|
|
64
|
-
function drawPath(
|
|
64
|
+
function drawPath(data, path) {
|
|
65
65
|
if (!path.segments.length || !path.segments[0].values.length) {
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
|
-
|
|
68
|
+
const {
|
|
69
|
+
context,
|
|
70
|
+
radius
|
|
71
|
+
} = data;
|
|
72
|
+
context.moveTo(path.segments[0].values[0].x * radius, path.segments[0].values[0].y * radius);
|
|
69
73
|
for (let i = 0; i < path.segments.length; i++) {
|
|
70
74
|
const segment = path.segments[i];
|
|
71
|
-
|
|
75
|
+
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);
|
|
72
76
|
}
|
|
73
77
|
for (let i = path.segments.length - 1; i >= 0; i--) {
|
|
74
78
|
const segment = path.segments[i];
|
|
75
|
-
|
|
79
|
+
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);
|
|
76
80
|
}
|
|
77
81
|
}
|
|
78
82
|
const n = 1.0 / 2;
|
|
@@ -317,23 +321,23 @@ const paths = {
|
|
|
317
321
|
;// CONCATENATED MODULE: ./dist/browser/CardsSuitsDrawers.js
|
|
318
322
|
|
|
319
323
|
class SpadeDrawer {
|
|
320
|
-
draw(
|
|
321
|
-
drawPath(
|
|
324
|
+
draw(data) {
|
|
325
|
+
drawPath(data, paths.spade);
|
|
322
326
|
}
|
|
323
327
|
}
|
|
324
328
|
class HeartDrawer {
|
|
325
|
-
draw(
|
|
326
|
-
drawPath(
|
|
329
|
+
draw(data) {
|
|
330
|
+
drawPath(data, paths.heart);
|
|
327
331
|
}
|
|
328
332
|
}
|
|
329
333
|
class DiamondDrawer {
|
|
330
|
-
draw(
|
|
331
|
-
drawPath(
|
|
334
|
+
draw(data) {
|
|
335
|
+
drawPath(data, paths.diamond);
|
|
332
336
|
}
|
|
333
337
|
}
|
|
334
338
|
class ClubDrawer {
|
|
335
|
-
draw(
|
|
336
|
-
drawPath(
|
|
339
|
+
draw(data) {
|
|
340
|
+
drawPath(data, paths.club);
|
|
337
341
|
}
|
|
338
342
|
}
|
|
339
343
|
;// CONCATENATED MODULE: ./dist/browser/index.js
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.shape.cards.min.js.LICENSE.txt */
|
|
2
|
-
!function(e,s){if("object"==typeof exports&&"object"==typeof module)module.exports=s();else if("function"==typeof define&&define.amd)define([],s);else{var y=s();for(var a in y)("object"==typeof exports?exports:e)[a]=y[a]}}(this,(()=>(()=>{"use strict";var e={d:(s,y)=>{for(var a in y)e.o(y,a)&&!e.o(s,a)&&Object.defineProperty(s,a,{enumerable:!0,get:y[a]})},o:(e,s)=>Object.prototype.hasOwnProperty.call(e,s),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},s={};function y(e,s
|
|
2
|
+
!function(e,s){if("object"==typeof exports&&"object"==typeof module)module.exports=s();else if("function"==typeof define&&define.amd)define([],s);else{var y=s();for(var a in y)("object"==typeof exports?exports:e)[a]=y[a]}}(this,(()=>(()=>{"use strict";var e={d:(s,y)=>{for(var a in y)e.o(y,a)&&!e.o(s,a)&&Object.defineProperty(s,a,{enumerable:!0,get:y[a]})},o:(e,s)=>Object.prototype.hasOwnProperty.call(e,s),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},s={};function y(e,s){if(!s.segments.length||!s.segments[0].values.length)return;const{context:y,radius:a}=e;y.moveTo(s.segments[0].values[0].x*a,s.segments[0].values[0].y*a);for(let e=0;e<s.segments.length;e++){const x=s.segments[e];y.bezierCurveTo(x.values[1].x*a,x.values[1].y*a,x.values[2].x*a,x.values[2].y*a,x.values[3].x*a,x.values[3].y*a)}for(let e=s.segments.length-1;e>=0;e--){const x=s.segments[e];y.bezierCurveTo(-x.values[2].x*a,x.values[2].y*a,-x.values[1].x*a,x.values[1].y*a,-x.values[0].x*a,x.values[0].y*a)}}e.r(s),e.d(s,{loadCardsShape:()=>o});const a=.5,x={heart:{segments:[{values:[{x:0,y:a},{x:0,y:a},{x:a,y:0},{x:a,y:-a/2}]},{values:[{x:a,y:-a/2},{x:a,y:-a/2},{x:a,y:-a},{x:a/2,y:-a}]},{values:[{x:a/2,y:-a},{x:a/2,y:-a},{x:0,y:-a},{x:0,y:-a/2}]}]},diamond:{segments:[{values:[{x:0,y:a},{x:0,y:a},{x:.375,y:0},{x:.375,y:0}]},{values:[{x:.375,y:0},{x:.375,y:0},{x:0,y:-a},{x:0,y:-a}]}]},club:{segments:[{values:[{x:0,y:-a},{x:0,y:-a},{x:a/2,y:-a},{x:a/2,y:-a/2}]},{values:[{x:a/2,y:-a/2},{x:a/2,y:-a/2},{x:a,y:-a/2},{x:a,y:0}]},{values:[{x:a,y:0},{x:a,y:0},{x:a,y:a/2},{x:a/2,y:a/2}]},{values:[{x:a/2,y:a/2},{x:a/2,y:a/2},{x:a/8,y:a/2},{x:a/8,y:a/8}]},{values:[{x:a/8,y:a/8},{x:a/8,y:a/2},{x:a/2,y:a},{x:a/2,y:a}]},{values:[{x:a/2,y:a},{x:a/2,y:a},{x:0,y:a},{x:0,y:a}]}]},spade:{segments:[{values:[{x:0,y:-a},{x:0,y:-a},{x:a,y:-a/2},{x:a,y:0}]},{values:[{x:a,y:0},{x:a,y:0},{x:a,y:a/2},{x:a/2,y:a/2}]},{values:[{x:a/2,y:a/2},{x:a/2,y:a/2},{x:a/8,y:a/2},{x:a/8,y:a/8}]},{values:[{x:a/8,y:a/8},{x:a/8,y:a/2},{x:a/2,y:a},{x:a/2,y:a}]},{values:[{x:a/2,y:a},{x:a/2,y:a},{x:0,y:a},{x:0,y:a}]}]}};class t{draw(e){y(e,x.spade)}}class l{draw(e){y(e,x.heart)}}class n{draw(e){y(e,x.diamond)}}class u{draw(e){y(e,x.club)}}async function o(e,s=!0){await e.addShape(["spade","spades"],new t,s),await e.addShape(["heart","hearts"],new l,s),await e.addShape(["diamond","diamonds"],new n,s),await e.addShape(["club","clubs"],new u,s)}return s})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Cards Shape v3.0.0-beta.
|
|
1
|
+
/*! tsParticles Cards Shape v3.0.0-beta.3 by Matteo Bruni */
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IShapeDrawData, IShapeDrawer } from "@tsparticles/engine";
|
|
2
2
|
export declare class SpadeDrawer implements IShapeDrawer {
|
|
3
|
-
draw(
|
|
3
|
+
draw(data: IShapeDrawData): void;
|
|
4
4
|
}
|
|
5
5
|
export declare class HeartDrawer implements IShapeDrawer {
|
|
6
|
-
draw(
|
|
6
|
+
draw(data: IShapeDrawData): void;
|
|
7
7
|
}
|
|
8
8
|
export declare class DiamondDrawer implements IShapeDrawer {
|
|
9
|
-
draw(
|
|
9
|
+
draw(data: IShapeDrawData): void;
|
|
10
10
|
}
|
|
11
11
|
export declare class ClubDrawer implements IShapeDrawer {
|
|
12
|
-
draw(
|
|
12
|
+
draw(data: IShapeDrawData): void;
|
|
13
13
|
}
|
package/types/Utils.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { ICardsPath, IPath } from "./ICardsPath.js";
|
|
2
|
-
|
|
2
|
+
import type { IShapeDrawData } from "@tsparticles/engine";
|
|
3
|
+
export declare function drawPath(data: IShapeDrawData, path: IPath): void;
|
|
3
4
|
export declare const paths: ICardsPath;
|
package/umd/CardsSuitsDrawers.js
CHANGED
|
@@ -12,26 +12,26 @@
|
|
|
12
12
|
exports.ClubDrawer = exports.DiamondDrawer = exports.HeartDrawer = exports.SpadeDrawer = void 0;
|
|
13
13
|
const Utils_js_1 = require("./Utils.js");
|
|
14
14
|
class SpadeDrawer {
|
|
15
|
-
draw(
|
|
16
|
-
(0, Utils_js_1.drawPath)(
|
|
15
|
+
draw(data) {
|
|
16
|
+
(0, Utils_js_1.drawPath)(data, Utils_js_1.paths.spade);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
exports.SpadeDrawer = SpadeDrawer;
|
|
20
20
|
class HeartDrawer {
|
|
21
|
-
draw(
|
|
22
|
-
(0, Utils_js_1.drawPath)(
|
|
21
|
+
draw(data) {
|
|
22
|
+
(0, Utils_js_1.drawPath)(data, Utils_js_1.paths.heart);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
exports.HeartDrawer = HeartDrawer;
|
|
26
26
|
class DiamondDrawer {
|
|
27
|
-
draw(
|
|
28
|
-
(0, Utils_js_1.drawPath)(
|
|
27
|
+
draw(data) {
|
|
28
|
+
(0, Utils_js_1.drawPath)(data, Utils_js_1.paths.diamond);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
exports.DiamondDrawer = DiamondDrawer;
|
|
32
32
|
class ClubDrawer {
|
|
33
|
-
draw(
|
|
34
|
-
(0, Utils_js_1.drawPath)(
|
|
33
|
+
draw(data) {
|
|
34
|
+
(0, Utils_js_1.drawPath)(data, Utils_js_1.paths.club);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
exports.ClubDrawer = ClubDrawer;
|
package/umd/Utils.js
CHANGED
|
@@ -10,18 +10,19 @@
|
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.paths = exports.drawPath = void 0;
|
|
13
|
-
function drawPath(
|
|
13
|
+
function drawPath(data, path) {
|
|
14
14
|
if (!path.segments.length || !path.segments[0].values.length) {
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
const { context, radius } = data;
|
|
18
|
+
context.moveTo(path.segments[0].values[0].x * radius, path.segments[0].values[0].y * radius);
|
|
18
19
|
for (let i = 0; i < path.segments.length; i++) {
|
|
19
20
|
const segment = path.segments[i];
|
|
20
|
-
|
|
21
|
+
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);
|
|
21
22
|
}
|
|
22
23
|
for (let i = path.segments.length - 1; i >= 0; i--) {
|
|
23
24
|
const segment = path.segments[i];
|
|
24
|
-
|
|
25
|
+
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);
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
exports.drawPath = drawPath;
|