@tsparticles/preset-squares 3.0.2 → 3.1.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 +10 -6
- package/browser/bundle.js +0 -1
- package/browser/index.js +2 -1
- package/browser/options.js +4 -3
- package/cjs/bundle.js +0 -1
- package/cjs/index.js +2 -1
- package/cjs/options.js +4 -3
- package/esm/bundle.js +0 -1
- package/esm/index.js +2 -1
- package/esm/options.js +4 -3
- package/package.json +7 -7
- package/report.html +2 -2
- package/tsparticles.preset.squares.bundle.js +1548 -1039
- package/tsparticles.preset.squares.bundle.min.js +1 -1
- package/tsparticles.preset.squares.bundle.min.js.LICENSE.txt +1 -1
- package/tsparticles.preset.squares.js +35 -52
- package/tsparticles.preset.squares.min.js +1 -1
- package/tsparticles.preset.squares.min.js.LICENSE.txt +1 -1
- package/umd/bundle.js +0 -1
- package/umd/index.js +2 -1
- package/umd/options.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
|
|
7
|
+
* v3.1.0
|
|
8
8
|
*/
|
|
9
9
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
10
10
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -126,7 +126,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
126
126
|
var plugin_emitters_root_window_ = __webpack_require__(68);
|
|
127
127
|
// EXTERNAL MODULE: external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"}
|
|
128
128
|
var engine_root_window_ = __webpack_require__(533);
|
|
129
|
-
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@tsparticles+updater-rotate@3.0
|
|
129
|
+
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@tsparticles+updater-rotate@3.4.0/node_modules/@tsparticles/updater-rotate/browser/Options/Classes/RotateAnimation.js
|
|
130
130
|
|
|
131
131
|
class RotateAnimation {
|
|
132
132
|
constructor() {
|
|
@@ -154,14 +154,14 @@ class RotateAnimation {
|
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@tsparticles+updater-rotate@3.0
|
|
157
|
+
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@tsparticles+updater-rotate@3.4.0/node_modules/@tsparticles/updater-rotate/browser/Options/Classes/Rotate.js
|
|
158
158
|
|
|
159
159
|
|
|
160
160
|
class Rotate extends engine_root_window_.ValueWithRandom {
|
|
161
161
|
constructor() {
|
|
162
162
|
super();
|
|
163
163
|
this.animation = new RotateAnimation();
|
|
164
|
-
this.direction =
|
|
164
|
+
this.direction = engine_root_window_.RotateDirection.clockwise;
|
|
165
165
|
this.path = false;
|
|
166
166
|
this.value = 0;
|
|
167
167
|
}
|
|
@@ -180,37 +180,10 @@ class Rotate extends engine_root_window_.ValueWithRandom {
|
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@tsparticles+updater-rotate@3.0
|
|
183
|
+
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@tsparticles+updater-rotate@3.4.0/node_modules/@tsparticles/updater-rotate/browser/RotateUpdater.js
|
|
184
184
|
|
|
185
185
|
|
|
186
|
-
|
|
187
|
-
const rotate = particle.rotate, rotateOptions = particle.options.rotate;
|
|
188
|
-
if (!rotate || !rotateOptions) {
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
const rotateAnimation = rotateOptions.animation, speed = (rotate.velocity ?? 0) * delta.factor, max = 2 * Math.PI, decay = rotate.decay ?? 1;
|
|
192
|
-
if (!rotateAnimation.enable) {
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
switch (rotate.status) {
|
|
196
|
-
case "increasing":
|
|
197
|
-
rotate.value += speed;
|
|
198
|
-
if (rotate.value > max) {
|
|
199
|
-
rotate.value -= max;
|
|
200
|
-
}
|
|
201
|
-
break;
|
|
202
|
-
case "decreasing":
|
|
203
|
-
default:
|
|
204
|
-
rotate.value -= speed;
|
|
205
|
-
if (rotate.value < 0) {
|
|
206
|
-
rotate.value += max;
|
|
207
|
-
}
|
|
208
|
-
break;
|
|
209
|
-
}
|
|
210
|
-
if (rotate.velocity && decay !== 1) {
|
|
211
|
-
rotate.velocity *= decay;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
186
|
+
const RotateUpdater_double = 2, doublePI = Math.PI * RotateUpdater_double, identity = 1, doublePIDeg = 360;
|
|
214
187
|
class RotateUpdater {
|
|
215
188
|
constructor(container) {
|
|
216
189
|
this.container = container;
|
|
@@ -222,28 +195,30 @@ class RotateUpdater {
|
|
|
222
195
|
}
|
|
223
196
|
particle.rotate = {
|
|
224
197
|
enable: rotateOptions.animation.enable,
|
|
225
|
-
value: ((0,engine_root_window_.getRangeValue)(rotateOptions.value)
|
|
198
|
+
value: (0,engine_root_window_.degToRad)((0,engine_root_window_.getRangeValue)(rotateOptions.value)),
|
|
199
|
+
min: 0,
|
|
200
|
+
max: doublePI,
|
|
226
201
|
};
|
|
227
202
|
particle.pathRotation = rotateOptions.path;
|
|
228
203
|
let rotateDirection = rotateOptions.direction;
|
|
229
|
-
if (rotateDirection ===
|
|
230
|
-
const index = Math.floor((0,engine_root_window_.getRandom)() *
|
|
231
|
-
rotateDirection = index >
|
|
204
|
+
if (rotateDirection === engine_root_window_.RotateDirection.random) {
|
|
205
|
+
const index = Math.floor((0,engine_root_window_.getRandom)() * RotateUpdater_double), minIndex = 0;
|
|
206
|
+
rotateDirection = index > minIndex ? engine_root_window_.RotateDirection.counterClockwise : engine_root_window_.RotateDirection.clockwise;
|
|
232
207
|
}
|
|
233
208
|
switch (rotateDirection) {
|
|
234
|
-
case
|
|
209
|
+
case engine_root_window_.RotateDirection.counterClockwise:
|
|
235
210
|
case "counterClockwise":
|
|
236
|
-
particle.rotate.status =
|
|
211
|
+
particle.rotate.status = engine_root_window_.AnimationStatus.decreasing;
|
|
237
212
|
break;
|
|
238
|
-
case
|
|
239
|
-
particle.rotate.status =
|
|
213
|
+
case engine_root_window_.RotateDirection.clockwise:
|
|
214
|
+
particle.rotate.status = engine_root_window_.AnimationStatus.increasing;
|
|
240
215
|
break;
|
|
241
216
|
}
|
|
242
217
|
const rotateAnimation = rotateOptions.animation;
|
|
243
218
|
if (rotateAnimation.enable) {
|
|
244
|
-
particle.rotate.decay =
|
|
219
|
+
particle.rotate.decay = identity - (0,engine_root_window_.getRangeValue)(rotateAnimation.decay);
|
|
245
220
|
particle.rotate.velocity =
|
|
246
|
-
((0,engine_root_window_.getRangeValue)(rotateAnimation.speed) /
|
|
221
|
+
((0,engine_root_window_.getRangeValue)(rotateAnimation.speed) / doublePIDeg) * this.container.retina.reduceFactor;
|
|
247
222
|
if (!rotateAnimation.sync) {
|
|
248
223
|
particle.rotate.velocity *= (0,engine_root_window_.getRandom)();
|
|
249
224
|
}
|
|
@@ -255,7 +230,7 @@ class RotateUpdater {
|
|
|
255
230
|
if (!rotate) {
|
|
256
231
|
return false;
|
|
257
232
|
}
|
|
258
|
-
return !particle.destroyed && !particle.spawning && rotate.animation.enable
|
|
233
|
+
return !particle.destroyed && !particle.spawning && (!!rotate.value || rotate.animation.enable || rotate.path);
|
|
259
234
|
}
|
|
260
235
|
loadOptions(options, ...sources) {
|
|
261
236
|
if (!options.rotate) {
|
|
@@ -269,15 +244,21 @@ class RotateUpdater {
|
|
|
269
244
|
if (!this.isEnabled(particle)) {
|
|
270
245
|
return;
|
|
271
246
|
}
|
|
272
|
-
|
|
273
|
-
|
|
247
|
+
particle.isRotating = !!particle.rotate;
|
|
248
|
+
if (!particle.rotate) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
(0,engine_root_window_.updateAnimation)(particle, particle.rotate, false, engine_root_window_.DestroyType.none, delta);
|
|
252
|
+
particle.rotation = particle.rotate.value;
|
|
274
253
|
}
|
|
275
254
|
}
|
|
276
255
|
|
|
277
|
-
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@tsparticles+updater-rotate@3.0
|
|
256
|
+
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@tsparticles+updater-rotate@3.4.0/node_modules/@tsparticles/updater-rotate/browser/index.js
|
|
278
257
|
|
|
279
258
|
async function loadRotateUpdater(engine, refresh = true) {
|
|
280
|
-
await engine.addParticleUpdater("rotate",
|
|
259
|
+
await engine.addParticleUpdater("rotate", container => {
|
|
260
|
+
return Promise.resolve(new RotateUpdater(container));
|
|
261
|
+
}, refresh);
|
|
281
262
|
}
|
|
282
263
|
|
|
283
264
|
// EXTERNAL MODULE: external {"commonjs":"@tsparticles/updater-size","commonjs2":"@tsparticles/updater-size","amd":"@tsparticles/updater-size","root":"window"}
|
|
@@ -287,6 +268,7 @@ var shape_square_root_window_ = __webpack_require__(652);
|
|
|
287
268
|
// EXTERNAL MODULE: external {"commonjs":"@tsparticles/updater-stroke-color","commonjs2":"@tsparticles/updater-stroke-color","amd":"@tsparticles/updater-stroke-color","root":"window"}
|
|
288
269
|
var updater_stroke_color_root_window_ = __webpack_require__(204);
|
|
289
270
|
;// CONCATENATED MODULE: ./dist/browser/options.js
|
|
271
|
+
|
|
290
272
|
const options = {
|
|
291
273
|
particles: {
|
|
292
274
|
stroke: {
|
|
@@ -305,7 +287,7 @@ const options = {
|
|
|
305
287
|
},
|
|
306
288
|
rotate: {
|
|
307
289
|
value: 0,
|
|
308
|
-
direction:
|
|
290
|
+
direction: engine_root_window_.RotateDirection.counterClockwise,
|
|
309
291
|
animation: {
|
|
310
292
|
enable: true,
|
|
311
293
|
speed: 2,
|
|
@@ -319,10 +301,10 @@ const options = {
|
|
|
319
301
|
},
|
|
320
302
|
animation: {
|
|
321
303
|
enable: true,
|
|
322
|
-
startValue:
|
|
304
|
+
startValue: engine_root_window_.StartValueType.min,
|
|
323
305
|
speed: 60,
|
|
324
306
|
sync: true,
|
|
325
|
-
destroy:
|
|
307
|
+
destroy: engine_root_window_.DestroyType.max
|
|
326
308
|
}
|
|
327
309
|
}
|
|
328
310
|
},
|
|
@@ -353,7 +335,8 @@ async function loadSquaresPreset(engine, refresh = true) {
|
|
|
353
335
|
await loadRotateUpdater(engine, false);
|
|
354
336
|
await (0,updater_size_root_window_.loadSizeUpdater)(engine, false);
|
|
355
337
|
await (0,updater_stroke_color_root_window_.loadStrokeColorUpdater)(engine, false);
|
|
356
|
-
await engine.addPreset("squares", options,
|
|
338
|
+
await engine.addPreset("squares", options, false);
|
|
339
|
+
await engine.refresh(refresh);
|
|
357
340
|
}
|
|
358
341
|
})();
|
|
359
342
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.preset.squares.min.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/plugin-emitters"),require("@tsparticles/engine"),require("@tsparticles/updater-size"),require("@tsparticles/shape-square"),require("@tsparticles/updater-stroke-color"));else if("function"==typeof define&&define.amd)define(["@tsparticles/plugin-emitters","@tsparticles/engine","@tsparticles/updater-size","@tsparticles/shape-square","@tsparticles/updater-stroke-color"],t);else{var a="object"==typeof exports?t(require("@tsparticles/plugin-emitters"),require("@tsparticles/engine"),require("@tsparticles/updater-size"),require("@tsparticles/shape-square"),require("@tsparticles/updater-stroke-color")):t(e.window,e.window,e.window,e.window,e.window);for(var o in a)("object"==typeof exports?exports:e)[o]=a[o]}}(this,((e,t,a,o,
|
|
2
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/plugin-emitters"),require("@tsparticles/engine"),require("@tsparticles/updater-size"),require("@tsparticles/shape-square"),require("@tsparticles/updater-stroke-color"));else if("function"==typeof define&&define.amd)define(["@tsparticles/plugin-emitters","@tsparticles/engine","@tsparticles/updater-size","@tsparticles/shape-square","@tsparticles/updater-stroke-color"],t);else{var a="object"==typeof exports?t(require("@tsparticles/plugin-emitters"),require("@tsparticles/engine"),require("@tsparticles/updater-size"),require("@tsparticles/shape-square"),require("@tsparticles/updater-stroke-color")):t(e.window,e.window,e.window,e.window,e.window);for(var o in a)("object"==typeof exports?exports:e)[o]=a[o]}}(this,((e,t,a,o,i)=>(()=>{"use strict";var r={533:e=>{e.exports=t},68:t=>{t.exports=e},652:e=>{e.exports=o},2:e=>{e.exports=a},204:e=>{e.exports=i}},s={};function n(e){var t=s[e];if(void 0!==t)return t.exports;var a=s[e]={exports:{}};return r[e](a,a.exports,n),a.exports}n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var c={};return(()=>{n.r(c),n.d(c,{loadSquaresPreset:()=>u});var e=n(68),t=n(533);class a{constructor(){this.enable=!1,this.speed=0,this.decay=0,this.sync=!1}load(e){e&&(void 0!==e.enable&&(this.enable=e.enable),void 0!==e.speed&&(this.speed=(0,t.setRangeValue)(e.speed)),void 0!==e.decay&&(this.decay=(0,t.setRangeValue)(e.decay)),void 0!==e.sync&&(this.sync=e.sync))}}class o extends t.ValueWithRandom{constructor(){super(),this.animation=new a,this.direction=t.RotateDirection.clockwise,this.path=!1,this.value=0}load(e){e&&(super.load(e),void 0!==e.direction&&(this.direction=e.direction),this.animation.load(e.animation),void 0!==e.path&&(this.path=e.path))}}const i=2*Math.PI;class r{constructor(e){this.container=e}init(e){const a=e.options.rotate;if(!a)return;e.rotate={enable:a.animation.enable,value:(0,t.degToRad)((0,t.getRangeValue)(a.value)),min:0,max:i},e.pathRotation=a.path;let o=a.direction;if(o===t.RotateDirection.random){o=Math.floor(2*(0,t.getRandom)())>0?t.RotateDirection.counterClockwise:t.RotateDirection.clockwise}switch(o){case t.RotateDirection.counterClockwise:case"counterClockwise":e.rotate.status=t.AnimationStatus.decreasing;break;case t.RotateDirection.clockwise:e.rotate.status=t.AnimationStatus.increasing}const r=a.animation;r.enable&&(e.rotate.decay=1-(0,t.getRangeValue)(r.decay),e.rotate.velocity=(0,t.getRangeValue)(r.speed)/360*this.container.retina.reduceFactor,r.sync||(e.rotate.velocity*=(0,t.getRandom)())),e.rotation=e.rotate.value}isEnabled(e){const t=e.options.rotate;return!!t&&(!e.destroyed&&!e.spawning&&(!!t.value||t.animation.enable||t.path))}loadOptions(e,...t){e.rotate||(e.rotate=new o);for(const a of t)e.rotate.load(a?.rotate)}update(e,a){this.isEnabled(e)&&(e.isRotating=!!e.rotate,e.rotate&&((0,t.updateAnimation)(e,e.rotate,!1,t.DestroyType.none,a),e.rotation=e.rotate.value))}}var s=n(2),l=n(652),d=n(204);const p={particles:{stroke:{width:5,color:{value:["#5bc0eb","#fde74c","#9bc53d","#e55934","#fa7921","#2FF3E0","#F8D210","#FA26A0","#F51720"]}},shape:{type:"square",options:{square:{fill:!1}}},rotate:{value:0,direction:t.RotateDirection.counterClockwise,animation:{enable:!0,speed:2,sync:!0}},size:{value:{min:1,max:500},animation:{enable:!0,startValue:t.StartValueType.min,speed:60,sync:!0,destroy:t.DestroyType.max}}},background:{color:"#000"},emitters:{position:{y:50,x:50},rate:{delay:1,quantity:1}}};async function u(t,a=!0){await(0,e.loadEmittersPlugin)(t,!1),await(0,l.loadSquareShape)(t,!1),await async function(e,t=!0){await e.addParticleUpdater("rotate",(e=>Promise.resolve(new r(e))),t)}(t,!1),await(0,s.loadSizeUpdater)(t,!1),await(0,d.loadStrokeColorUpdater)(t,!1),await t.addPreset("squares",p,!1),await t.refresh(a)}})(),c})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles undefined Preset v3.0
|
|
1
|
+
/*! tsParticles undefined Preset v3.1.0 by Matteo Bruni */
|
package/umd/bundle.js
CHANGED
|
@@ -14,5 +14,4 @@
|
|
|
14
14
|
Object.defineProperty(exports, "loadSquaresPreset", { enumerable: true, get: function () { return index_js_1.loadSquaresPreset; } });
|
|
15
15
|
const engine_1 = require("@tsparticles/engine");
|
|
16
16
|
Object.defineProperty(exports, "tsParticles", { enumerable: true, get: function () { return engine_1.tsParticles; } });
|
|
17
|
-
void (0, index_js_1.loadSquaresPreset)(engine_1.tsParticles);
|
|
18
17
|
});
|
package/umd/index.js
CHANGED
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
await (0, updater_rotate_1.loadRotateUpdater)(engine, false);
|
|
23
23
|
await (0, updater_size_1.loadSizeUpdater)(engine, false);
|
|
24
24
|
await (0, updater_stroke_color_1.loadStrokeColorUpdater)(engine, false);
|
|
25
|
-
await engine.addPreset("squares", options_js_1.options,
|
|
25
|
+
await engine.addPreset("squares", options_js_1.options, false);
|
|
26
|
+
await engine.refresh(refresh);
|
|
26
27
|
}
|
|
27
28
|
exports.loadSquaresPreset = loadSquaresPreset;
|
|
28
29
|
});
|
package/umd/options.js
CHANGED
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports"], factory);
|
|
7
|
+
define(["require", "exports", "@tsparticles/engine"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.options = void 0;
|
|
13
|
+
const engine_1 = require("@tsparticles/engine");
|
|
13
14
|
exports.options = {
|
|
14
15
|
particles: {
|
|
15
16
|
stroke: {
|
|
@@ -38,7 +39,7 @@
|
|
|
38
39
|
},
|
|
39
40
|
rotate: {
|
|
40
41
|
value: 0,
|
|
41
|
-
direction:
|
|
42
|
+
direction: engine_1.RotateDirection.counterClockwise,
|
|
42
43
|
animation: {
|
|
43
44
|
enable: true,
|
|
44
45
|
speed: 2,
|
|
@@ -49,10 +50,10 @@
|
|
|
49
50
|
value: { min: 1, max: 500 },
|
|
50
51
|
animation: {
|
|
51
52
|
enable: true,
|
|
52
|
-
startValue:
|
|
53
|
+
startValue: engine_1.StartValueType.min,
|
|
53
54
|
speed: 60,
|
|
54
55
|
sync: true,
|
|
55
|
-
destroy:
|
|
56
|
+
destroy: engine_1.DestroyType.max,
|
|
56
57
|
},
|
|
57
58
|
},
|
|
58
59
|
},
|