@tsparticles/ribbons 4.0.5
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/LICENSE +21 -0
- package/README.md +83 -0
- package/browser/IRibbonsOptions.js +1 -0
- package/browser/RibbonsOptions.js +138 -0
- package/browser/RibbonsParams.js +1 -0
- package/browser/browser.js +4 -0
- package/browser/bundle.js +5 -0
- package/browser/index.js +1 -0
- package/browser/index.lazy.js +1 -0
- package/browser/package.json +1 -0
- package/browser/ribbons.js +79 -0
- package/browser/ribbons.lazy.js +80 -0
- package/browser/types.js +1 -0
- package/browser/utils.js +195 -0
- package/cjs/IRibbonsOptions.js +1 -0
- package/cjs/RibbonsOptions.js +138 -0
- package/cjs/RibbonsParams.js +1 -0
- package/cjs/browser.js +4 -0
- package/cjs/bundle.js +5 -0
- package/cjs/index.js +1 -0
- package/cjs/index.lazy.js +1 -0
- package/cjs/package.json +1 -0
- package/cjs/ribbons.js +79 -0
- package/cjs/ribbons.lazy.js +80 -0
- package/cjs/types.js +1 -0
- package/cjs/utils.js +195 -0
- package/esm/IRibbonsOptions.js +1 -0
- package/esm/RibbonsOptions.js +138 -0
- package/esm/RibbonsParams.js +1 -0
- package/esm/browser.js +4 -0
- package/esm/bundle.js +5 -0
- package/esm/index.js +1 -0
- package/esm/index.lazy.js +1 -0
- package/esm/package.json +1 -0
- package/esm/ribbons.js +79 -0
- package/esm/ribbons.lazy.js +80 -0
- package/esm/types.js +1 -0
- package/esm/utils.js +195 -0
- package/package.json +88 -0
- package/report.html +4950 -0
- package/tsparticles.ribbons.bundle.js +8433 -0
- package/tsparticles.ribbons.bundle.min.js +1 -0
- package/tsparticles.ribbons.js +424 -0
- package/tsparticles.ribbons.min.js +1 -0
- package/types/IRibbonsOptions.d.ts +17 -0
- package/types/RibbonsOptions.d.ts +22 -0
- package/types/RibbonsParams.d.ts +7 -0
- package/types/browser.d.ts +1 -0
- package/types/bundle.d.ts +2 -0
- package/types/index.d.ts +5 -0
- package/types/index.lazy.d.ts +5 -0
- package/types/ribbons.d.ts +16 -0
- package/types/ribbons.lazy.d.ts +16 -0
- package/types/types.d.ts +4 -0
- package/types/utils.d.ts +7 -0
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
(function(g){g.__tsParticlesInternals=g.__tsParticlesInternals||{};g.__tsParticlesInternals.bundles=g.__tsParticlesInternals.bundles||{};g.__tsParticlesInternals.effects=g.__tsParticlesInternals.effects||{};g.__tsParticlesInternals.engine=g.__tsParticlesInternals.engine||{};g.__tsParticlesInternals.interactions=g.__tsParticlesInternals.interactions||{};g.__tsParticlesInternals.palettes=g.__tsParticlesInternals.palettes||{};g.__tsParticlesInternals.paths=g.__tsParticlesInternals.paths||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins.emittersShapes=g.__tsParticlesInternals.plugins.emittersShapes||{};g.__tsParticlesInternals.presets=g.__tsParticlesInternals.presets||{};g.__tsParticlesInternals.shapes=g.__tsParticlesInternals.shapes||{};g.__tsParticlesInternals.updaters=g.__tsParticlesInternals.updaters||{};g.__tsParticlesInternals.utils=g.__tsParticlesInternals.utils||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas.utils=g.__tsParticlesInternals.canvas.utils||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path.utils=g.__tsParticlesInternals.path.utils||{};var __tsProxyFactory=typeof Proxy!=="undefined"?function(obj){return new Proxy(obj,{get:function(target,key){if(!(key in target)){target[key]={};}return target[key];}});}:function(obj){return obj;};g.__tsParticlesInternals.bundles=__tsProxyFactory(g.__tsParticlesInternals.bundles);g.__tsParticlesInternals.effects=__tsProxyFactory(g.__tsParticlesInternals.effects);g.__tsParticlesInternals.interactions=__tsProxyFactory(g.__tsParticlesInternals.interactions);g.__tsParticlesInternals.palettes=__tsProxyFactory(g.__tsParticlesInternals.palettes);g.__tsParticlesInternals.paths=__tsProxyFactory(g.__tsParticlesInternals.paths);g.__tsParticlesInternals.plugins=__tsProxyFactory(g.__tsParticlesInternals.plugins);g.__tsParticlesInternals.plugins.emittersShapes=__tsProxyFactory(g.__tsParticlesInternals.plugins.emittersShapes);g.__tsParticlesInternals.presets=__tsProxyFactory(g.__tsParticlesInternals.presets);g.__tsParticlesInternals.shapes=__tsProxyFactory(g.__tsParticlesInternals.shapes);g.__tsParticlesInternals.updaters=__tsProxyFactory(g.__tsParticlesInternals.updaters);g.__tsParticlesInternals.utils=__tsProxyFactory(g.__tsParticlesInternals.utils);g.__tsParticlesInternals.canvas=__tsProxyFactory(g.__tsParticlesInternals.canvas);g.__tsParticlesInternals.path=__tsProxyFactory(g.__tsParticlesInternals.path);g.tsparticlesInternalExports=g.tsparticlesInternalExports||{};})(typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:this);
|
|
2
|
+
/* tsParticles v4.0.5 */
|
|
3
|
+
(function (global, factory) {
|
|
4
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tsparticles/engine'), require('@tsparticles/basic'), require('@tsparticles/plugin-emitters/plugin'), require('@tsparticles/plugin-emitters-shape-square'), require('@tsparticles/updater-life'), require('@tsparticles/plugin-motion'), require('@tsparticles/shape-ribbon')) :
|
|
5
|
+
typeof define === 'function' && define.amd ? define(['exports', '@tsparticles/engine', '@tsparticles/basic', '@tsparticles/plugin-emitters/plugin', '@tsparticles/plugin-emitters-shape-square', '@tsparticles/updater-life', '@tsparticles/plugin-motion', '@tsparticles/shape-ribbon'], factory) :
|
|
6
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.__tsParticlesInternals = global.__tsParticlesInternals || {}, global.__tsParticlesInternals.bundles = global.__tsParticlesInternals.bundles || {}, global.__tsParticlesInternals.bundles.ribbons = global.__tsParticlesInternals.bundles.ribbons || {}), global.__tsParticlesInternals.engine, global.__tsParticlesInternals.bundles.basic, global.__tsParticlesInternals.plugins["emitters/plugin"], global.__tsParticlesInternals.plugins.emittersShapes.square, global.__tsParticlesInternals.updaters.life, global.__tsParticlesInternals.plugins.motion, global.__tsParticlesInternals.shapes.ribbon));
|
|
7
|
+
})(this, (function (exports, engine, basic, plugin, pluginEmittersShapeSquare, updaterLife, pluginMotion, shapeRibbon) { 'use strict';
|
|
8
|
+
|
|
9
|
+
class RibbonsOptions {
|
|
10
|
+
angle;
|
|
11
|
+
colors;
|
|
12
|
+
count;
|
|
13
|
+
disableForReducedMotion;
|
|
14
|
+
drift;
|
|
15
|
+
emitterSize;
|
|
16
|
+
position;
|
|
17
|
+
ribbonOptions;
|
|
18
|
+
scalar;
|
|
19
|
+
spread;
|
|
20
|
+
ticks;
|
|
21
|
+
zIndex;
|
|
22
|
+
constructor() {
|
|
23
|
+
this.angle = 90;
|
|
24
|
+
this.count = 5;
|
|
25
|
+
this.spread = 0;
|
|
26
|
+
this.drift = 0;
|
|
27
|
+
this.emitterSize = {
|
|
28
|
+
width: 100,
|
|
29
|
+
height: 0,
|
|
30
|
+
};
|
|
31
|
+
this.ticks = 200;
|
|
32
|
+
this.position = {
|
|
33
|
+
x: 50,
|
|
34
|
+
y: 0,
|
|
35
|
+
};
|
|
36
|
+
this.colors = ["#FF0055", "#00D1FF", "#FFD23F", "#61FF7E", "#B284FF"];
|
|
37
|
+
this.ribbonOptions = {
|
|
38
|
+
angle: 45,
|
|
39
|
+
darken: {
|
|
40
|
+
enable: true,
|
|
41
|
+
value: 30,
|
|
42
|
+
},
|
|
43
|
+
count: 60,
|
|
44
|
+
drag: 0.02,
|
|
45
|
+
mass: 1,
|
|
46
|
+
oscillationDistance: {
|
|
47
|
+
min: 100,
|
|
48
|
+
max: 140,
|
|
49
|
+
},
|
|
50
|
+
oscillationSpeed: {
|
|
51
|
+
min: 3,
|
|
52
|
+
max: 5,
|
|
53
|
+
},
|
|
54
|
+
particleDist: 8,
|
|
55
|
+
velocityInherit: {
|
|
56
|
+
min: 4,
|
|
57
|
+
max: 6,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
this.scalar = 1;
|
|
61
|
+
this.zIndex = 100;
|
|
62
|
+
this.disableForReducedMotion = true;
|
|
63
|
+
}
|
|
64
|
+
get origin() {
|
|
65
|
+
return {
|
|
66
|
+
x: this.position.x / engine.percentDenominator,
|
|
67
|
+
y: this.position.y / engine.percentDenominator,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
set origin(value) {
|
|
71
|
+
this.position.x = value.x * engine.percentDenominator;
|
|
72
|
+
this.position.y = value.y * engine.percentDenominator;
|
|
73
|
+
}
|
|
74
|
+
get particleCount() {
|
|
75
|
+
return this.count;
|
|
76
|
+
}
|
|
77
|
+
set particleCount(value) {
|
|
78
|
+
this.count = value;
|
|
79
|
+
}
|
|
80
|
+
load(data) {
|
|
81
|
+
if (engine.isNull(data)) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (data.angle !== undefined) {
|
|
85
|
+
this.angle = data.angle;
|
|
86
|
+
}
|
|
87
|
+
const count = data.count ?? data.particleCount;
|
|
88
|
+
if (count !== undefined) {
|
|
89
|
+
this.count = count;
|
|
90
|
+
}
|
|
91
|
+
if (data.spread !== undefined) {
|
|
92
|
+
this.spread = data.spread;
|
|
93
|
+
}
|
|
94
|
+
if (data.drift !== undefined) {
|
|
95
|
+
this.drift = data.drift;
|
|
96
|
+
}
|
|
97
|
+
if (data.ticks !== undefined) {
|
|
98
|
+
this.ticks = data.ticks;
|
|
99
|
+
}
|
|
100
|
+
if (data.emitterSize) {
|
|
101
|
+
if (data.emitterSize.width !== undefined) {
|
|
102
|
+
this.emitterSize.width = data.emitterSize.width;
|
|
103
|
+
}
|
|
104
|
+
if (data.emitterSize.height !== undefined) {
|
|
105
|
+
this.emitterSize.height = data.emitterSize.height;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const origin = data.origin;
|
|
109
|
+
if (origin && !data.position) {
|
|
110
|
+
data.position = {
|
|
111
|
+
x: origin.x === undefined ? undefined : origin.x * engine.percentDenominator,
|
|
112
|
+
y: origin.y === undefined ? undefined : origin.y * engine.percentDenominator,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
const position = data.position;
|
|
116
|
+
if (position) {
|
|
117
|
+
if (position.x !== undefined) {
|
|
118
|
+
this.position.x = position.x;
|
|
119
|
+
}
|
|
120
|
+
if (position.y !== undefined) {
|
|
121
|
+
this.position.y = position.y;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (data.colors !== undefined) {
|
|
125
|
+
if (engine.isArray(data.colors)) {
|
|
126
|
+
this.colors = [...data.colors];
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
this.colors = data.colors;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (data.ribbonOptions !== undefined) {
|
|
133
|
+
this.ribbonOptions = engine.deepExtend({}, data.ribbonOptions);
|
|
134
|
+
}
|
|
135
|
+
if (data.scalar !== undefined) {
|
|
136
|
+
this.scalar = data.scalar;
|
|
137
|
+
}
|
|
138
|
+
if (data.zIndex !== undefined) {
|
|
139
|
+
this.zIndex = data.zIndex;
|
|
140
|
+
}
|
|
141
|
+
if (data.disableForReducedMotion !== undefined) {
|
|
142
|
+
this.disableForReducedMotion = data.disableForReducedMotion;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const sizeFactor = 8, emitterTop = 0, ids = new Map();
|
|
148
|
+
async function addEmitter(container, actualOptions) {
|
|
149
|
+
await container.addEmitter?.({
|
|
150
|
+
startCount: actualOptions.count,
|
|
151
|
+
position: {
|
|
152
|
+
x: actualOptions.position.x,
|
|
153
|
+
y: emitterTop,
|
|
154
|
+
},
|
|
155
|
+
shape: {
|
|
156
|
+
type: "square",
|
|
157
|
+
},
|
|
158
|
+
size: {
|
|
159
|
+
width: actualOptions.emitterSize.width,
|
|
160
|
+
height: actualOptions.emitterSize.height,
|
|
161
|
+
},
|
|
162
|
+
rate: {
|
|
163
|
+
delay: 0,
|
|
164
|
+
quantity: 0,
|
|
165
|
+
},
|
|
166
|
+
life: {
|
|
167
|
+
duration: 0.1,
|
|
168
|
+
count: 1,
|
|
169
|
+
},
|
|
170
|
+
particles: {
|
|
171
|
+
paint: {
|
|
172
|
+
fill: {
|
|
173
|
+
color: {
|
|
174
|
+
value: actualOptions.colors,
|
|
175
|
+
},
|
|
176
|
+
enable: true,
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
shape: {
|
|
180
|
+
type: "ribbon",
|
|
181
|
+
options: {
|
|
182
|
+
ribbon: actualOptions.ribbonOptions,
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
life: {
|
|
186
|
+
count: 1,
|
|
187
|
+
},
|
|
188
|
+
size: {
|
|
189
|
+
value: sizeFactor * actualOptions.scalar,
|
|
190
|
+
},
|
|
191
|
+
move: {
|
|
192
|
+
direction: "bottom",
|
|
193
|
+
enable: true,
|
|
194
|
+
outModes: {
|
|
195
|
+
top: "none",
|
|
196
|
+
default: "destroy",
|
|
197
|
+
},
|
|
198
|
+
speed: {
|
|
199
|
+
min: 4,
|
|
200
|
+
max: 6,
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
roll: {
|
|
204
|
+
enable: false,
|
|
205
|
+
},
|
|
206
|
+
rotate: {
|
|
207
|
+
value: 0,
|
|
208
|
+
move: false,
|
|
209
|
+
animation: {
|
|
210
|
+
enable: false,
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
tilt: {
|
|
214
|
+
enable: false,
|
|
215
|
+
},
|
|
216
|
+
wobble: {
|
|
217
|
+
enable: false,
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
function convertOptions(actualOptions, params) {
|
|
223
|
+
return {
|
|
224
|
+
fullScreen: {
|
|
225
|
+
enable: !params.canvas,
|
|
226
|
+
zIndex: actualOptions.zIndex,
|
|
227
|
+
},
|
|
228
|
+
fpsLimit: 120,
|
|
229
|
+
particles: {
|
|
230
|
+
number: {
|
|
231
|
+
value: 0,
|
|
232
|
+
},
|
|
233
|
+
paint: {
|
|
234
|
+
fill: {
|
|
235
|
+
color: {
|
|
236
|
+
value: actualOptions.colors,
|
|
237
|
+
},
|
|
238
|
+
enable: true,
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
shape: {
|
|
242
|
+
type: "ribbon",
|
|
243
|
+
options: {
|
|
244
|
+
ribbon: actualOptions.ribbonOptions,
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
size: {
|
|
248
|
+
value: sizeFactor * actualOptions.scalar,
|
|
249
|
+
},
|
|
250
|
+
links: {
|
|
251
|
+
enable: false,
|
|
252
|
+
},
|
|
253
|
+
life: {
|
|
254
|
+
count: 1,
|
|
255
|
+
},
|
|
256
|
+
move: {
|
|
257
|
+
direction: "bottom",
|
|
258
|
+
enable: true,
|
|
259
|
+
outModes: {
|
|
260
|
+
top: "none",
|
|
261
|
+
default: "destroy",
|
|
262
|
+
},
|
|
263
|
+
speed: {
|
|
264
|
+
min: 4,
|
|
265
|
+
max: 6,
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
roll: {
|
|
269
|
+
enable: false,
|
|
270
|
+
},
|
|
271
|
+
rotate: {
|
|
272
|
+
value: 0,
|
|
273
|
+
move: false,
|
|
274
|
+
animation: {
|
|
275
|
+
enable: false,
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
tilt: {
|
|
279
|
+
enable: false,
|
|
280
|
+
},
|
|
281
|
+
wobble: {
|
|
282
|
+
enable: false,
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
motion: {
|
|
286
|
+
disable: actualOptions.disableForReducedMotion,
|
|
287
|
+
},
|
|
288
|
+
emitters: {
|
|
289
|
+
name: "ribbons",
|
|
290
|
+
startCount: actualOptions.count,
|
|
291
|
+
position: {
|
|
292
|
+
x: actualOptions.position.x,
|
|
293
|
+
y: emitterTop,
|
|
294
|
+
},
|
|
295
|
+
shape: {
|
|
296
|
+
type: "square",
|
|
297
|
+
},
|
|
298
|
+
size: {
|
|
299
|
+
width: actualOptions.emitterSize.width,
|
|
300
|
+
height: actualOptions.emitterSize.height,
|
|
301
|
+
},
|
|
302
|
+
rate: {
|
|
303
|
+
delay: 0,
|
|
304
|
+
quantity: 0,
|
|
305
|
+
},
|
|
306
|
+
life: {
|
|
307
|
+
duration: 0.1,
|
|
308
|
+
count: 1,
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
async function setRibbons(engine, params) {
|
|
314
|
+
const actualOptions = new RibbonsOptions();
|
|
315
|
+
actualOptions.load(params.options);
|
|
316
|
+
let containerOrPromise = ids.get(params.id);
|
|
317
|
+
if (containerOrPromise instanceof Promise) {
|
|
318
|
+
await containerOrPromise;
|
|
319
|
+
containerOrPromise = ids.get(params.id);
|
|
320
|
+
}
|
|
321
|
+
const container = containerOrPromise;
|
|
322
|
+
if (container && !container.destroyed) {
|
|
323
|
+
const alias = container;
|
|
324
|
+
if ("addEmitter" in alias) {
|
|
325
|
+
await addEmitter(alias, actualOptions);
|
|
326
|
+
return container;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
const create = async () => {
|
|
330
|
+
const particlesOptions = convertOptions(actualOptions, params), newContainer = await engine.load({
|
|
331
|
+
id: params.id,
|
|
332
|
+
element: params.canvas,
|
|
333
|
+
options: particlesOptions,
|
|
334
|
+
});
|
|
335
|
+
ids.set(params.id, newContainer);
|
|
336
|
+
return newContainer;
|
|
337
|
+
}, createPromise = create();
|
|
338
|
+
ids.set(params.id, createPromise);
|
|
339
|
+
return createPromise;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
let initPromise = null;
|
|
343
|
+
async function doInitPlugins(engine) {
|
|
344
|
+
engine.checkVersion("4.0.5");
|
|
345
|
+
await engine.pluginManager.register(async (e) => {
|
|
346
|
+
const emittersRegister = async (engine) => {
|
|
347
|
+
await plugin.loadEmittersPluginSimple(engine);
|
|
348
|
+
await pluginEmittersShapeSquare.loadEmittersShapeSquare(engine);
|
|
349
|
+
};
|
|
350
|
+
await Promise.all([
|
|
351
|
+
basic.loadBasic(e),
|
|
352
|
+
pluginMotion.loadMotionPlugin(e),
|
|
353
|
+
emittersRegister(e),
|
|
354
|
+
shapeRibbon.loadRibbonShape(e),
|
|
355
|
+
updaterLife.loadLifeUpdater(e),
|
|
356
|
+
]);
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
async function initPlugins(engine) {
|
|
360
|
+
if (initPromise) {
|
|
361
|
+
return initPromise;
|
|
362
|
+
}
|
|
363
|
+
initPromise = doInitPlugins(engine);
|
|
364
|
+
return initPromise;
|
|
365
|
+
}
|
|
366
|
+
async function ribbons(idOrOptions, ribbonsOptions) {
|
|
367
|
+
await initPlugins(engine.tsParticles);
|
|
368
|
+
let options, id;
|
|
369
|
+
if (engine.isString(idOrOptions)) {
|
|
370
|
+
id = idOrOptions;
|
|
371
|
+
options = ribbonsOptions ?? {};
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
id = "ribbons";
|
|
375
|
+
options = idOrOptions ?? {};
|
|
376
|
+
}
|
|
377
|
+
return setRibbons(engine.tsParticles, {
|
|
378
|
+
id,
|
|
379
|
+
options,
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
ribbons.create = async (canvas, options = {}) => {
|
|
383
|
+
await initPlugins(engine.tsParticles);
|
|
384
|
+
const id = canvas?.getAttribute("id") ?? "ribbons";
|
|
385
|
+
canvas?.setAttribute("id", id);
|
|
386
|
+
await setRibbons(engine.tsParticles, {
|
|
387
|
+
id,
|
|
388
|
+
canvas: canvas ?? undefined,
|
|
389
|
+
options,
|
|
390
|
+
});
|
|
391
|
+
return async (idOrOptions, subRibbonsOptions) => {
|
|
392
|
+
let subOptions, subId;
|
|
393
|
+
if (engine.isString(idOrOptions)) {
|
|
394
|
+
subId = idOrOptions;
|
|
395
|
+
subOptions = subRibbonsOptions ?? options;
|
|
396
|
+
}
|
|
397
|
+
else {
|
|
398
|
+
subId = id;
|
|
399
|
+
subOptions = idOrOptions ?? {};
|
|
400
|
+
}
|
|
401
|
+
return setRibbons(engine.tsParticles, {
|
|
402
|
+
id: subId,
|
|
403
|
+
canvas: canvas ?? undefined,
|
|
404
|
+
options: subOptions,
|
|
405
|
+
});
|
|
406
|
+
};
|
|
407
|
+
};
|
|
408
|
+
ribbons.init = async () => {
|
|
409
|
+
await initPlugins(engine.tsParticles);
|
|
410
|
+
};
|
|
411
|
+
ribbons.version = "4.0.5";
|
|
412
|
+
globalThis.ribbons = ribbons;
|
|
413
|
+
|
|
414
|
+
const globalObject = globalThis;
|
|
415
|
+
globalObject.ribbons = ribbons;
|
|
416
|
+
|
|
417
|
+
exports.ribbons = ribbons;
|
|
418
|
+
|
|
419
|
+
}));
|
|
420
|
+
globalThis.__tsParticlesInternals = globalThis.__tsParticlesInternals || {};
|
|
421
|
+
if (!globalThis.__tsParticlesInternals.engine || !globalThis.__tsParticlesInternals.engine.tsParticles) {
|
|
422
|
+
globalThis.__tsParticlesInternals.engine = globalThis.__tsParticlesInternals.bundles.ribbons || {};
|
|
423
|
+
}
|
|
424
|
+
delete (globalThis.window || globalThis).tsparticlesInternalExports;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(t){t.__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.bundles=t.__tsParticlesInternals.bundles||{},t.__tsParticlesInternals.effects=t.__tsParticlesInternals.effects||{},t.__tsParticlesInternals.engine=t.__tsParticlesInternals.engine||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},t.__tsParticlesInternals.palettes=t.__tsParticlesInternals.palettes||{},t.__tsParticlesInternals.paths=t.__tsParticlesInternals.paths||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins.emittersShapes=t.__tsParticlesInternals.plugins.emittersShapes||{},t.__tsParticlesInternals.presets=t.__tsParticlesInternals.presets||{},t.__tsParticlesInternals.shapes=t.__tsParticlesInternals.shapes||{},t.__tsParticlesInternals.updaters=t.__tsParticlesInternals.updaters||{},t.__tsParticlesInternals.utils=t.__tsParticlesInternals.utils||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas.utils=t.__tsParticlesInternals.canvas.utils||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path.utils=t.__tsParticlesInternals.path.utils||{};var s="undefined"!=typeof Proxy?function(t){return new Proxy(t,{get:function(t,s){return s in t||(t[s]={}),t[s]}})}:function(t){return t};t.__tsParticlesInternals.bundles=s(t.__tsParticlesInternals.bundles),t.__tsParticlesInternals.effects=s(t.__tsParticlesInternals.effects),t.__tsParticlesInternals.interactions=s(t.__tsParticlesInternals.interactions),t.__tsParticlesInternals.palettes=s(t.__tsParticlesInternals.palettes),t.__tsParticlesInternals.paths=s(t.__tsParticlesInternals.paths),t.__tsParticlesInternals.plugins=s(t.__tsParticlesInternals.plugins),t.__tsParticlesInternals.plugins.emittersShapes=s(t.__tsParticlesInternals.plugins.emittersShapes),t.__tsParticlesInternals.presets=s(t.__tsParticlesInternals.presets),t.__tsParticlesInternals.shapes=s(t.__tsParticlesInternals.shapes),t.__tsParticlesInternals.updaters=s(t.__tsParticlesInternals.updaters),t.__tsParticlesInternals.utils=s(t.__tsParticlesInternals.utils),t.__tsParticlesInternals.canvas=s(t.__tsParticlesInternals.canvas),t.__tsParticlesInternals.path=s(t.__tsParticlesInternals.path),t.tsparticlesInternalExports=t.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(t,s){"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("@tsparticles/engine"),require("@tsparticles/basic"),require("@tsparticles/plugin-emitters/plugin"),require("@tsparticles/plugin-emitters-shape-square"),require("@tsparticles/updater-life"),require("@tsparticles/plugin-motion"),require("@tsparticles/shape-ribbon")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/engine","@tsparticles/basic","@tsparticles/plugin-emitters/plugin","@tsparticles/plugin-emitters-shape-square","@tsparticles/updater-life","@tsparticles/plugin-motion","@tsparticles/shape-ribbon"],s):s(((t="undefined"!=typeof globalThis?globalThis:t||self).__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.bundles=t.__tsParticlesInternals.bundles||{},t.__tsParticlesInternals.bundles.ribbons=t.__tsParticlesInternals.bundles.ribbons||{}),t.__tsParticlesInternals.engine,t.__tsParticlesInternals.bundles.basic,t.__tsParticlesInternals.plugins["emitters/plugin"],t.__tsParticlesInternals.plugins.emittersShapes.square,t.__tsParticlesInternals.updaters.life,t.__tsParticlesInternals.plugins.motion,t.__tsParticlesInternals.shapes.ribbon)}(this,function(t,s,e,i,n,a,r,l){"use strict";class o{angle;colors;count;disableForReducedMotion;drift;emitterSize;position;ribbonOptions;scalar;spread;ticks;zIndex;constructor(){this.angle=90,this.count=5,this.spread=0,this.drift=0,this.emitterSize={width:100,height:0},this.ticks=200,this.position={x:50,y:0},this.colors=["#FF0055","#00D1FF","#FFD23F","#61FF7E","#B284FF"],this.ribbonOptions={angle:45,darken:{enable:!0,value:30},count:60,drag:.02,mass:1,oscillationDistance:{min:100,max:140},oscillationSpeed:{min:3,max:5},particleDist:8,velocityInherit:{min:4,max:6}},this.scalar=1,this.zIndex=100,this.disableForReducedMotion=!0}get origin(){return{x:this.position.x/s.percentDenominator,y:this.position.y/s.percentDenominator}}set origin(t){this.position.x=t.x*s.percentDenominator,this.position.y=t.y*s.percentDenominator}get particleCount(){return this.count}set particleCount(t){this.count=t}load(t){if(s.isNull(t))return;void 0!==t.angle&&(this.angle=t.angle);const e=t.count??t.particleCount;void 0!==e&&(this.count=e),void 0!==t.spread&&(this.spread=t.spread),void 0!==t.drift&&(this.drift=t.drift),void 0!==t.ticks&&(this.ticks=t.ticks),t.emitterSize&&(void 0!==t.emitterSize.width&&(this.emitterSize.width=t.emitterSize.width),void 0!==t.emitterSize.height&&(this.emitterSize.height=t.emitterSize.height));const i=t.origin;i&&!t.position&&(t.position={x:void 0===i.x?void 0:i.x*s.percentDenominator,y:void 0===i.y?void 0:i.y*s.percentDenominator});const n=t.position;n&&(void 0!==n.x&&(this.position.x=n.x),void 0!==n.y&&(this.position.y=n.y)),void 0!==t.colors&&(s.isArray(t.colors)?this.colors=[...t.colors]:this.colors=t.colors),void 0!==t.ribbonOptions&&(this.ribbonOptions=s.deepExtend({},t.ribbonOptions)),void 0!==t.scalar&&(this.scalar=t.scalar),void 0!==t.zIndex&&(this.zIndex=t.zIndex),void 0!==t.disableForReducedMotion&&(this.disableForReducedMotion=t.disableForReducedMotion)}}const c=new Map;async function _(t,s){const e=new o;e.load(s.options);let i=c.get(s.id);i instanceof Promise&&(await i,i=c.get(s.id));const n=i;if(n&&!n.destroyed){const t=n;if("addEmitter"in t)return await async function(t,s){await(t.addEmitter?.({startCount:s.count,position:{x:s.position.x,y:0},shape:{type:"square"},size:{width:s.emitterSize.width,height:s.emitterSize.height},rate:{delay:0,quantity:0},life:{duration:.1,count:1},particles:{paint:{fill:{color:{value:s.colors},enable:!0}},shape:{type:"ribbon",options:{ribbon:s.ribbonOptions}},life:{count:1},size:{value:8*s.scalar},move:{direction:"bottom",enable:!0,outModes:{top:"none",default:"destroy"},speed:{min:4,max:6}},roll:{enable:!1},rotate:{value:0,move:!1,animation:{enable:!1}},tilt:{enable:!1},wobble:{enable:!1}}}))}(t,e),n}const a=(async()=>{const i=function(t,s){return{fullScreen:{enable:!s.canvas,zIndex:t.zIndex},fpsLimit:120,particles:{number:{value:0},paint:{fill:{color:{value:t.colors},enable:!0}},shape:{type:"ribbon",options:{ribbon:t.ribbonOptions}},size:{value:8*t.scalar},links:{enable:!1},life:{count:1},move:{direction:"bottom",enable:!0,outModes:{top:"none",default:"destroy"},speed:{min:4,max:6}},roll:{enable:!1},rotate:{value:0,move:!1,animation:{enable:!1}},tilt:{enable:!1},wobble:{enable:!1}},motion:{disable:t.disableForReducedMotion},emitters:{name:"ribbons",startCount:t.count,position:{x:t.position.x,y:0},shape:{type:"square"},size:{width:t.emitterSize.width,height:t.emitterSize.height},rate:{delay:0,quantity:0},life:{duration:.1,count:1}}}}(e,s),n=await t.load({id:s.id,element:s.canvas,options:i});return c.set(s.id,n),n})();return c.set(s.id,a),a}let p=null;async function d(t){return p||(p=async function(t){t.checkVersion("4.0.5"),await t.pluginManager.register(async t=>{await Promise.all([e.loadBasic(t),r.loadMotionPlugin(t),(async t=>{await i.loadEmittersPluginSimple(t),await n.loadEmittersShapeSquare(t)})(t),l.loadRibbonShape(t),a.loadLifeUpdater(t)])})}(t),p)}async function u(t,e){let i,n;return await d(s.tsParticles),s.isString(t)?(n=t,i=e??{}):(n="ribbons",i=t??{}),_(s.tsParticles,{id:n,options:i})}u.create=async(t,e={})=>{await d(s.tsParticles);const i=t?.getAttribute("id")??"ribbons";return t?.setAttribute("id",i),await _(s.tsParticles,{id:i,canvas:t??void 0,options:e}),async(n,a)=>{let r,l;return s.isString(n)?(l=n,r=a??e):(l=i,r=n??{}),_(s.tsParticles,{id:l,canvas:t??void 0,options:r})}},u.init=async()=>{await d(s.tsParticles)},u.version="4.0.5",globalThis.ribbons=u;globalThis.ribbons=u,t.ribbons=u}),globalThis.__tsParticlesInternals=globalThis.__tsParticlesInternals||{},globalThis.__tsParticlesInternals.engine&&globalThis.__tsParticlesInternals.engine.tsParticles||(globalThis.__tsParticlesInternals.engine=globalThis.__tsParticlesInternals.bundles.ribbons||{}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ICoordinates, IDimension, IShapeValues, SingleOrMultiple } from "@tsparticles/engine";
|
|
2
|
+
export interface IRibbonsOptions {
|
|
3
|
+
angle: number;
|
|
4
|
+
colors: SingleOrMultiple<string>;
|
|
5
|
+
count: number;
|
|
6
|
+
disableForReducedMotion: boolean;
|
|
7
|
+
drift: number;
|
|
8
|
+
emitterSize: IDimension;
|
|
9
|
+
origin: ICoordinates;
|
|
10
|
+
particleCount: number;
|
|
11
|
+
position: ICoordinates;
|
|
12
|
+
ribbonOptions: SingleOrMultiple<IShapeValues>;
|
|
13
|
+
scalar: number;
|
|
14
|
+
spread: number;
|
|
15
|
+
ticks: number;
|
|
16
|
+
zIndex: number;
|
|
17
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ICoordinates, type IDimension, type IOptionLoader, type IShapeValues, type RecursivePartial, type SingleOrMultiple } from "@tsparticles/engine";
|
|
2
|
+
import type { IRibbonsOptions } from "./IRibbonsOptions.js";
|
|
3
|
+
export declare class RibbonsOptions implements IRibbonsOptions, IOptionLoader<IRibbonsOptions> {
|
|
4
|
+
angle: number;
|
|
5
|
+
colors: SingleOrMultiple<string>;
|
|
6
|
+
count: number;
|
|
7
|
+
disableForReducedMotion: boolean;
|
|
8
|
+
drift: number;
|
|
9
|
+
emitterSize: IDimension;
|
|
10
|
+
position: ICoordinates;
|
|
11
|
+
ribbonOptions: SingleOrMultiple<IShapeValues>;
|
|
12
|
+
scalar: number;
|
|
13
|
+
spread: number;
|
|
14
|
+
ticks: number;
|
|
15
|
+
zIndex: number;
|
|
16
|
+
constructor();
|
|
17
|
+
get origin(): ICoordinates;
|
|
18
|
+
set origin(value: ICoordinates);
|
|
19
|
+
get particleCount(): number;
|
|
20
|
+
set particleCount(value: number);
|
|
21
|
+
load(data?: RecursivePartial<IRibbonsOptions>): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./index.js";
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IRibbonsOptions } from "./IRibbonsOptions.js";
|
|
2
|
+
import type { RecursivePartial } from "@tsparticles/engine/lazy";
|
|
3
|
+
export type RibbonsOptions = RecursivePartial<IRibbonsOptions>;
|
|
4
|
+
export * from "./ribbons.lazy.js";
|
|
5
|
+
export type * from "./RibbonsParams.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Container, type RecursivePartial } from "@tsparticles/engine";
|
|
2
|
+
import type { RibbonsFirstParam, RibbonsFunc } from "./types.js";
|
|
3
|
+
import type { IRibbonsOptions } from "./IRibbonsOptions.js";
|
|
4
|
+
declare global {
|
|
5
|
+
var ribbons: RibbonsFunc & {
|
|
6
|
+
create: (canvas?: HTMLCanvasElement | null, options?: RecursivePartial<IRibbonsOptions>) => Promise<RibbonsFunc>;
|
|
7
|
+
init: () => Promise<void>;
|
|
8
|
+
version: string;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export declare function ribbons(idOrOptions?: RibbonsFirstParam, ribbonsOptions?: RecursivePartial<IRibbonsOptions>): Promise<Container | undefined>;
|
|
12
|
+
export declare namespace ribbons {
|
|
13
|
+
var create: (canvas?: HTMLCanvasElement | null, options?: RecursivePartial<IRibbonsOptions>) => Promise<RibbonsFunc>;
|
|
14
|
+
var init: () => Promise<void>;
|
|
15
|
+
var version: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Container, type RecursivePartial } from "@tsparticles/engine/lazy";
|
|
2
|
+
import type { RibbonsFirstParam, RibbonsFunc } from "./types.js";
|
|
3
|
+
import type { IRibbonsOptions } from "./IRibbonsOptions.js";
|
|
4
|
+
declare global {
|
|
5
|
+
var ribbons: RibbonsFunc & {
|
|
6
|
+
create: (canvas?: HTMLCanvasElement | null, options?: RecursivePartial<IRibbonsOptions>) => Promise<RibbonsFunc>;
|
|
7
|
+
init: () => Promise<void>;
|
|
8
|
+
version: string;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export declare function ribbons(idOrOptions?: RibbonsFirstParam, ribbonsOptions?: RecursivePartial<IRibbonsOptions>): Promise<Container | undefined>;
|
|
12
|
+
export declare namespace ribbons {
|
|
13
|
+
var create: (canvas?: HTMLCanvasElement | null, options?: RecursivePartial<IRibbonsOptions>) => Promise<RibbonsFunc>;
|
|
14
|
+
var init: () => Promise<void>;
|
|
15
|
+
var version: string;
|
|
16
|
+
}
|
package/types/types.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Container, RecursivePartial } from "@tsparticles/engine";
|
|
2
|
+
import type { IRibbonsOptions } from "./IRibbonsOptions.js";
|
|
3
|
+
export type RibbonsFirstParam = string | RecursivePartial<IRibbonsOptions>;
|
|
4
|
+
export type RibbonsFunc = (idOrOptions?: RibbonsFirstParam, ribbonsOptions?: RecursivePartial<IRibbonsOptions>) => Promise<Container | undefined>;
|
package/types/utils.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Container, type Engine, type ISourceOptions } from "@tsparticles/engine";
|
|
2
|
+
import type { EmitterContainer } from "@tsparticles/plugin-emitters";
|
|
3
|
+
import { RibbonsOptions } from "./RibbonsOptions.js";
|
|
4
|
+
import type { RibbonsParams } from "./RibbonsParams.js";
|
|
5
|
+
export declare function addEmitter(container: EmitterContainer, actualOptions: RibbonsOptions): Promise<void>;
|
|
6
|
+
export declare function convertOptions(actualOptions: RibbonsOptions, params: RibbonsParams): ISourceOptions;
|
|
7
|
+
export declare function setRibbons(engine: Engine, params: RibbonsParams): Promise<Container | undefined>;
|