@tsparticles/ribbons 4.1.2 → 4.2.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.
- package/README.md +7 -8
- package/browser/RibbonsOptions.js +32 -50
- package/browser/ribbons.js +2 -2
- package/browser/ribbons.lazy.js +2 -2
- package/browser/utils.js +2 -2
- package/cjs/RibbonsOptions.js +32 -50
- package/cjs/ribbons.js +2 -2
- package/cjs/ribbons.lazy.js +2 -2
- package/cjs/utils.js +2 -2
- package/esm/RibbonsOptions.js +32 -50
- package/esm/ribbons.js +2 -2
- package/esm/ribbons.lazy.js +2 -2
- package/esm/utils.js +2 -2
- package/package.json +38 -9
- package/report.html +1 -1
- package/tsparticles.ribbons.bundle.js +1073 -1729
- package/tsparticles.ribbons.bundle.min.js +1 -1
- package/tsparticles.ribbons.js +36 -54
- package/tsparticles.ribbons.min.js +1 -1
- package/types/IRibbonsOptions.d.ts +1 -3
- package/types/RibbonsOptions.d.ts +3 -4
package/README.md
CHANGED
|
@@ -38,8 +38,7 @@ import { ribbons } from "@tsparticles/ribbons";
|
|
|
38
38
|
|
|
39
39
|
await ribbons({
|
|
40
40
|
count: 5,
|
|
41
|
-
|
|
42
|
-
position: { x: 50, y: 0 },
|
|
41
|
+
positionX: 50,
|
|
43
42
|
});
|
|
44
43
|
```
|
|
45
44
|
|
|
@@ -64,11 +63,10 @@ await ribbons({
|
|
|
64
63
|
Main options:
|
|
65
64
|
|
|
66
65
|
- `count` _Integer (default: 5)_
|
|
67
|
-
- `angle` _Number (default: 90)_
|
|
68
|
-
- `spread` _Number (default: 0)_
|
|
69
|
-
- `drift` _Number (default: 0)_
|
|
70
66
|
- `ticks` _Number (default: 200)_
|
|
71
|
-
- `
|
|
67
|
+
- `positionX` _Number (default: 50, in percent)_
|
|
68
|
+
- `position` _Object_ (`x`/`y`) — **deprecated**, use `positionX` instead; `y` is ignored (emitter always spawns at top-of-canvas)
|
|
69
|
+
- `emitterSize` _Object_ (`width`/`height`, default 100/0, in percent) — spawn width is controlled by `emitterSize.width` (default 100); not always full width
|
|
72
70
|
- `colors` _Array<String>_
|
|
73
71
|
- `ribbonOptions` _Object_ (`particles.shape.options.ribbon`)
|
|
74
72
|
- Includes `darken: { enable: true, value: 30 }` by default
|
|
@@ -77,9 +75,10 @@ Main options:
|
|
|
77
75
|
- `disableForReducedMotion` _Boolean (default: true)_
|
|
78
76
|
|
|
79
77
|
The `ribbons` bundle disables `roll`, `rotate`, `tilt`, and `wobble` on ribbon particles by default for better shape stability.
|
|
80
|
-
The emitter
|
|
78
|
+
The emitter spawns from `positionX` across a strip whose width is controlled by `emitterSize.width` (default 100%), with downward movement for a falling-from-top effect. The emitter is always positioned at the top of the canvas.
|
|
81
79
|
|
|
82
80
|
Deprecated aliases still accepted:
|
|
83
81
|
|
|
84
82
|
- `particleCount` (use `count`)
|
|
85
|
-
- `
|
|
83
|
+
- `position` (use `positionX`)
|
|
84
|
+
- `origin` (use `positionX`)
|
|
@@ -1,31 +1,22 @@
|
|
|
1
|
-
import { deepExtend, isArray, isNull, percentDenominator, } from "@tsparticles/engine";
|
|
1
|
+
import { deepExtend, isArray, isNull, loadProperty, percentDenominator, } from "@tsparticles/engine";
|
|
2
2
|
export class RibbonsOptions {
|
|
3
|
-
angle;
|
|
4
3
|
colors;
|
|
5
4
|
count;
|
|
6
5
|
disableForReducedMotion;
|
|
7
|
-
drift;
|
|
8
6
|
emitterSize;
|
|
9
|
-
|
|
7
|
+
positionX;
|
|
10
8
|
ribbonOptions;
|
|
11
9
|
scalar;
|
|
12
|
-
spread;
|
|
13
10
|
ticks;
|
|
14
11
|
zIndex;
|
|
15
12
|
constructor() {
|
|
16
|
-
this.angle = 90;
|
|
17
13
|
this.count = 5;
|
|
18
|
-
this.spread = 0;
|
|
19
|
-
this.drift = 0;
|
|
20
14
|
this.emitterSize = {
|
|
21
15
|
width: 100,
|
|
22
16
|
height: 0,
|
|
23
17
|
};
|
|
18
|
+
this.positionX = 50;
|
|
24
19
|
this.ticks = 200;
|
|
25
|
-
this.position = {
|
|
26
|
-
x: 50,
|
|
27
|
-
y: 0,
|
|
28
|
-
};
|
|
29
20
|
this.colors = ["#FF0055", "#00D1FF", "#FFD23F", "#61FF7E", "#B284FF"];
|
|
30
21
|
this.ribbonOptions = {
|
|
31
22
|
angle: 45,
|
|
@@ -56,13 +47,12 @@ export class RibbonsOptions {
|
|
|
56
47
|
}
|
|
57
48
|
get origin() {
|
|
58
49
|
return {
|
|
59
|
-
x: this.
|
|
60
|
-
y:
|
|
50
|
+
x: this.positionX / percentDenominator,
|
|
51
|
+
y: 0,
|
|
61
52
|
};
|
|
62
53
|
}
|
|
63
54
|
set origin(value) {
|
|
64
|
-
this.
|
|
65
|
-
this.position.y = value.y * percentDenominator;
|
|
55
|
+
this.positionX = value.x * percentDenominator;
|
|
66
56
|
}
|
|
67
57
|
get particleCount() {
|
|
68
58
|
return this.count;
|
|
@@ -70,26 +60,24 @@ export class RibbonsOptions {
|
|
|
70
60
|
set particleCount(value) {
|
|
71
61
|
this.count = value;
|
|
72
62
|
}
|
|
63
|
+
get position() {
|
|
64
|
+
return {
|
|
65
|
+
x: this.positionX,
|
|
66
|
+
y: 0,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
set position(value) {
|
|
70
|
+
this.positionX = value.x;
|
|
71
|
+
}
|
|
73
72
|
load(data) {
|
|
74
73
|
if (isNull(data)) {
|
|
75
74
|
return;
|
|
76
75
|
}
|
|
77
|
-
if (data.angle !== undefined) {
|
|
78
|
-
this.angle = data.angle;
|
|
79
|
-
}
|
|
80
76
|
const count = data.count ?? data.particleCount;
|
|
81
77
|
if (count !== undefined) {
|
|
82
78
|
this.count = count;
|
|
83
79
|
}
|
|
84
|
-
|
|
85
|
-
this.spread = data.spread;
|
|
86
|
-
}
|
|
87
|
-
if (data.drift !== undefined) {
|
|
88
|
-
this.drift = data.drift;
|
|
89
|
-
}
|
|
90
|
-
if (data.ticks !== undefined) {
|
|
91
|
-
this.ticks = data.ticks;
|
|
92
|
-
}
|
|
80
|
+
loadProperty(this, "ticks", data.ticks);
|
|
93
81
|
if (data.emitterSize) {
|
|
94
82
|
if (data.emitterSize.width !== undefined) {
|
|
95
83
|
this.emitterSize.width = data.emitterSize.width;
|
|
@@ -98,20 +86,20 @@ export class RibbonsOptions {
|
|
|
98
86
|
this.emitterSize.height = data.emitterSize.height;
|
|
99
87
|
}
|
|
100
88
|
}
|
|
101
|
-
|
|
102
|
-
if (
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (position) {
|
|
110
|
-
if (position.x !== undefined) {
|
|
111
|
-
this.position.x = position.x;
|
|
89
|
+
loadProperty(this, "positionX", data.positionX);
|
|
90
|
+
if (data.positionX === undefined) {
|
|
91
|
+
const origin = data.origin;
|
|
92
|
+
if (origin && !data.position) {
|
|
93
|
+
data.position = {
|
|
94
|
+
x: origin.x === undefined ? undefined : origin.x * percentDenominator,
|
|
95
|
+
y: 0,
|
|
96
|
+
};
|
|
112
97
|
}
|
|
113
|
-
|
|
114
|
-
|
|
98
|
+
const position = data.position;
|
|
99
|
+
if (position) {
|
|
100
|
+
if (position.x !== undefined) {
|
|
101
|
+
this.positionX = position.x;
|
|
102
|
+
}
|
|
115
103
|
}
|
|
116
104
|
}
|
|
117
105
|
if (data.colors !== undefined) {
|
|
@@ -125,14 +113,8 @@ export class RibbonsOptions {
|
|
|
125
113
|
if (data.ribbonOptions !== undefined) {
|
|
126
114
|
this.ribbonOptions = deepExtend({}, data.ribbonOptions);
|
|
127
115
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
if (data.zIndex !== undefined) {
|
|
132
|
-
this.zIndex = data.zIndex;
|
|
133
|
-
}
|
|
134
|
-
if (data.disableForReducedMotion !== undefined) {
|
|
135
|
-
this.disableForReducedMotion = data.disableForReducedMotion;
|
|
136
|
-
}
|
|
116
|
+
loadProperty(this, "scalar", data.scalar);
|
|
117
|
+
loadProperty(this, "zIndex", data.zIndex);
|
|
118
|
+
loadProperty(this, "disableForReducedMotion", data.disableForReducedMotion);
|
|
137
119
|
}
|
|
138
120
|
}
|
package/browser/ribbons.js
CHANGED
|
@@ -8,7 +8,7 @@ import { loadRibbonShape } from "@tsparticles/shape-ribbon";
|
|
|
8
8
|
import { setRibbons } from "./utils.js";
|
|
9
9
|
let initPromise = null;
|
|
10
10
|
async function doInitPlugins(engine) {
|
|
11
|
-
engine.checkVersion("4.
|
|
11
|
+
engine.checkVersion("4.2.0");
|
|
12
12
|
await engine.pluginManager.register(async (e) => {
|
|
13
13
|
const emittersRegister = async (engine) => {
|
|
14
14
|
await loadEmittersPluginSimple(engine);
|
|
@@ -75,5 +75,5 @@ ribbons.create = async (canvas, options = {}) => {
|
|
|
75
75
|
ribbons.init = async () => {
|
|
76
76
|
await initPlugins(tsParticles);
|
|
77
77
|
};
|
|
78
|
-
ribbons.version = "4.
|
|
78
|
+
ribbons.version = "4.2.0";
|
|
79
79
|
globalThis.ribbons = ribbons;
|
package/browser/ribbons.lazy.js
CHANGED
|
@@ -2,7 +2,7 @@ import { isString, tsParticles } from "@tsparticles/engine/lazy";
|
|
|
2
2
|
import { setRibbons } from "./utils.js";
|
|
3
3
|
let initPromise = null;
|
|
4
4
|
async function doInitPlugins(engine) {
|
|
5
|
-
engine.checkVersion("4.
|
|
5
|
+
engine.checkVersion("4.2.0");
|
|
6
6
|
await engine.pluginManager.register(async (e) => {
|
|
7
7
|
const [{ loadBasic }, { loadEmittersPluginSimple }, { loadEmittersShapeSquare }, { loadMotionPlugin }, { loadRibbonShape }, { loadLifeUpdater },] = await Promise.all([
|
|
8
8
|
import("@tsparticles/basic/lazy"),
|
|
@@ -76,5 +76,5 @@ ribbons.create = async (canvas, options = {}) => {
|
|
|
76
76
|
ribbons.init = async () => {
|
|
77
77
|
await initPlugins(tsParticles);
|
|
78
78
|
};
|
|
79
|
-
ribbons.version = "4.
|
|
79
|
+
ribbons.version = "4.2.0";
|
|
80
80
|
globalThis.ribbons = ribbons;
|
package/browser/utils.js
CHANGED
|
@@ -4,7 +4,7 @@ export async function addEmitter(container, actualOptions) {
|
|
|
4
4
|
await container.addEmitter?.({
|
|
5
5
|
startCount: actualOptions.count,
|
|
6
6
|
position: {
|
|
7
|
-
x: actualOptions.
|
|
7
|
+
x: actualOptions.positionX,
|
|
8
8
|
y: emitterTop,
|
|
9
9
|
},
|
|
10
10
|
shape: {
|
|
@@ -144,7 +144,7 @@ export function convertOptions(actualOptions, params) {
|
|
|
144
144
|
name: "ribbons",
|
|
145
145
|
startCount: actualOptions.count,
|
|
146
146
|
position: {
|
|
147
|
-
x: actualOptions.
|
|
147
|
+
x: actualOptions.positionX,
|
|
148
148
|
y: emitterTop,
|
|
149
149
|
},
|
|
150
150
|
shape: {
|
package/cjs/RibbonsOptions.js
CHANGED
|
@@ -1,31 +1,22 @@
|
|
|
1
|
-
import { deepExtend, isArray, isNull, percentDenominator, } from "@tsparticles/engine";
|
|
1
|
+
import { deepExtend, isArray, isNull, loadProperty, percentDenominator, } from "@tsparticles/engine";
|
|
2
2
|
export class RibbonsOptions {
|
|
3
|
-
angle;
|
|
4
3
|
colors;
|
|
5
4
|
count;
|
|
6
5
|
disableForReducedMotion;
|
|
7
|
-
drift;
|
|
8
6
|
emitterSize;
|
|
9
|
-
|
|
7
|
+
positionX;
|
|
10
8
|
ribbonOptions;
|
|
11
9
|
scalar;
|
|
12
|
-
spread;
|
|
13
10
|
ticks;
|
|
14
11
|
zIndex;
|
|
15
12
|
constructor() {
|
|
16
|
-
this.angle = 90;
|
|
17
13
|
this.count = 5;
|
|
18
|
-
this.spread = 0;
|
|
19
|
-
this.drift = 0;
|
|
20
14
|
this.emitterSize = {
|
|
21
15
|
width: 100,
|
|
22
16
|
height: 0,
|
|
23
17
|
};
|
|
18
|
+
this.positionX = 50;
|
|
24
19
|
this.ticks = 200;
|
|
25
|
-
this.position = {
|
|
26
|
-
x: 50,
|
|
27
|
-
y: 0,
|
|
28
|
-
};
|
|
29
20
|
this.colors = ["#FF0055", "#00D1FF", "#FFD23F", "#61FF7E", "#B284FF"];
|
|
30
21
|
this.ribbonOptions = {
|
|
31
22
|
angle: 45,
|
|
@@ -56,13 +47,12 @@ export class RibbonsOptions {
|
|
|
56
47
|
}
|
|
57
48
|
get origin() {
|
|
58
49
|
return {
|
|
59
|
-
x: this.
|
|
60
|
-
y:
|
|
50
|
+
x: this.positionX / percentDenominator,
|
|
51
|
+
y: 0,
|
|
61
52
|
};
|
|
62
53
|
}
|
|
63
54
|
set origin(value) {
|
|
64
|
-
this.
|
|
65
|
-
this.position.y = value.y * percentDenominator;
|
|
55
|
+
this.positionX = value.x * percentDenominator;
|
|
66
56
|
}
|
|
67
57
|
get particleCount() {
|
|
68
58
|
return this.count;
|
|
@@ -70,26 +60,24 @@ export class RibbonsOptions {
|
|
|
70
60
|
set particleCount(value) {
|
|
71
61
|
this.count = value;
|
|
72
62
|
}
|
|
63
|
+
get position() {
|
|
64
|
+
return {
|
|
65
|
+
x: this.positionX,
|
|
66
|
+
y: 0,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
set position(value) {
|
|
70
|
+
this.positionX = value.x;
|
|
71
|
+
}
|
|
73
72
|
load(data) {
|
|
74
73
|
if (isNull(data)) {
|
|
75
74
|
return;
|
|
76
75
|
}
|
|
77
|
-
if (data.angle !== undefined) {
|
|
78
|
-
this.angle = data.angle;
|
|
79
|
-
}
|
|
80
76
|
const count = data.count ?? data.particleCount;
|
|
81
77
|
if (count !== undefined) {
|
|
82
78
|
this.count = count;
|
|
83
79
|
}
|
|
84
|
-
|
|
85
|
-
this.spread = data.spread;
|
|
86
|
-
}
|
|
87
|
-
if (data.drift !== undefined) {
|
|
88
|
-
this.drift = data.drift;
|
|
89
|
-
}
|
|
90
|
-
if (data.ticks !== undefined) {
|
|
91
|
-
this.ticks = data.ticks;
|
|
92
|
-
}
|
|
80
|
+
loadProperty(this, "ticks", data.ticks);
|
|
93
81
|
if (data.emitterSize) {
|
|
94
82
|
if (data.emitterSize.width !== undefined) {
|
|
95
83
|
this.emitterSize.width = data.emitterSize.width;
|
|
@@ -98,20 +86,20 @@ export class RibbonsOptions {
|
|
|
98
86
|
this.emitterSize.height = data.emitterSize.height;
|
|
99
87
|
}
|
|
100
88
|
}
|
|
101
|
-
|
|
102
|
-
if (
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (position) {
|
|
110
|
-
if (position.x !== undefined) {
|
|
111
|
-
this.position.x = position.x;
|
|
89
|
+
loadProperty(this, "positionX", data.positionX);
|
|
90
|
+
if (data.positionX === undefined) {
|
|
91
|
+
const origin = data.origin;
|
|
92
|
+
if (origin && !data.position) {
|
|
93
|
+
data.position = {
|
|
94
|
+
x: origin.x === undefined ? undefined : origin.x * percentDenominator,
|
|
95
|
+
y: 0,
|
|
96
|
+
};
|
|
112
97
|
}
|
|
113
|
-
|
|
114
|
-
|
|
98
|
+
const position = data.position;
|
|
99
|
+
if (position) {
|
|
100
|
+
if (position.x !== undefined) {
|
|
101
|
+
this.positionX = position.x;
|
|
102
|
+
}
|
|
115
103
|
}
|
|
116
104
|
}
|
|
117
105
|
if (data.colors !== undefined) {
|
|
@@ -125,14 +113,8 @@ export class RibbonsOptions {
|
|
|
125
113
|
if (data.ribbonOptions !== undefined) {
|
|
126
114
|
this.ribbonOptions = deepExtend({}, data.ribbonOptions);
|
|
127
115
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
if (data.zIndex !== undefined) {
|
|
132
|
-
this.zIndex = data.zIndex;
|
|
133
|
-
}
|
|
134
|
-
if (data.disableForReducedMotion !== undefined) {
|
|
135
|
-
this.disableForReducedMotion = data.disableForReducedMotion;
|
|
136
|
-
}
|
|
116
|
+
loadProperty(this, "scalar", data.scalar);
|
|
117
|
+
loadProperty(this, "zIndex", data.zIndex);
|
|
118
|
+
loadProperty(this, "disableForReducedMotion", data.disableForReducedMotion);
|
|
137
119
|
}
|
|
138
120
|
}
|
package/cjs/ribbons.js
CHANGED
|
@@ -8,7 +8,7 @@ import { loadRibbonShape } from "@tsparticles/shape-ribbon";
|
|
|
8
8
|
import { setRibbons } from "./utils.js";
|
|
9
9
|
let initPromise = null;
|
|
10
10
|
async function doInitPlugins(engine) {
|
|
11
|
-
engine.checkVersion("4.
|
|
11
|
+
engine.checkVersion("4.2.0");
|
|
12
12
|
await engine.pluginManager.register(async (e) => {
|
|
13
13
|
const emittersRegister = async (engine) => {
|
|
14
14
|
await loadEmittersPluginSimple(engine);
|
|
@@ -75,5 +75,5 @@ ribbons.create = async (canvas, options = {}) => {
|
|
|
75
75
|
ribbons.init = async () => {
|
|
76
76
|
await initPlugins(tsParticles);
|
|
77
77
|
};
|
|
78
|
-
ribbons.version = "4.
|
|
78
|
+
ribbons.version = "4.2.0";
|
|
79
79
|
globalThis.ribbons = ribbons;
|
package/cjs/ribbons.lazy.js
CHANGED
|
@@ -2,7 +2,7 @@ import { isString, tsParticles } from "@tsparticles/engine/lazy";
|
|
|
2
2
|
import { setRibbons } from "./utils.js";
|
|
3
3
|
let initPromise = null;
|
|
4
4
|
async function doInitPlugins(engine) {
|
|
5
|
-
engine.checkVersion("4.
|
|
5
|
+
engine.checkVersion("4.2.0");
|
|
6
6
|
await engine.pluginManager.register(async (e) => {
|
|
7
7
|
const [{ loadBasic }, { loadEmittersPluginSimple }, { loadEmittersShapeSquare }, { loadMotionPlugin }, { loadRibbonShape }, { loadLifeUpdater },] = await Promise.all([
|
|
8
8
|
import("@tsparticles/basic/lazy"),
|
|
@@ -76,5 +76,5 @@ ribbons.create = async (canvas, options = {}) => {
|
|
|
76
76
|
ribbons.init = async () => {
|
|
77
77
|
await initPlugins(tsParticles);
|
|
78
78
|
};
|
|
79
|
-
ribbons.version = "4.
|
|
79
|
+
ribbons.version = "4.2.0";
|
|
80
80
|
globalThis.ribbons = ribbons;
|
package/cjs/utils.js
CHANGED
|
@@ -4,7 +4,7 @@ export async function addEmitter(container, actualOptions) {
|
|
|
4
4
|
await container.addEmitter?.({
|
|
5
5
|
startCount: actualOptions.count,
|
|
6
6
|
position: {
|
|
7
|
-
x: actualOptions.
|
|
7
|
+
x: actualOptions.positionX,
|
|
8
8
|
y: emitterTop,
|
|
9
9
|
},
|
|
10
10
|
shape: {
|
|
@@ -144,7 +144,7 @@ export function convertOptions(actualOptions, params) {
|
|
|
144
144
|
name: "ribbons",
|
|
145
145
|
startCount: actualOptions.count,
|
|
146
146
|
position: {
|
|
147
|
-
x: actualOptions.
|
|
147
|
+
x: actualOptions.positionX,
|
|
148
148
|
y: emitterTop,
|
|
149
149
|
},
|
|
150
150
|
shape: {
|
package/esm/RibbonsOptions.js
CHANGED
|
@@ -1,31 +1,22 @@
|
|
|
1
|
-
import { deepExtend, isArray, isNull, percentDenominator, } from "@tsparticles/engine";
|
|
1
|
+
import { deepExtend, isArray, isNull, loadProperty, percentDenominator, } from "@tsparticles/engine";
|
|
2
2
|
export class RibbonsOptions {
|
|
3
|
-
angle;
|
|
4
3
|
colors;
|
|
5
4
|
count;
|
|
6
5
|
disableForReducedMotion;
|
|
7
|
-
drift;
|
|
8
6
|
emitterSize;
|
|
9
|
-
|
|
7
|
+
positionX;
|
|
10
8
|
ribbonOptions;
|
|
11
9
|
scalar;
|
|
12
|
-
spread;
|
|
13
10
|
ticks;
|
|
14
11
|
zIndex;
|
|
15
12
|
constructor() {
|
|
16
|
-
this.angle = 90;
|
|
17
13
|
this.count = 5;
|
|
18
|
-
this.spread = 0;
|
|
19
|
-
this.drift = 0;
|
|
20
14
|
this.emitterSize = {
|
|
21
15
|
width: 100,
|
|
22
16
|
height: 0,
|
|
23
17
|
};
|
|
18
|
+
this.positionX = 50;
|
|
24
19
|
this.ticks = 200;
|
|
25
|
-
this.position = {
|
|
26
|
-
x: 50,
|
|
27
|
-
y: 0,
|
|
28
|
-
};
|
|
29
20
|
this.colors = ["#FF0055", "#00D1FF", "#FFD23F", "#61FF7E", "#B284FF"];
|
|
30
21
|
this.ribbonOptions = {
|
|
31
22
|
angle: 45,
|
|
@@ -56,13 +47,12 @@ export class RibbonsOptions {
|
|
|
56
47
|
}
|
|
57
48
|
get origin() {
|
|
58
49
|
return {
|
|
59
|
-
x: this.
|
|
60
|
-
y:
|
|
50
|
+
x: this.positionX / percentDenominator,
|
|
51
|
+
y: 0,
|
|
61
52
|
};
|
|
62
53
|
}
|
|
63
54
|
set origin(value) {
|
|
64
|
-
this.
|
|
65
|
-
this.position.y = value.y * percentDenominator;
|
|
55
|
+
this.positionX = value.x * percentDenominator;
|
|
66
56
|
}
|
|
67
57
|
get particleCount() {
|
|
68
58
|
return this.count;
|
|
@@ -70,26 +60,24 @@ export class RibbonsOptions {
|
|
|
70
60
|
set particleCount(value) {
|
|
71
61
|
this.count = value;
|
|
72
62
|
}
|
|
63
|
+
get position() {
|
|
64
|
+
return {
|
|
65
|
+
x: this.positionX,
|
|
66
|
+
y: 0,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
set position(value) {
|
|
70
|
+
this.positionX = value.x;
|
|
71
|
+
}
|
|
73
72
|
load(data) {
|
|
74
73
|
if (isNull(data)) {
|
|
75
74
|
return;
|
|
76
75
|
}
|
|
77
|
-
if (data.angle !== undefined) {
|
|
78
|
-
this.angle = data.angle;
|
|
79
|
-
}
|
|
80
76
|
const count = data.count ?? data.particleCount;
|
|
81
77
|
if (count !== undefined) {
|
|
82
78
|
this.count = count;
|
|
83
79
|
}
|
|
84
|
-
|
|
85
|
-
this.spread = data.spread;
|
|
86
|
-
}
|
|
87
|
-
if (data.drift !== undefined) {
|
|
88
|
-
this.drift = data.drift;
|
|
89
|
-
}
|
|
90
|
-
if (data.ticks !== undefined) {
|
|
91
|
-
this.ticks = data.ticks;
|
|
92
|
-
}
|
|
80
|
+
loadProperty(this, "ticks", data.ticks);
|
|
93
81
|
if (data.emitterSize) {
|
|
94
82
|
if (data.emitterSize.width !== undefined) {
|
|
95
83
|
this.emitterSize.width = data.emitterSize.width;
|
|
@@ -98,20 +86,20 @@ export class RibbonsOptions {
|
|
|
98
86
|
this.emitterSize.height = data.emitterSize.height;
|
|
99
87
|
}
|
|
100
88
|
}
|
|
101
|
-
|
|
102
|
-
if (
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (position) {
|
|
110
|
-
if (position.x !== undefined) {
|
|
111
|
-
this.position.x = position.x;
|
|
89
|
+
loadProperty(this, "positionX", data.positionX);
|
|
90
|
+
if (data.positionX === undefined) {
|
|
91
|
+
const origin = data.origin;
|
|
92
|
+
if (origin && !data.position) {
|
|
93
|
+
data.position = {
|
|
94
|
+
x: origin.x === undefined ? undefined : origin.x * percentDenominator,
|
|
95
|
+
y: 0,
|
|
96
|
+
};
|
|
112
97
|
}
|
|
113
|
-
|
|
114
|
-
|
|
98
|
+
const position = data.position;
|
|
99
|
+
if (position) {
|
|
100
|
+
if (position.x !== undefined) {
|
|
101
|
+
this.positionX = position.x;
|
|
102
|
+
}
|
|
115
103
|
}
|
|
116
104
|
}
|
|
117
105
|
if (data.colors !== undefined) {
|
|
@@ -125,14 +113,8 @@ export class RibbonsOptions {
|
|
|
125
113
|
if (data.ribbonOptions !== undefined) {
|
|
126
114
|
this.ribbonOptions = deepExtend({}, data.ribbonOptions);
|
|
127
115
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
if (data.zIndex !== undefined) {
|
|
132
|
-
this.zIndex = data.zIndex;
|
|
133
|
-
}
|
|
134
|
-
if (data.disableForReducedMotion !== undefined) {
|
|
135
|
-
this.disableForReducedMotion = data.disableForReducedMotion;
|
|
136
|
-
}
|
|
116
|
+
loadProperty(this, "scalar", data.scalar);
|
|
117
|
+
loadProperty(this, "zIndex", data.zIndex);
|
|
118
|
+
loadProperty(this, "disableForReducedMotion", data.disableForReducedMotion);
|
|
137
119
|
}
|
|
138
120
|
}
|
package/esm/ribbons.js
CHANGED
|
@@ -8,7 +8,7 @@ import { loadRibbonShape } from "@tsparticles/shape-ribbon";
|
|
|
8
8
|
import { setRibbons } from "./utils.js";
|
|
9
9
|
let initPromise = null;
|
|
10
10
|
async function doInitPlugins(engine) {
|
|
11
|
-
engine.checkVersion("4.
|
|
11
|
+
engine.checkVersion("4.2.0");
|
|
12
12
|
await engine.pluginManager.register(async (e) => {
|
|
13
13
|
const emittersRegister = async (engine) => {
|
|
14
14
|
await loadEmittersPluginSimple(engine);
|
|
@@ -75,5 +75,5 @@ ribbons.create = async (canvas, options = {}) => {
|
|
|
75
75
|
ribbons.init = async () => {
|
|
76
76
|
await initPlugins(tsParticles);
|
|
77
77
|
};
|
|
78
|
-
ribbons.version = "4.
|
|
78
|
+
ribbons.version = "4.2.0";
|
|
79
79
|
globalThis.ribbons = ribbons;
|
package/esm/ribbons.lazy.js
CHANGED
|
@@ -2,7 +2,7 @@ import { isString, tsParticles } from "@tsparticles/engine/lazy";
|
|
|
2
2
|
import { setRibbons } from "./utils.js";
|
|
3
3
|
let initPromise = null;
|
|
4
4
|
async function doInitPlugins(engine) {
|
|
5
|
-
engine.checkVersion("4.
|
|
5
|
+
engine.checkVersion("4.2.0");
|
|
6
6
|
await engine.pluginManager.register(async (e) => {
|
|
7
7
|
const [{ loadBasic }, { loadEmittersPluginSimple }, { loadEmittersShapeSquare }, { loadMotionPlugin }, { loadRibbonShape }, { loadLifeUpdater },] = await Promise.all([
|
|
8
8
|
import("@tsparticles/basic/lazy"),
|
|
@@ -76,5 +76,5 @@ ribbons.create = async (canvas, options = {}) => {
|
|
|
76
76
|
ribbons.init = async () => {
|
|
77
77
|
await initPlugins(tsParticles);
|
|
78
78
|
};
|
|
79
|
-
ribbons.version = "4.
|
|
79
|
+
ribbons.version = "4.2.0";
|
|
80
80
|
globalThis.ribbons = ribbons;
|
package/esm/utils.js
CHANGED
|
@@ -4,7 +4,7 @@ export async function addEmitter(container, actualOptions) {
|
|
|
4
4
|
await container.addEmitter?.({
|
|
5
5
|
startCount: actualOptions.count,
|
|
6
6
|
position: {
|
|
7
|
-
x: actualOptions.
|
|
7
|
+
x: actualOptions.positionX,
|
|
8
8
|
y: emitterTop,
|
|
9
9
|
},
|
|
10
10
|
shape: {
|
|
@@ -144,7 +144,7 @@ export function convertOptions(actualOptions, params) {
|
|
|
144
144
|
name: "ribbons",
|
|
145
145
|
startCount: actualOptions.count,
|
|
146
146
|
position: {
|
|
147
|
-
x: actualOptions.
|
|
147
|
+
x: actualOptions.positionX,
|
|
148
148
|
y: emitterTop,
|
|
149
149
|
},
|
|
150
150
|
shape: {
|