@tsparticles/ribbons 4.1.3 → 4.2.1
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 -4
- package/browser/RibbonsOptions.js +31 -52
- package/browser/ribbons.js +2 -2
- package/browser/ribbons.lazy.js +2 -2
- package/browser/utils.js +2 -2
- package/cjs/RibbonsOptions.js +31 -52
- package/cjs/ribbons.js +2 -2
- package/cjs/ribbons.lazy.js +2 -2
- package/cjs/utils.js +2 -2
- package/esm/RibbonsOptions.js +31 -52
- 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 +1064 -1720
- package/tsparticles.ribbons.bundle.min.js +1 -1
- package/tsparticles.ribbons.js +35 -56
- package/tsparticles.ribbons.min.js +1 -1
- package/types/IRibbonsOptions.d.ts +1 -4
- package/types/RibbonsOptions.d.ts +3 -5
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ import { ribbons } from "@tsparticles/ribbons";
|
|
|
38
38
|
|
|
39
39
|
await ribbons({
|
|
40
40
|
count: 5,
|
|
41
|
-
|
|
41
|
+
positionX: 50,
|
|
42
42
|
});
|
|
43
43
|
```
|
|
44
44
|
|
|
@@ -64,7 +64,9 @@ Main options:
|
|
|
64
64
|
|
|
65
65
|
- `count` _Integer (default: 5)_
|
|
66
66
|
- `ticks` _Number (default: 200)_
|
|
67
|
-
- `
|
|
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
|
|
68
70
|
- `colors` _Array<String>_
|
|
69
71
|
- `ribbonOptions` _Object_ (`particles.shape.options.ribbon`)
|
|
70
72
|
- Includes `darken: { enable: true, value: 30 }` by default
|
|
@@ -73,9 +75,10 @@ Main options:
|
|
|
73
75
|
- `disableForReducedMotion` _Boolean (default: true)_
|
|
74
76
|
|
|
75
77
|
The `ribbons` bundle disables `roll`, `rotate`, `tilt`, and `wobble` on ribbon particles by default for better shape stability.
|
|
76
|
-
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.
|
|
77
79
|
|
|
78
80
|
Deprecated aliases still accepted:
|
|
79
81
|
|
|
80
82
|
- `particleCount` (use `count`)
|
|
81
|
-
- `
|
|
83
|
+
- `position` (use `positionX`)
|
|
84
|
+
- `origin` (use `positionX`)
|
|
@@ -1,31 +1,20 @@
|
|
|
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
|
-
ticks;
|
|
14
10
|
zIndex;
|
|
15
11
|
constructor() {
|
|
16
|
-
this.angle = 90;
|
|
17
12
|
this.count = 5;
|
|
18
|
-
this.spread = 0;
|
|
19
|
-
this.drift = 0;
|
|
20
13
|
this.emitterSize = {
|
|
21
14
|
width: 100,
|
|
22
15
|
height: 0,
|
|
23
16
|
};
|
|
24
|
-
this.
|
|
25
|
-
this.position = {
|
|
26
|
-
x: 50,
|
|
27
|
-
y: 0,
|
|
28
|
-
};
|
|
17
|
+
this.positionX = 50;
|
|
29
18
|
this.colors = ["#FF0055", "#00D1FF", "#FFD23F", "#61FF7E", "#B284FF"];
|
|
30
19
|
this.ribbonOptions = {
|
|
31
20
|
angle: 45,
|
|
@@ -56,13 +45,12 @@ export class RibbonsOptions {
|
|
|
56
45
|
}
|
|
57
46
|
get origin() {
|
|
58
47
|
return {
|
|
59
|
-
x: this.
|
|
60
|
-
y:
|
|
48
|
+
x: this.positionX / percentDenominator,
|
|
49
|
+
y: 0,
|
|
61
50
|
};
|
|
62
51
|
}
|
|
63
52
|
set origin(value) {
|
|
64
|
-
this.
|
|
65
|
-
this.position.y = value.y * percentDenominator;
|
|
53
|
+
this.positionX = value.x * percentDenominator;
|
|
66
54
|
}
|
|
67
55
|
get particleCount() {
|
|
68
56
|
return this.count;
|
|
@@ -70,26 +58,23 @@ export class RibbonsOptions {
|
|
|
70
58
|
set particleCount(value) {
|
|
71
59
|
this.count = value;
|
|
72
60
|
}
|
|
61
|
+
get position() {
|
|
62
|
+
return {
|
|
63
|
+
x: this.positionX,
|
|
64
|
+
y: 0,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
set position(value) {
|
|
68
|
+
this.positionX = value.x;
|
|
69
|
+
}
|
|
73
70
|
load(data) {
|
|
74
71
|
if (isNull(data)) {
|
|
75
72
|
return;
|
|
76
73
|
}
|
|
77
|
-
if (data.angle !== undefined) {
|
|
78
|
-
this.angle = data.angle;
|
|
79
|
-
}
|
|
80
74
|
const count = data.count ?? data.particleCount;
|
|
81
75
|
if (count !== undefined) {
|
|
82
76
|
this.count = count;
|
|
83
77
|
}
|
|
84
|
-
if (data.spread !== undefined) {
|
|
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
|
-
}
|
|
93
78
|
if (data.emitterSize) {
|
|
94
79
|
if (data.emitterSize.width !== undefined) {
|
|
95
80
|
this.emitterSize.width = data.emitterSize.width;
|
|
@@ -98,20 +83,20 @@ export class RibbonsOptions {
|
|
|
98
83
|
this.emitterSize.height = data.emitterSize.height;
|
|
99
84
|
}
|
|
100
85
|
}
|
|
101
|
-
|
|
102
|
-
if (
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (position) {
|
|
110
|
-
if (position.x !== undefined) {
|
|
111
|
-
this.position.x = position.x;
|
|
86
|
+
loadProperty(this, "positionX", data.positionX);
|
|
87
|
+
if (data.positionX === undefined) {
|
|
88
|
+
const origin = data.origin;
|
|
89
|
+
if (origin && !data.position) {
|
|
90
|
+
data.position = {
|
|
91
|
+
x: origin.x === undefined ? undefined : origin.x * percentDenominator,
|
|
92
|
+
y: 0,
|
|
93
|
+
};
|
|
112
94
|
}
|
|
113
|
-
|
|
114
|
-
|
|
95
|
+
const position = data.position;
|
|
96
|
+
if (position) {
|
|
97
|
+
if (position.x !== undefined) {
|
|
98
|
+
this.positionX = position.x;
|
|
99
|
+
}
|
|
115
100
|
}
|
|
116
101
|
}
|
|
117
102
|
if (data.colors !== undefined) {
|
|
@@ -125,14 +110,8 @@ export class RibbonsOptions {
|
|
|
125
110
|
if (data.ribbonOptions !== undefined) {
|
|
126
111
|
this.ribbonOptions = deepExtend({}, data.ribbonOptions);
|
|
127
112
|
}
|
|
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
|
-
}
|
|
113
|
+
loadProperty(this, "scalar", data.scalar);
|
|
114
|
+
loadProperty(this, "zIndex", data.zIndex);
|
|
115
|
+
loadProperty(this, "disableForReducedMotion", data.disableForReducedMotion);
|
|
137
116
|
}
|
|
138
117
|
}
|
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.1
|
|
11
|
+
engine.checkVersion("4.2.1");
|
|
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.1
|
|
78
|
+
ribbons.version = "4.2.1";
|
|
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.1
|
|
5
|
+
engine.checkVersion("4.2.1");
|
|
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.1
|
|
79
|
+
ribbons.version = "4.2.1";
|
|
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,20 @@
|
|
|
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
|
-
ticks;
|
|
14
10
|
zIndex;
|
|
15
11
|
constructor() {
|
|
16
|
-
this.angle = 90;
|
|
17
12
|
this.count = 5;
|
|
18
|
-
this.spread = 0;
|
|
19
|
-
this.drift = 0;
|
|
20
13
|
this.emitterSize = {
|
|
21
14
|
width: 100,
|
|
22
15
|
height: 0,
|
|
23
16
|
};
|
|
24
|
-
this.
|
|
25
|
-
this.position = {
|
|
26
|
-
x: 50,
|
|
27
|
-
y: 0,
|
|
28
|
-
};
|
|
17
|
+
this.positionX = 50;
|
|
29
18
|
this.colors = ["#FF0055", "#00D1FF", "#FFD23F", "#61FF7E", "#B284FF"];
|
|
30
19
|
this.ribbonOptions = {
|
|
31
20
|
angle: 45,
|
|
@@ -56,13 +45,12 @@ export class RibbonsOptions {
|
|
|
56
45
|
}
|
|
57
46
|
get origin() {
|
|
58
47
|
return {
|
|
59
|
-
x: this.
|
|
60
|
-
y:
|
|
48
|
+
x: this.positionX / percentDenominator,
|
|
49
|
+
y: 0,
|
|
61
50
|
};
|
|
62
51
|
}
|
|
63
52
|
set origin(value) {
|
|
64
|
-
this.
|
|
65
|
-
this.position.y = value.y * percentDenominator;
|
|
53
|
+
this.positionX = value.x * percentDenominator;
|
|
66
54
|
}
|
|
67
55
|
get particleCount() {
|
|
68
56
|
return this.count;
|
|
@@ -70,26 +58,23 @@ export class RibbonsOptions {
|
|
|
70
58
|
set particleCount(value) {
|
|
71
59
|
this.count = value;
|
|
72
60
|
}
|
|
61
|
+
get position() {
|
|
62
|
+
return {
|
|
63
|
+
x: this.positionX,
|
|
64
|
+
y: 0,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
set position(value) {
|
|
68
|
+
this.positionX = value.x;
|
|
69
|
+
}
|
|
73
70
|
load(data) {
|
|
74
71
|
if (isNull(data)) {
|
|
75
72
|
return;
|
|
76
73
|
}
|
|
77
|
-
if (data.angle !== undefined) {
|
|
78
|
-
this.angle = data.angle;
|
|
79
|
-
}
|
|
80
74
|
const count = data.count ?? data.particleCount;
|
|
81
75
|
if (count !== undefined) {
|
|
82
76
|
this.count = count;
|
|
83
77
|
}
|
|
84
|
-
if (data.spread !== undefined) {
|
|
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
|
-
}
|
|
93
78
|
if (data.emitterSize) {
|
|
94
79
|
if (data.emitterSize.width !== undefined) {
|
|
95
80
|
this.emitterSize.width = data.emitterSize.width;
|
|
@@ -98,20 +83,20 @@ export class RibbonsOptions {
|
|
|
98
83
|
this.emitterSize.height = data.emitterSize.height;
|
|
99
84
|
}
|
|
100
85
|
}
|
|
101
|
-
|
|
102
|
-
if (
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (position) {
|
|
110
|
-
if (position.x !== undefined) {
|
|
111
|
-
this.position.x = position.x;
|
|
86
|
+
loadProperty(this, "positionX", data.positionX);
|
|
87
|
+
if (data.positionX === undefined) {
|
|
88
|
+
const origin = data.origin;
|
|
89
|
+
if (origin && !data.position) {
|
|
90
|
+
data.position = {
|
|
91
|
+
x: origin.x === undefined ? undefined : origin.x * percentDenominator,
|
|
92
|
+
y: 0,
|
|
93
|
+
};
|
|
112
94
|
}
|
|
113
|
-
|
|
114
|
-
|
|
95
|
+
const position = data.position;
|
|
96
|
+
if (position) {
|
|
97
|
+
if (position.x !== undefined) {
|
|
98
|
+
this.positionX = position.x;
|
|
99
|
+
}
|
|
115
100
|
}
|
|
116
101
|
}
|
|
117
102
|
if (data.colors !== undefined) {
|
|
@@ -125,14 +110,8 @@ export class RibbonsOptions {
|
|
|
125
110
|
if (data.ribbonOptions !== undefined) {
|
|
126
111
|
this.ribbonOptions = deepExtend({}, data.ribbonOptions);
|
|
127
112
|
}
|
|
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
|
-
}
|
|
113
|
+
loadProperty(this, "scalar", data.scalar);
|
|
114
|
+
loadProperty(this, "zIndex", data.zIndex);
|
|
115
|
+
loadProperty(this, "disableForReducedMotion", data.disableForReducedMotion);
|
|
137
116
|
}
|
|
138
117
|
}
|
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.1
|
|
11
|
+
engine.checkVersion("4.2.1");
|
|
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.1
|
|
78
|
+
ribbons.version = "4.2.1";
|
|
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.1
|
|
5
|
+
engine.checkVersion("4.2.1");
|
|
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.1
|
|
79
|
+
ribbons.version = "4.2.1";
|
|
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,20 @@
|
|
|
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
|
-
ticks;
|
|
14
10
|
zIndex;
|
|
15
11
|
constructor() {
|
|
16
|
-
this.angle = 90;
|
|
17
12
|
this.count = 5;
|
|
18
|
-
this.spread = 0;
|
|
19
|
-
this.drift = 0;
|
|
20
13
|
this.emitterSize = {
|
|
21
14
|
width: 100,
|
|
22
15
|
height: 0,
|
|
23
16
|
};
|
|
24
|
-
this.
|
|
25
|
-
this.position = {
|
|
26
|
-
x: 50,
|
|
27
|
-
y: 0,
|
|
28
|
-
};
|
|
17
|
+
this.positionX = 50;
|
|
29
18
|
this.colors = ["#FF0055", "#00D1FF", "#FFD23F", "#61FF7E", "#B284FF"];
|
|
30
19
|
this.ribbonOptions = {
|
|
31
20
|
angle: 45,
|
|
@@ -56,13 +45,12 @@ export class RibbonsOptions {
|
|
|
56
45
|
}
|
|
57
46
|
get origin() {
|
|
58
47
|
return {
|
|
59
|
-
x: this.
|
|
60
|
-
y:
|
|
48
|
+
x: this.positionX / percentDenominator,
|
|
49
|
+
y: 0,
|
|
61
50
|
};
|
|
62
51
|
}
|
|
63
52
|
set origin(value) {
|
|
64
|
-
this.
|
|
65
|
-
this.position.y = value.y * percentDenominator;
|
|
53
|
+
this.positionX = value.x * percentDenominator;
|
|
66
54
|
}
|
|
67
55
|
get particleCount() {
|
|
68
56
|
return this.count;
|
|
@@ -70,26 +58,23 @@ export class RibbonsOptions {
|
|
|
70
58
|
set particleCount(value) {
|
|
71
59
|
this.count = value;
|
|
72
60
|
}
|
|
61
|
+
get position() {
|
|
62
|
+
return {
|
|
63
|
+
x: this.positionX,
|
|
64
|
+
y: 0,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
set position(value) {
|
|
68
|
+
this.positionX = value.x;
|
|
69
|
+
}
|
|
73
70
|
load(data) {
|
|
74
71
|
if (isNull(data)) {
|
|
75
72
|
return;
|
|
76
73
|
}
|
|
77
|
-
if (data.angle !== undefined) {
|
|
78
|
-
this.angle = data.angle;
|
|
79
|
-
}
|
|
80
74
|
const count = data.count ?? data.particleCount;
|
|
81
75
|
if (count !== undefined) {
|
|
82
76
|
this.count = count;
|
|
83
77
|
}
|
|
84
|
-
if (data.spread !== undefined) {
|
|
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
|
-
}
|
|
93
78
|
if (data.emitterSize) {
|
|
94
79
|
if (data.emitterSize.width !== undefined) {
|
|
95
80
|
this.emitterSize.width = data.emitterSize.width;
|
|
@@ -98,20 +83,20 @@ export class RibbonsOptions {
|
|
|
98
83
|
this.emitterSize.height = data.emitterSize.height;
|
|
99
84
|
}
|
|
100
85
|
}
|
|
101
|
-
|
|
102
|
-
if (
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (position) {
|
|
110
|
-
if (position.x !== undefined) {
|
|
111
|
-
this.position.x = position.x;
|
|
86
|
+
loadProperty(this, "positionX", data.positionX);
|
|
87
|
+
if (data.positionX === undefined) {
|
|
88
|
+
const origin = data.origin;
|
|
89
|
+
if (origin && !data.position) {
|
|
90
|
+
data.position = {
|
|
91
|
+
x: origin.x === undefined ? undefined : origin.x * percentDenominator,
|
|
92
|
+
y: 0,
|
|
93
|
+
};
|
|
112
94
|
}
|
|
113
|
-
|
|
114
|
-
|
|
95
|
+
const position = data.position;
|
|
96
|
+
if (position) {
|
|
97
|
+
if (position.x !== undefined) {
|
|
98
|
+
this.positionX = position.x;
|
|
99
|
+
}
|
|
115
100
|
}
|
|
116
101
|
}
|
|
117
102
|
if (data.colors !== undefined) {
|
|
@@ -125,14 +110,8 @@ export class RibbonsOptions {
|
|
|
125
110
|
if (data.ribbonOptions !== undefined) {
|
|
126
111
|
this.ribbonOptions = deepExtend({}, data.ribbonOptions);
|
|
127
112
|
}
|
|
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
|
-
}
|
|
113
|
+
loadProperty(this, "scalar", data.scalar);
|
|
114
|
+
loadProperty(this, "zIndex", data.zIndex);
|
|
115
|
+
loadProperty(this, "disableForReducedMotion", data.disableForReducedMotion);
|
|
137
116
|
}
|
|
138
117
|
}
|
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.1
|
|
11
|
+
engine.checkVersion("4.2.1");
|
|
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.1
|
|
78
|
+
ribbons.version = "4.2.1";
|
|
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.1
|
|
5
|
+
engine.checkVersion("4.2.1");
|
|
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.1
|
|
79
|
+
ribbons.version = "4.2.1";
|
|
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: {
|