Skip to content

Commit f4a985f

Browse files
committed
feat: add full card shape, and utilities for path drawing
1 parent 2eaf600 commit f4a985f

57 files changed

Lines changed: 1295 additions & 401 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

demo/vanilla/app.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ app.use("/path-perlin-noise", express.static("./node_modules/@tsparticles/path-p
129129
app.use("/path-polygon", express.static("./node_modules/@tsparticles/path-polygon"));
130130
app.use("/path-simplex-noise", express.static("./node_modules/@tsparticles/path-simplex-noise"));
131131
app.use("/path-svg", express.static("./node_modules/@tsparticles/path-svg"));
132+
app.use("/path-utils", express.static("./node_modules/@tsparticles/path-utils"));
132133
app.use("/path-zig-zag", express.static("./node_modules/@tsparticles/path-zig-zag"));
133134
app.use("/plugin-background-mask", express.static("./node_modules/@tsparticles/plugin-background-mask"));
134135
app.use("/plugin-blend", express.static("./node_modules/@tsparticles/plugin-blend"));

demo/vanilla/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
"@tsparticles/path-polygon": "workspace:4.0.0-alpha.8",
8989
"@tsparticles/path-simplex-noise": "workspace:4.0.0-alpha.8",
9090
"@tsparticles/path-svg": "workspace:4.0.0-alpha.8",
91+
"@tsparticles/path-utils": "workspace:4.0.0-alpha.8",
9192
"@tsparticles/path-zig-zag": "workspace:4.0.0-alpha.8",
9293
"@tsparticles/perlin-noise": "workspace:4.0.0-alpha.8",
9394
"@tsparticles/pjs": "workspace:4.0.0-alpha.8",

demo/vanilla/views/index.pug

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ html(lang="en")
116116
script(src="/tsparticles-simplex-noise/tsparticles.simplex.noise.min.js")
117117
script(src="/tsparticles-fractal-noise/tsparticles.fractal.noise.min.js")
118118
script(src="/tsparticles-engine/tsparticles.engine.min.js")
119+
script(src="/path-utils/tsparticles.path.utils.min.js")
119120
script(src="/tsparticles-noise-field/tsparticles.noise.field.min.js")
120121
script(src="/tsparticles-configs/tsparticles.configs.min.js")
121122
script(src="/tsparticles-basic/tsparticles.basic.min.js")

engine/src/Core/Particle.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,17 @@ export class Particle {
722722
);
723723
}
724724

725+
isShowingBack(): boolean {
726+
if (!this.roll) {
727+
return false;
728+
}
729+
730+
const backFactor = this.roll.horizontal && this.roll.vertical ? double * rollFactor : rollFactor,
731+
backSum = this.roll.horizontal ? Math.PI * half : none;
732+
733+
return !!(Math.floor((this.roll.angle + backSum) / (Math.PI / backFactor)) % double);
734+
}
735+
725736
isVisible(): boolean {
726737
return !this.destroyed && !this.spawning && this.isInsideCanvas();
727738
}
@@ -855,11 +866,7 @@ export class Particle {
855866
return color;
856867
}
857868

858-
const backFactor = this.roll.horizontal && this.roll.vertical ? double * rollFactor : rollFactor,
859-
backSum = this.roll.horizontal ? Math.PI * half : none,
860-
rolled = Math.floor((this.roll.angle + backSum) / (Math.PI / backFactor)) % double;
861-
862-
if (!rolled) {
869+
if (!this.isShowingBack()) {
863870
return color;
864871
}
865872

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@
3737
"@types/jsdom": "^27.0.0",
3838
"@types/node": "^25.0.10",
3939
"@types/webpack-env": "^1.18.8",
40-
"@vitest/coverage-v8": "^4.0.17",
41-
"@vitest/ui": "^4.0.17",
40+
"@vitest/coverage-v8": "^4.0.18",
41+
"@vitest/ui": "^4.0.18",
4242
"babel-loader": "^10.0.0",
4343
"browserslist": "^4.28.1",
4444
"canvas": "^3.2.1",
4545
"copyfiles": "^2.4.1",
4646
"cross-env": "^10.1.0",
4747
"eslint": "^9.39.2",
4848
"eslint-config-prettier": "^10.1.8",
49-
"eslint-plugin-jsdoc": "^62.3.0",
49+
"eslint-plugin-jsdoc": "^62.3.1",
5050
"eslint-plugin-prettier": "^5.5.5",
5151
"eslint-plugin-tsdoc": "^0.5.0",
5252
"fs-extra": "^11.3.3",
@@ -56,7 +56,7 @@
5656
"jsdom-global": "^3.0.2",
5757
"lerna": "^9.0.3",
5858
"madge": "^8.0.0",
59-
"nx": "^22.4.0",
59+
"nx": "^22.4.1",
6060
"nx-cloud": "^19.1.0",
6161
"prettier": "^3.8.1",
6262
"prettier-plugin-multiline-arrays": "4.1.3",

0 commit comments

Comments
 (0)