@tsparticles/engine 4.0.0-alpha.5 → 4.0.0-beta.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/164.min.js +1 -0
- package/README.md +41 -7
- package/browser/Core/Canvas.js +250 -143
- package/browser/Core/Container.js +80 -74
- package/browser/Core/Engine.js +44 -67
- package/browser/Core/Particle.js +202 -173
- package/browser/Core/Particles.js +187 -138
- package/browser/Core/Retina.js +5 -0
- package/browser/Core/Utils/Constants.js +2 -2
- package/browser/Core/Utils/EventListeners.js +67 -63
- package/browser/Core/Utils/Ranges.js +29 -10
- package/browser/Core/Utils/SpatialHashGrid.js +102 -0
- package/browser/Core/Utils/Vectors.js +17 -18
- package/browser/Enums/Types/EasingType.js +18 -3
- package/browser/Options/Classes/AnimatableColor.js +1 -0
- package/browser/Options/Classes/AnimationOptions.js +8 -0
- package/browser/Options/Classes/Background/Background.js +6 -0
- package/browser/Options/Classes/ColorAnimation.js +12 -1
- package/browser/Options/Classes/FullScreen/FullScreen.js +2 -0
- package/browser/Options/Classes/HslAnimation.js +4 -5
- package/browser/Options/Classes/Options.js +63 -4
- package/browser/Options/Classes/OptionsColor.js +1 -0
- package/browser/Options/Classes/Particles/Bounce/ParticlesBounce.js +2 -0
- package/browser/Options/Classes/Particles/Effect/Effect.js +3 -4
- package/browser/Options/Classes/Particles/Fill.js +28 -0
- package/browser/Options/Classes/Particles/Move/Move.js +17 -3
- package/browser/Options/Classes/Particles/Move/MoveAngle.js +2 -0
- package/browser/Options/Classes/Particles/Move/MoveCenter.js +4 -0
- package/browser/Options/Classes/Particles/Move/MoveGravity.js +4 -0
- package/browser/Options/Classes/Particles/Move/OutModes.js +5 -0
- package/browser/Options/Classes/Particles/Move/Path/MovePath.js +5 -0
- package/browser/Options/Classes/Particles/Move/Spin.js +3 -0
- package/browser/Options/Classes/Particles/Number/ParticlesDensity.js +3 -0
- package/browser/Options/Classes/Particles/Number/ParticlesNumber.js +3 -0
- package/browser/Options/Classes/Particles/Number/ParticlesNumberLimit.js +2 -0
- package/browser/Options/Classes/Particles/Opacity/Opacity.js +1 -0
- package/browser/Options/Classes/Particles/Opacity/OpacityAnimation.js +1 -0
- package/browser/Options/Classes/Particles/ParticlesOptions.js +25 -5
- package/browser/Options/Classes/Particles/Shape/Shape.js +3 -4
- package/browser/Options/Classes/Particles/Size/Size.js +1 -0
- package/browser/Options/Classes/Particles/Size/SizeAnimation.js +1 -0
- package/browser/Options/Classes/Particles/Stroke.js +3 -0
- package/browser/Options/Classes/Particles/ZIndex/ZIndex.js +3 -0
- package/browser/Options/Classes/ResizeEvent.js +2 -0
- package/browser/Options/Classes/ValueWithRandom.js +3 -4
- package/browser/Utils/CanvasUtils.js +43 -62
- package/browser/Utils/ColorUtils.js +30 -19
- package/browser/Utils/EventDispatcher.js +1 -0
- package/browser/Utils/MathUtils.js +12 -7
- package/browser/Utils/Utils.js +109 -31
- package/browser/exports.js +1 -2
- package/cjs/Core/Canvas.js +250 -143
- package/cjs/Core/Container.js +80 -74
- package/cjs/Core/Engine.js +44 -67
- package/cjs/Core/Particle.js +202 -173
- package/cjs/Core/Particles.js +187 -138
- package/cjs/Core/Retina.js +5 -0
- package/cjs/Core/Utils/Constants.js +2 -2
- package/cjs/Core/Utils/EventListeners.js +67 -63
- package/cjs/Core/Utils/Ranges.js +29 -10
- package/cjs/Core/Utils/SpatialHashGrid.js +102 -0
- package/cjs/Core/Utils/Vectors.js +17 -18
- package/cjs/Enums/Types/EasingType.js +18 -3
- package/cjs/Options/Classes/AnimatableColor.js +1 -0
- package/cjs/Options/Classes/AnimationOptions.js +8 -0
- package/cjs/Options/Classes/Background/Background.js +6 -0
- package/cjs/Options/Classes/ColorAnimation.js +12 -1
- package/cjs/Options/Classes/FullScreen/FullScreen.js +2 -0
- package/cjs/Options/Classes/HslAnimation.js +4 -5
- package/cjs/Options/Classes/Options.js +63 -4
- package/cjs/Options/Classes/OptionsColor.js +1 -0
- package/cjs/Options/Classes/Particles/Bounce/ParticlesBounce.js +2 -0
- package/cjs/Options/Classes/Particles/Effect/Effect.js +3 -4
- package/cjs/Options/Classes/Particles/Fill.js +28 -0
- package/cjs/Options/Classes/Particles/Move/Move.js +17 -3
- package/cjs/Options/Classes/Particles/Move/MoveAngle.js +2 -0
- package/cjs/Options/Classes/Particles/Move/MoveCenter.js +4 -0
- package/cjs/Options/Classes/Particles/Move/MoveGravity.js +4 -0
- package/cjs/Options/Classes/Particles/Move/OutModes.js +5 -0
- package/cjs/Options/Classes/Particles/Move/Path/MovePath.js +5 -0
- package/cjs/Options/Classes/Particles/Move/Spin.js +3 -0
- package/cjs/Options/Classes/Particles/Number/ParticlesDensity.js +3 -0
- package/cjs/Options/Classes/Particles/Number/ParticlesNumber.js +3 -0
- package/cjs/Options/Classes/Particles/Number/ParticlesNumberLimit.js +2 -0
- package/cjs/Options/Classes/Particles/Opacity/Opacity.js +1 -0
- package/cjs/Options/Classes/Particles/Opacity/OpacityAnimation.js +1 -0
- package/cjs/Options/Classes/Particles/ParticlesOptions.js +25 -5
- package/cjs/Options/Classes/Particles/Shape/Shape.js +3 -4
- package/cjs/Options/Classes/Particles/Size/Size.js +1 -0
- package/cjs/Options/Classes/Particles/Size/SizeAnimation.js +1 -0
- package/cjs/Options/Classes/Particles/Stroke.js +3 -0
- package/cjs/Options/Classes/Particles/ZIndex/ZIndex.js +3 -0
- package/cjs/Options/Classes/ResizeEvent.js +2 -0
- package/cjs/Options/Classes/ValueWithRandom.js +3 -4
- package/cjs/Utils/CanvasUtils.js +43 -62
- package/cjs/Utils/ColorUtils.js +30 -19
- package/cjs/Utils/EventDispatcher.js +1 -0
- package/cjs/Utils/MathUtils.js +12 -7
- package/cjs/Utils/Utils.js +109 -31
- package/cjs/exports.js +1 -2
- package/dist_browser_Core_Container_js.js +12 -12
- package/esm/Core/Canvas.js +250 -143
- package/esm/Core/Container.js +80 -74
- package/esm/Core/Engine.js +44 -67
- package/esm/Core/Particle.js +202 -173
- package/esm/Core/Particles.js +187 -138
- package/esm/Core/Retina.js +5 -0
- package/esm/Core/Utils/Constants.js +2 -2
- package/esm/Core/Utils/EventListeners.js +67 -63
- package/esm/Core/Utils/Ranges.js +29 -10
- package/esm/Core/Utils/SpatialHashGrid.js +102 -0
- package/esm/Core/Utils/Vectors.js +17 -18
- package/esm/Enums/Types/EasingType.js +18 -3
- package/esm/Options/Classes/AnimatableColor.js +1 -0
- package/esm/Options/Classes/AnimationOptions.js +8 -0
- package/esm/Options/Classes/Background/Background.js +6 -0
- package/esm/Options/Classes/ColorAnimation.js +12 -1
- package/esm/Options/Classes/FullScreen/FullScreen.js +2 -0
- package/esm/Options/Classes/HslAnimation.js +4 -5
- package/esm/Options/Classes/Options.js +63 -4
- package/esm/Options/Classes/OptionsColor.js +1 -0
- package/esm/Options/Classes/Particles/Bounce/ParticlesBounce.js +2 -0
- package/esm/Options/Classes/Particles/Effect/Effect.js +3 -4
- package/esm/Options/Classes/Particles/Fill.js +28 -0
- package/esm/Options/Classes/Particles/Move/Move.js +17 -3
- package/esm/Options/Classes/Particles/Move/MoveAngle.js +2 -0
- package/esm/Options/Classes/Particles/Move/MoveCenter.js +4 -0
- package/esm/Options/Classes/Particles/Move/MoveGravity.js +4 -0
- package/esm/Options/Classes/Particles/Move/OutModes.js +5 -0
- package/esm/Options/Classes/Particles/Move/Path/MovePath.js +5 -0
- package/esm/Options/Classes/Particles/Move/Spin.js +3 -0
- package/esm/Options/Classes/Particles/Number/ParticlesDensity.js +3 -0
- package/esm/Options/Classes/Particles/Number/ParticlesNumber.js +3 -0
- package/esm/Options/Classes/Particles/Number/ParticlesNumberLimit.js +2 -0
- package/esm/Options/Classes/Particles/Opacity/Opacity.js +1 -0
- package/esm/Options/Classes/Particles/Opacity/OpacityAnimation.js +1 -0
- package/esm/Options/Classes/Particles/ParticlesOptions.js +25 -5
- package/esm/Options/Classes/Particles/Shape/Shape.js +3 -4
- package/esm/Options/Classes/Particles/Size/Size.js +1 -0
- package/esm/Options/Classes/Particles/Size/SizeAnimation.js +1 -0
- package/esm/Options/Classes/Particles/Stroke.js +3 -0
- package/esm/Options/Classes/Particles/ZIndex/ZIndex.js +3 -0
- package/esm/Options/Classes/ResizeEvent.js +2 -0
- package/esm/Options/Classes/ValueWithRandom.js +3 -4
- package/esm/Utils/CanvasUtils.js +43 -62
- package/esm/Utils/ColorUtils.js +30 -19
- package/esm/Utils/EventDispatcher.js +1 -0
- package/esm/Utils/MathUtils.js +12 -7
- package/esm/Utils/Utils.js +109 -31
- package/esm/exports.js +1 -2
- package/package.json +1 -1
- package/report.html +3 -3
- package/scripts/install.js +4 -20
- package/tsparticles.engine.js +93 -91
- package/tsparticles.engine.min.js +2 -2
- package/types/Core/Canvas.d.ts +17 -4
- package/types/Core/Container.d.ts +3 -7
- package/types/Core/Engine.d.ts +13 -20
- package/types/Core/Interfaces/IColorManager.d.ts +0 -1
- package/types/Core/Interfaces/IContainerPlugin.d.ts +6 -1
- package/types/Core/Interfaces/IPalette.d.ts +7 -0
- package/types/Core/Interfaces/IParticleOpacityData.d.ts +1 -0
- package/types/Core/Interfaces/IParticleValueAnimation.d.ts +3 -3
- package/types/Core/Interfaces/IShapeDrawData.d.ts +8 -0
- package/types/Core/Interfaces/IShapeDrawer.d.ts +0 -1
- package/types/Core/Interfaces/IShapeValues.d.ts +0 -1
- package/types/Core/Particle.d.ts +4 -7
- package/types/Core/Particles.d.ts +15 -7
- package/types/Core/Utils/Constants.d.ts +2 -2
- package/types/Core/Utils/Ranges.d.ts +4 -1
- package/types/Core/Utils/SpatialHashGrid.d.ts +25 -0
- package/types/Core/Utils/Vectors.d.ts +8 -10
- package/types/Enums/Types/EasingType.d.ts +20 -5
- package/types/Options/Classes/ColorAnimation.d.ts +3 -1
- package/types/Options/Classes/HslAnimation.d.ts +3 -4
- package/types/Options/Classes/Options.d.ts +2 -0
- package/types/Options/Classes/Particles/Effect/Effect.d.ts +0 -1
- package/types/Options/Classes/Particles/Fill.d.ts +12 -0
- package/types/Options/Classes/Particles/Move/Move.d.ts +0 -2
- package/types/Options/Classes/Particles/ParticlesOptions.d.ts +2 -2
- package/types/Options/Classes/Particles/Shape/Shape.d.ts +0 -1
- package/types/Options/Classes/ValueWithRandom.d.ts +0 -1
- package/types/Options/Interfaces/IColorAnimation.d.ts +2 -0
- package/types/Options/Interfaces/IOptions.d.ts +1 -0
- package/types/Options/Interfaces/Particles/Effect/IEffect.d.ts +0 -1
- package/types/Options/Interfaces/Particles/IFill.d.ts +9 -0
- package/types/Options/Interfaces/Particles/IParticlesOptions.d.ts +2 -2
- package/types/Options/Interfaces/Particles/IStroke.d.ts +2 -2
- package/types/Options/Interfaces/Particles/Move/IMove.d.ts +0 -2
- package/types/Options/Interfaces/Particles/Shape/IShape.d.ts +0 -1
- package/types/Types/EngineInitializers.d.ts +6 -3
- package/types/Utils/CanvasUtils.d.ts +6 -14
- package/types/Utils/ColorUtils.d.ts +3 -2
- package/types/Utils/MathUtils.d.ts +2 -0
- package/types/Utils/Utils.d.ts +8 -1
- package/types/export-types.d.ts +3 -5
- package/types/exports.d.ts +1 -2
- package/umd/Core/Canvas.js +248 -141
- package/umd/Core/Container.js +80 -74
- package/umd/Core/Engine.js +43 -66
- package/umd/Core/Particle.js +203 -174
- package/umd/Core/Particles.js +187 -138
- package/umd/Core/Retina.js +5 -0
- package/umd/Core/Utils/Constants.js +3 -3
- package/umd/Core/Utils/EventListeners.js +67 -63
- package/umd/Core/Utils/Ranges.js +28 -9
- package/umd/Core/Utils/SpatialHashGrid.js +116 -0
- package/umd/Core/Utils/Vectors.js +17 -18
- package/umd/Enums/Types/EasingType.js +18 -3
- package/umd/Options/Classes/AnimatableColor.js +1 -0
- package/umd/Options/Classes/AnimationOptions.js +8 -0
- package/umd/Options/Classes/Background/Background.js +6 -0
- package/umd/Options/Classes/ColorAnimation.js +12 -1
- package/umd/Options/Classes/FullScreen/FullScreen.js +2 -0
- package/umd/Options/Classes/HslAnimation.js +5 -6
- package/umd/Options/Classes/Options.js +63 -4
- package/umd/Options/Classes/OptionsColor.js +1 -0
- package/umd/Options/Classes/Particles/Bounce/ParticlesBounce.js +2 -0
- package/umd/Options/Classes/Particles/Effect/Effect.js +3 -4
- package/umd/Options/Classes/Particles/Fill.js +42 -0
- package/umd/Options/Classes/Particles/Move/Move.js +18 -4
- package/umd/Options/Classes/Particles/Move/MoveAngle.js +2 -0
- package/umd/Options/Classes/Particles/Move/MoveCenter.js +4 -0
- package/umd/Options/Classes/Particles/Move/MoveGravity.js +4 -0
- package/umd/Options/Classes/Particles/Move/OutModes.js +5 -0
- package/umd/Options/Classes/Particles/Move/Path/MovePath.js +5 -0
- package/umd/Options/Classes/Particles/Move/Spin.js +3 -0
- package/umd/Options/Classes/Particles/Number/ParticlesDensity.js +3 -0
- package/umd/Options/Classes/Particles/Number/ParticlesNumber.js +3 -0
- package/umd/Options/Classes/Particles/Number/ParticlesNumberLimit.js +2 -0
- package/umd/Options/Classes/Particles/Opacity/Opacity.js +1 -0
- package/umd/Options/Classes/Particles/Opacity/OpacityAnimation.js +1 -0
- package/umd/Options/Classes/Particles/ParticlesOptions.js +26 -6
- package/umd/Options/Classes/Particles/Shape/Shape.js +3 -4
- package/umd/Options/Classes/Particles/Size/Size.js +1 -0
- package/umd/Options/Classes/Particles/Size/SizeAnimation.js +1 -0
- package/umd/Options/Classes/Particles/Stroke.js +3 -0
- package/umd/Options/Classes/Particles/ZIndex/ZIndex.js +3 -0
- package/umd/Options/Classes/ResizeEvent.js +2 -0
- package/umd/Options/Classes/ValueWithRandom.js +3 -4
- package/umd/Utils/CanvasUtils.js +43 -66
- package/umd/Utils/ColorUtils.js +30 -18
- package/umd/Utils/EventDispatcher.js +1 -0
- package/umd/Utils/MathUtils.js +14 -7
- package/umd/Utils/Utils.js +111 -32
- package/umd/exports.js +2 -3
- package/794.min.js +0 -2
- package/794.min.js.LICENSE.txt +0 -1
- package/browser/Core/Utils/Point.js +0 -6
- package/browser/Core/Utils/QuadTree.js +0 -59
- package/browser/Options/Classes/Particles/Move/MoveAttract.js +0 -33
- package/cjs/Core/Utils/Point.js +0 -6
- package/cjs/Core/Utils/QuadTree.js +0 -59
- package/cjs/Options/Classes/Particles/Move/MoveAttract.js +0 -33
- package/esm/Core/Interfaces/IMovePathGenerator.js +0 -1
- package/esm/Core/Interfaces/IParticleMover.js +0 -1
- package/esm/Core/Utils/Point.js +0 -6
- package/esm/Core/Utils/QuadTree.js +0 -59
- package/esm/Options/Classes/Particles/Move/MoveAttract.js +0 -33
- package/esm/Options/Interfaces/Particles/Move/IMoveAttract.js +0 -1
- package/tsparticles.engine.min.js.LICENSE.txt +0 -1
- package/types/Core/Interfaces/IMovePathGenerator.d.ts +0 -10
- package/types/Core/Interfaces/IParticleMover.d.ts +0 -7
- package/types/Core/Utils/Point.d.ts +0 -7
- package/types/Core/Utils/QuadTree.d.ts +0 -18
- package/types/Options/Classes/Particles/Move/MoveAttract.d.ts +0 -12
- package/types/Options/Interfaces/Particles/Move/IMoveAttract.d.ts +0 -7
- package/umd/Core/Utils/Point.js +0 -20
- package/umd/Core/Utils/QuadTree.js +0 -73
- package/umd/Options/Classes/Particles/Move/MoveAttract.js +0 -47
- package/umd/Options/Interfaces/Particles/Move/IMoveAttract.js +0 -12
- /package/browser/Core/Interfaces/{IMovePathGenerator.js → IPalette.js} +0 -0
- /package/browser/{Core/Interfaces/IParticleMover.js → Options/Interfaces/Particles/IFill.js} +0 -0
- /package/{browser/Options/Interfaces/Particles/Move/IMoveAttract.js → cjs/Core/Interfaces/IPalette.js} +0 -0
- /package/cjs/{Core/Interfaces/IMovePathGenerator.js → Options/Interfaces/Particles/IFill.js} +0 -0
- /package/{cjs/Core/Interfaces/IParticleMover.js → esm/Core/Interfaces/IPalette.js} +0 -0
- /package/{cjs/Options/Interfaces/Particles/Move/IMoveAttract.js → esm/Options/Interfaces/Particles/IFill.js} +0 -0
- /package/umd/Core/Interfaces/{IMovePathGenerator.js → IPalette.js} +0 -0
- /package/umd/{Core/Interfaces/IParticleMover.js → Options/Interfaces/Particles/IFill.js} +0 -0
package/umd/Utils/MathUtils.js
CHANGED
|
@@ -23,7 +23,9 @@
|
|
|
23
23
|
exports.getRangeMax = getRangeMax;
|
|
24
24
|
exports.setRangeValue = setRangeValue;
|
|
25
25
|
exports.getDistances = getDistances;
|
|
26
|
+
exports.getDistanceSq = getDistanceSq;
|
|
26
27
|
exports.getDistance = getDistance;
|
|
28
|
+
exports.checkDistance = checkDistance;
|
|
27
29
|
exports.degToRad = degToRad;
|
|
28
30
|
exports.getParticleDirectionAngle = getParticleDirectionAngle;
|
|
29
31
|
exports.getParticleBaseVelocity = getParticleBaseVelocity;
|
|
@@ -57,10 +59,8 @@
|
|
|
57
59
|
return getRandom() * (max - min) + min;
|
|
58
60
|
}
|
|
59
61
|
function setAnimationFunctions(nextFrame, cancel) {
|
|
60
|
-
_animationLoop.nextFrame =
|
|
61
|
-
_animationLoop.cancel =
|
|
62
|
-
cancel(handle);
|
|
63
|
-
};
|
|
62
|
+
_animationLoop.nextFrame = nextFrame;
|
|
63
|
+
_animationLoop.cancel = cancel;
|
|
64
64
|
}
|
|
65
65
|
function animate(fn) {
|
|
66
66
|
return _animationLoop.nextFrame(fn);
|
|
@@ -104,11 +104,18 @@
|
|
|
104
104
|
: setRangeValue(min, max);
|
|
105
105
|
}
|
|
106
106
|
function getDistances(pointA, pointB) {
|
|
107
|
-
const dx = pointA.x - pointB.x, dy = pointA.y - pointB.y
|
|
108
|
-
return { dx: dx, dy: dy, distance: Math.
|
|
107
|
+
const dx = pointA.x - pointB.x, dy = pointA.y - pointB.y;
|
|
108
|
+
return { dx: dx, dy: dy, distance: Math.hypot(dx, dy) };
|
|
109
|
+
}
|
|
110
|
+
function getDistanceSq(pointA, pointB) {
|
|
111
|
+
const dx = pointA.x - pointB.x, dy = pointA.y - pointB.y;
|
|
112
|
+
return dx * dx + dy * dy;
|
|
109
113
|
}
|
|
110
114
|
function getDistance(pointA, pointB) {
|
|
111
|
-
return
|
|
115
|
+
return Math.sqrt(getDistanceSq(pointA, pointB));
|
|
116
|
+
}
|
|
117
|
+
function checkDistance(pointA, pointB, distance) {
|
|
118
|
+
return getDistanceSq(pointA, pointB) <= distance * distance;
|
|
112
119
|
}
|
|
113
120
|
function degToRad(degrees) {
|
|
114
121
|
return degrees * degToRadFactor;
|
package/umd/Utils/Utils.js
CHANGED
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.getFullScreenStyle = void 0;
|
|
13
|
+
exports.memoize = memoize;
|
|
13
14
|
exports.hasMatchMedia = hasMatchMedia;
|
|
14
15
|
exports.safeDocument = safeDocument;
|
|
15
16
|
exports.safeMatchMedia = safeMatchMedia;
|
|
16
17
|
exports.safeIntersectionObserver = safeIntersectionObserver;
|
|
17
18
|
exports.safeMutationObserver = safeMutationObserver;
|
|
18
19
|
exports.isInArray = isInArray;
|
|
19
|
-
exports.loadFont = loadFont;
|
|
20
20
|
exports.arrayRandomIndex = arrayRandomIndex;
|
|
21
21
|
exports.itemFromArray = itemFromArray;
|
|
22
22
|
exports.isPointInside = isPointInside;
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
exports.cloneStyle = cloneStyle;
|
|
36
36
|
exports.manageListener = manageListener;
|
|
37
37
|
exports.getItemsFromInitializer = getItemsFromInitializer;
|
|
38
|
+
exports.getItemMapFromInitializer = getItemMapFromInitializer;
|
|
38
39
|
const MathUtils_js_1 = require("./MathUtils.js");
|
|
39
40
|
const Constants_js_1 = require("../Core/Utils/Constants.js");
|
|
40
41
|
const TypeUtils_js_1 = require("./TypeUtils.js");
|
|
@@ -45,16 +46,70 @@
|
|
|
45
46
|
const PixelMode_js_1 = require("../Enums/Modes/PixelMode.js");
|
|
46
47
|
const StartValueType_js_1 = require("../Enums/Types/StartValueType.js");
|
|
47
48
|
const Vectors_js_1 = require("../Core/Utils/Vectors.js");
|
|
48
|
-
const minRadius = 0;
|
|
49
|
-
function memoize(fn) {
|
|
50
|
-
const cache = new Map()
|
|
49
|
+
const minRadius = 0, minMemoizeSize = 0;
|
|
50
|
+
function memoize(fn, options) {
|
|
51
|
+
const cache = new Map(), maxSize = options?.maxSize, ttlMs = options?.ttlMs, keyFn = options?.keyFn, stableStringify = (obj, seen = new WeakSet()) => {
|
|
52
|
+
if (obj === null) {
|
|
53
|
+
return "null";
|
|
54
|
+
}
|
|
55
|
+
const t = typeof obj;
|
|
56
|
+
if (t === "undefined") {
|
|
57
|
+
return "undefined";
|
|
58
|
+
}
|
|
59
|
+
if (t === "number" || t === "boolean" || t === "string") {
|
|
60
|
+
return JSON.stringify(obj);
|
|
61
|
+
}
|
|
62
|
+
if (t === "function") {
|
|
63
|
+
try {
|
|
64
|
+
const fn = obj;
|
|
65
|
+
return fn.toString();
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return '"[Function]"';
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (t === "symbol") {
|
|
72
|
+
try {
|
|
73
|
+
return obj.toString();
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
return '"[Symbol]"';
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (Array.isArray(obj)) {
|
|
80
|
+
return `[${obj.map(i => stableStringify(i, seen)).join(",")}]`;
|
|
81
|
+
}
|
|
82
|
+
if (seen.has(obj)) {
|
|
83
|
+
return '"[Circular]"';
|
|
84
|
+
}
|
|
85
|
+
seen.add(obj);
|
|
86
|
+
const keys = Object.keys(obj).sort();
|
|
87
|
+
return `{${keys.map(k => `${JSON.stringify(k)}:${stableStringify(obj[k], seen)}`).join(",")}}`;
|
|
88
|
+
}, defaultKeyer = (args) => stableStringify(args), makeKey = (args) => (keyFn ? keyFn(args) : defaultKeyer(args)), ensureBounds = () => {
|
|
89
|
+
if (typeof maxSize === "number" && maxSize >= minMemoizeSize) {
|
|
90
|
+
while (cache.size > maxSize) {
|
|
91
|
+
const firstKey = cache.keys().next().value;
|
|
92
|
+
if (firstKey === undefined)
|
|
93
|
+
break;
|
|
94
|
+
cache.delete(firstKey);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
};
|
|
51
98
|
return (...args) => {
|
|
52
|
-
const key =
|
|
53
|
-
if (
|
|
54
|
-
|
|
99
|
+
const key = makeKey(args), now = Date.now(), entry = cache.get(key);
|
|
100
|
+
if (entry !== undefined) {
|
|
101
|
+
if (ttlMs && now - entry.ts > ttlMs) {
|
|
102
|
+
cache.delete(key);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
cache.delete(key);
|
|
106
|
+
cache.set(key, { value: entry.value, ts: entry.ts });
|
|
107
|
+
return entry.value;
|
|
108
|
+
}
|
|
55
109
|
}
|
|
56
110
|
const result = fn(...args);
|
|
57
|
-
cache.set(key, result);
|
|
111
|
+
cache.set(key, { value: result, ts: now });
|
|
112
|
+
ensureBounds();
|
|
58
113
|
return result;
|
|
59
114
|
};
|
|
60
115
|
}
|
|
@@ -85,13 +140,6 @@
|
|
|
85
140
|
function isInArray(value, array) {
|
|
86
141
|
return value === array || ((0, TypeUtils_js_1.isArray)(array) && array.includes(value));
|
|
87
142
|
}
|
|
88
|
-
async function loadFont(font, weight) {
|
|
89
|
-
try {
|
|
90
|
-
await safeDocument().fonts.load(`${weight ?? "400"} 36px '${font ?? "Verdana"}'`);
|
|
91
|
-
}
|
|
92
|
-
catch {
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
143
|
function arrayRandomIndex(array) {
|
|
96
144
|
return Math.floor((0, MathUtils_js_1.getRandom)() * array.length);
|
|
97
145
|
}
|
|
@@ -127,33 +175,48 @@
|
|
|
127
175
|
}
|
|
128
176
|
function deepExtend(destination, ...sources) {
|
|
129
177
|
for (const source of sources) {
|
|
130
|
-
if (
|
|
178
|
+
if ((0, TypeUtils_js_1.isNull)(source)) {
|
|
131
179
|
continue;
|
|
132
180
|
}
|
|
133
181
|
if (!(0, TypeUtils_js_1.isObject)(source)) {
|
|
134
182
|
destination = source;
|
|
135
183
|
continue;
|
|
136
184
|
}
|
|
137
|
-
|
|
138
|
-
if (sourceIsArray) {
|
|
185
|
+
if (Array.isArray(source)) {
|
|
139
186
|
if (!Array.isArray(destination)) {
|
|
140
187
|
destination = [];
|
|
141
188
|
}
|
|
142
189
|
}
|
|
143
|
-
else {
|
|
144
|
-
|
|
145
|
-
|
|
190
|
+
else if (!(0, TypeUtils_js_1.isObject)(destination) || Array.isArray(destination)) {
|
|
191
|
+
destination = {};
|
|
192
|
+
}
|
|
193
|
+
const sourceKeys = Object.keys(source), dangerousKeys = new Set(["__proto__", "constructor", "prototype"]), hasNested = sourceKeys.some(k => {
|
|
194
|
+
const v = source[k];
|
|
195
|
+
return (0, TypeUtils_js_1.isObject)(v) || Array.isArray(v);
|
|
196
|
+
});
|
|
197
|
+
if (!hasNested) {
|
|
198
|
+
const sourceDict = source, destDict = destination;
|
|
199
|
+
for (const key of sourceKeys) {
|
|
200
|
+
if (dangerousKeys.has(key)) {
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
if (key in sourceDict) {
|
|
204
|
+
const v = sourceDict[key];
|
|
205
|
+
if (v !== undefined) {
|
|
206
|
+
destDict[key] = v;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
146
209
|
}
|
|
210
|
+
continue;
|
|
147
211
|
}
|
|
148
|
-
for (const key
|
|
149
|
-
if (key
|
|
212
|
+
for (const key of sourceKeys) {
|
|
213
|
+
if (dangerousKeys.has(key)) {
|
|
150
214
|
continue;
|
|
151
215
|
}
|
|
152
|
-
const sourceDict = source, value = sourceDict[key]
|
|
153
|
-
destDict[key] =
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
: deepExtend(destDict[key], value);
|
|
216
|
+
const sourceDict = source, destDict = destination, value = sourceDict[key];
|
|
217
|
+
destDict[key] = Array.isArray(value)
|
|
218
|
+
? value.map(v => deepExtend(undefined, v))
|
|
219
|
+
: deepExtend(destDict[key], value);
|
|
157
220
|
}
|
|
158
221
|
}
|
|
159
222
|
return destination;
|
|
@@ -215,6 +278,8 @@
|
|
|
215
278
|
case AnimationMode_js_1.AnimationMode.random:
|
|
216
279
|
res.status = (0, MathUtils_js_1.getRandom)() >= Constants_js_1.half ? AnimationStatus_js_1.AnimationStatus.increasing : AnimationStatus_js_1.AnimationStatus.decreasing;
|
|
217
280
|
break;
|
|
281
|
+
default:
|
|
282
|
+
break;
|
|
218
283
|
}
|
|
219
284
|
const autoStatus = animationOptions.mode === AnimationMode_js_1.AnimationMode.auto;
|
|
220
285
|
switch (animationOptions.startValue) {
|
|
@@ -280,6 +345,8 @@
|
|
|
280
345
|
particle.destroy();
|
|
281
346
|
}
|
|
282
347
|
break;
|
|
348
|
+
default:
|
|
349
|
+
break;
|
|
283
350
|
}
|
|
284
351
|
}
|
|
285
352
|
function updateAnimation(particle, data, changeDirection, destroyType, delta) {
|
|
@@ -327,6 +394,9 @@
|
|
|
327
394
|
else {
|
|
328
395
|
data.value -= velocity;
|
|
329
396
|
}
|
|
397
|
+
break;
|
|
398
|
+
default:
|
|
399
|
+
break;
|
|
330
400
|
}
|
|
331
401
|
if (data.velocity && decay !== identity) {
|
|
332
402
|
data.velocity *= decay;
|
|
@@ -338,7 +408,7 @@
|
|
|
338
408
|
const clonedStyle = safeDocument().createElement("div").style;
|
|
339
409
|
for (const key in style) {
|
|
340
410
|
const styleKey = style[key];
|
|
341
|
-
if (!
|
|
411
|
+
if (!(key in style) || (0, TypeUtils_js_1.isNull)(styleKey)) {
|
|
342
412
|
continue;
|
|
343
413
|
}
|
|
344
414
|
const styleValue = style.getPropertyValue?.(styleKey);
|
|
@@ -346,11 +416,11 @@
|
|
|
346
416
|
continue;
|
|
347
417
|
}
|
|
348
418
|
const stylePriority = style.getPropertyPriority?.(styleKey);
|
|
349
|
-
if (
|
|
350
|
-
clonedStyle.setProperty(styleKey, styleValue);
|
|
419
|
+
if (stylePriority) {
|
|
420
|
+
clonedStyle.setProperty(styleKey, styleValue, stylePriority);
|
|
351
421
|
}
|
|
352
422
|
else {
|
|
353
|
-
clonedStyle.setProperty(styleKey, styleValue
|
|
423
|
+
clonedStyle.setProperty(styleKey, styleValue);
|
|
354
424
|
}
|
|
355
425
|
}
|
|
356
426
|
return clonedStyle;
|
|
@@ -402,4 +472,13 @@
|
|
|
402
472
|
}
|
|
403
473
|
return res;
|
|
404
474
|
}
|
|
475
|
+
async function getItemMapFromInitializer(container, map, initializers, force = false) {
|
|
476
|
+
let res = map.get(container);
|
|
477
|
+
if (!res || force) {
|
|
478
|
+
const entries = await Promise.all([...initializers.entries()].map(([key, initializer]) => initializer(container).then(item => [key, item])));
|
|
479
|
+
res = new Map(entries);
|
|
480
|
+
map.set(container, res);
|
|
481
|
+
}
|
|
482
|
+
return res;
|
|
483
|
+
}
|
|
405
484
|
});
|
package/umd/exports.js
CHANGED
|
@@ -18,13 +18,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
18
18
|
if (v !== undefined) module.exports = v;
|
|
19
19
|
}
|
|
20
20
|
else if (typeof define === "function" && define.amd) {
|
|
21
|
-
define(["require", "exports", "./Core/Utils/Constants.js", "./Core/Utils/
|
|
21
|
+
define(["require", "exports", "./Core/Utils/Constants.js", "./Core/Utils/Ranges.js", "./Core/Utils/Vectors.js", "./Enums/Directions/MoveDirection.js", "./Enums/Directions/RotateDirection.js", "./Enums/Directions/OutModeDirection.js", "./Enums/Modes/AnimationMode.js", "./Enums/Modes/LimitMode.js", "./Enums/Modes/OutMode.js", "./Enums/Modes/PixelMode.js", "./Enums/Types/AlterType.js", "./Enums/Types/DestroyType.js", "./Enums/Types/GradientType.js", "./Enums/Types/ParticleOutType.js", "./Enums/Types/StartValueType.js", "./Enums/Types/EasingType.js", "./Enums/Types/EventType.js", "./Enums/AnimationStatus.js", "./Options/Classes/AnimatableColor.js", "./Options/Classes/AnimationOptions.js", "./Options/Classes/Background/Background.js", "./Options/Classes/ColorAnimation.js", "./Options/Classes/FullScreen/FullScreen.js", "./Options/Classes/HslAnimation.js", "./Options/Classes/Options.js", "./Options/Classes/OptionsColor.js", "./Options/Classes/Particles/Bounce/ParticlesBounce.js", "./Options/Classes/Particles/Bounce/ParticlesBounceFactor.js", "./Options/Classes/Particles/ParticlesOptions.js", "./Options/Classes/Particles/Fill.js", "./Options/Classes/Particles/Stroke.js", "./Options/Classes/Particles/Move/Move.js", "./Options/Classes/Particles/Move/MoveAngle.js", "./Options/Classes/Particles/Move/MoveCenter.js", "./Options/Classes/Particles/Move/MoveGravity.js", "./Options/Classes/Particles/Move/OutModes.js", "./Options/Classes/Particles/Move/Path/MovePath.js", "./Options/Classes/Particles/Move/Spin.js", "./Options/Classes/Particles/Number/ParticlesNumber.js", "./Options/Classes/Particles/Number/ParticlesNumberLimit.js", "./Options/Classes/Particles/Number/ParticlesDensity.js", "./Options/Classes/Particles/Opacity/Opacity.js", "./Options/Classes/Particles/Opacity/OpacityAnimation.js", "./Options/Classes/Particles/Shape/Shape.js", "./Options/Classes/Particles/Size/Size.js", "./Options/Classes/Particles/Size/SizeAnimation.js", "./Options/Classes/Particles/ZIndex/ZIndex.js", "./Options/Classes/ResizeEvent.js", "./Options/Classes/ValueWithRandom.js", "./Utils/CanvasUtils.js", "./Utils/ColorUtils.js", "./Utils/LogUtils.js", "./Utils/MathUtils.js", "./Utils/OptionsUtils.js", "./Utils/Utils.js", "./Utils/TypeUtils.js"], factory);
|
|
22
22
|
}
|
|
23
23
|
})(function (require, exports) {
|
|
24
24
|
"use strict";
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
__exportStar(require("./Core/Utils/Constants.js"), exports);
|
|
27
|
-
__exportStar(require("./Core/Utils/Point.js"), exports);
|
|
28
27
|
__exportStar(require("./Core/Utils/Ranges.js"), exports);
|
|
29
28
|
__exportStar(require("./Core/Utils/Vectors.js"), exports);
|
|
30
29
|
__exportStar(require("./Enums/Directions/MoveDirection.js"), exports);
|
|
@@ -53,8 +52,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
53
52
|
__exportStar(require("./Options/Classes/Particles/Bounce/ParticlesBounce.js"), exports);
|
|
54
53
|
__exportStar(require("./Options/Classes/Particles/Bounce/ParticlesBounceFactor.js"), exports);
|
|
55
54
|
__exportStar(require("./Options/Classes/Particles/ParticlesOptions.js"), exports);
|
|
55
|
+
__exportStar(require("./Options/Classes/Particles/Fill.js"), exports);
|
|
56
56
|
__exportStar(require("./Options/Classes/Particles/Stroke.js"), exports);
|
|
57
|
-
__exportStar(require("./Options/Classes/Particles/Move/MoveAttract.js"), exports);
|
|
58
57
|
__exportStar(require("./Options/Classes/Particles/Move/Move.js"), exports);
|
|
59
58
|
__exportStar(require("./Options/Classes/Particles/Move/MoveAngle.js"), exports);
|
|
60
59
|
__exportStar(require("./Options/Classes/Particles/Move/MoveCenter.js"), exports);
|
package/794.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 794.min.js.LICENSE.txt */
|
|
2
|
-
(this.webpackChunk_tsparticles_engine=this.webpackChunk_tsparticles_engine||[]).push([[794],{8794(t,i,e){e.d(i,{Container:()=>M});var s=e(1680),n=e(7642),a=e(6754),r=e(302),o=e(9599);function h(t,i,e){const s=i[e];void 0!==s&&(t[e]=(t[e]??n.zs)*s)}function c(t,i,e=!1){if(!i)return;const s=t.style,n=new Set;for(let t=0;t<s.length;t++){const i=s.item(t);i&&n.add(i)}for(let t=0;t<i.length;t++){const e=i.item(t);e&&n.add(e)}for(const t of n){const n=i.getPropertyValue(t);n?s.setProperty(t,n,e?"important":""):s.removeProperty(t)}}class l{constructor(t,i){this.container=t,this._reusableColorStyles={},this._reusablePluginColors=[void 0,void 0],this._reusableTransform={},this._applyPostDrawUpdaters=t=>{for(const i of this._postDrawUpdaters)i.afterDraw?.(t)},this._applyPreDrawUpdaters=(t,i,e,s,n,a)=>{for(const r of this._preDrawUpdaters){if(r.getColorStyles){const{fill:a,stroke:o}=r.getColorStyles(i,t,e,s);a&&(n.fill=a),o&&(n.stroke=o)}if(r.getTransformValues){const t=r.getTransformValues(i);for(const i in t)h(a,t,i)}r.beforeDraw?.(i)}},this._applyResizePlugins=()=>{for(const t of this._resizePlugins)t.resize?.()},this._getPluginParticleColors=t=>{let i,e;for(const s of this._colorPlugins)if(!i&&s.particleFillColor&&(i=(0,o.R5)(this._engine,s.particleFillColor(t))),!e&&s.particleStrokeColor&&(e=(0,o.R5)(this._engine,s.particleStrokeColor(t))),i&&e)break;return this._reusablePluginColors[0]=i,this._reusablePluginColors[1]=e,this._reusablePluginColors},this._initStyle=()=>{const t=this.element,i=this.container.actualOptions;if(t){this._fullScreen?this._setFullScreenStyle():this._resetOriginalStyle();for(const e in i.style){if(!e||!Object.hasOwn(i.style,e))continue;const s=i.style[e];s&&t.style.setProperty(e,s,"important")}}},this._repairStyle=()=>{const t=this.element;if(!t)return;this._safeMutationObserver((t=>{t.disconnect()})),this._initStyle(),this.initBackground();const i=this._pointerEvents;t.style.pointerEvents=i,t.setAttribute("pointer-events",i),this._safeMutationObserver((i=>{t instanceof Node&&i.observe(t,{attributes:!0})}))},this._resetOriginalStyle=()=>{const t=this.element,i=this._originalStyle;t&&i&&c(t,i,!0)},this._safeMutationObserver=t=>{this._mutationObserver&&t(this._mutationObserver)},this._setFullScreenStyle=()=>{const t=this.element;t&&c(t,(0,r.hJ)(this.container.actualOptions.fullScreen.zIndex),!0)},this._engine=i,this._standardSize={height:0,width:0};const e=t.retina.pixelRatio,s=this._standardSize;this.size={height:s.height*e,width:s.width*e},this._context=null,this._generated=!1,this._preDrawUpdaters=[],this._postDrawUpdaters=[],this._resizePlugins=[],this._colorPlugins=[],this._pointerEvents="none"}get _fullScreen(){return this.container.actualOptions.fullScreen.enable}canvasClear(){this.container.actualOptions.clear&&this.draw((t=>{(0,a.IU)(t,this.size)}))}clear(){let t=!1;for(const i of this.container.plugins)!t&&i.canvasClear&&(t=i.canvasClear());t||this.canvasClear()}clearDrawPlugin(t,i){this.draw((e=>{(0,a.l7)(e,t,i)}))}destroy(){if(this.stop(),this._generated){const t=this.element;t?.remove(),this.element=void 0}else this._resetOriginalStyle();this._preDrawUpdaters=[],this._postDrawUpdaters=[],this._resizePlugins=[],this._colorPlugins=[]}draw(t){const i=this._context;if(i)return t(i)}drawParticle(t,i){if(t.spawning||t.destroyed)return;const e=t.getRadius();if(e<=n.w2)return;const s=t.getFillColor(),r=t.getStrokeColor()??s;let[h,c]=this._getPluginParticleColors(t);if(h??=s,c??=r,!h&&!c)return;const l=this.container,d=t.options.zIndex,p=n.RV-t.zIndexFactor,{opacity:u,strokeOpacity:f}=t.getOpacity(),_=this._reusableTransform,g=this._reusableColorStyles,y=h?(0,o.LC)(h,l.hdr,u):void 0,m=c?(0,o.LC)(c,l.hdr,f):y;_.a=_.b=_.c=_.d=void 0,g.fill=y,g.stroke=m,this.draw((s=>{this._applyPreDrawUpdaters(s,t,e,u,g,_),(0,a.p0)({container:l,context:s,particle:t,delta:i,colorStyles:g,radius:e*p**d.sizeRate,opacity:u,transform:_})})),this._applyPostDrawUpdaters(t)}drawParticlePlugin(t,i,e){this.draw((s=>{(0,a.Wb)(s,t,i,e)}))}drawParticles(t){const{particles:i,plugins:e}=this.container;this.clear(),i.update(t);for(const i of e.values())this.drawPlugin(i,t);this.draw((()=>{i.drawParticles(t)}));for(const i of e.values())this.clearDrawPlugin(i,t)}drawPlugin(t,i){this.draw((e=>{(0,a.e_)(e,t,i)}))}init(){this._safeMutationObserver((t=>{t.disconnect()})),this._mutationObserver=(0,r.tG)((t=>{for(const i of t)"attributes"===i.type&&"style"===i.attributeName&&this._repairStyle()})),this.resize(),this._initStyle(),this.initBackground(),this._safeMutationObserver((t=>{this.element&&this.element instanceof Node&&t.observe(this.element,{attributes:!0})})),this.initUpdaters(),this.initPlugins(),this.paint()}initBackground(){const{container:t}=this,i=t.actualOptions.background,e=this.element;if(!e)return;const s=e.style,n=(0,o.BN)(this._engine,i.color);s.backgroundColor=n?(0,o.xx)(n,t.hdr,i.opacity):"",s.backgroundImage=i.image||"",s.backgroundPosition=i.position||"",s.backgroundRepeat=i.repeat||"",s.backgroundSize=i.size||""}initPlugins(){this._resizePlugins=[];for(const t of this.container.plugins)t.resize&&this._resizePlugins.push(t),(t.particleFillColor??t.particleStrokeColor)&&this._colorPlugins.push(t)}initUpdaters(){this._preDrawUpdaters=[],this._postDrawUpdaters=[];for(const t of this.container.particles.updaters)t.afterDraw&&this._postDrawUpdaters.push(t),(t.getColorStyles??t.getTransformValues??t.beforeDraw)&&this._preDrawUpdaters.push(t)}loadCanvas(t){this._generated&&this.element&&this.element.remove();const i=this.container;this._generated=n.eb in t.dataset?"true"===t.dataset[n.eb]:this._generated,this.element=t,this.element.ariaHidden="true",this._originalStyle=(0,r.td)(this.element.style);const e=this._standardSize;e.height=t.offsetHeight,e.width=t.offsetWidth;const s=this.container.retina.pixelRatio,a=this.size;t.height=a.height=e.height*s,t.width=a.width=e.width*s;const o=(0,r.lV)("(color-gamut: p3)");this._context=this.element.getContext("2d",{alpha:!0,colorSpace:o?.matches&&i.hdr?"display-p3":"srgb",desynchronized:!0,willReadFrequently:!1}),this._safeMutationObserver((t=>{t.disconnect()})),i.retina.init(),this.initBackground(),this._safeMutationObserver((t=>{this.element&&this.element instanceof Node&&t.observe(this.element,{attributes:!0})}))}paint(){let t=!1;for(const i of this.container.plugins){if(t)break;t=i.canvasPaint?.()??!1}t||this.paintBase()}paintBase(t){this.draw((i=>{(0,a.Sn)(i,this.size,t)}))}paintImage(t,i){this.draw((e=>{(0,a.Md)(e,this.size,t,i)}))}resize(){if(!this.element)return!1;const t=this.container,i=t.canvas._standardSize,e={width:this.element.offsetWidth,height:this.element.offsetHeight},s=t.retina.pixelRatio,n={width:e.width*s,height:e.height*s};if(e.height===i.height&&e.width===i.width&&n.height===this.element.height&&n.width===this.element.width)return!1;const a={...i};i.height=e.height,i.width=e.width;const r=this.size;return this.element.width=r.width=n.width,this.element.height=r.height=n.height,this.container.started&&t.particles.setResizeFactor({width:i.width/a.width,height:i.height/a.height}),!0}setPointerEvents(t){this.element&&(this._pointerEvents=t,this._repairStyle())}stop(){this._safeMutationObserver((t=>{t.disconnect()})),this._mutationObserver=void 0,this.draw((t=>{(0,a.IU)(t,this.size)}))}async windowResize(){if(!this.element||!this.resize())return;const t=this.container,i=t.updateActualOptions();t.particles.setDensity(),this._applyResizePlugins(),i&&await t.refresh()}}class d{constructor(t){this.container=t,this._handleVisibilityChange=()=>{const t=this.container;t.actualOptions.pauseOnBlur&&((0,r.T5)().hidden?(t.pageHidden=!0,t.pause()):(t.pageHidden=!1,t.animationStatus?t.play(!0):t.draw(!0)))},this._handleWindowResize=()=>{this._resizeTimeout&&(clearTimeout(this._resizeTimeout),delete this._resizeTimeout);const t=async()=>{const t=this.container.canvas;await t.windowResize()};this._resizeTimeout=setTimeout((()=>{t()}),this.container.actualOptions.resize.delay*n.Xu)},this._manageListeners=t=>{const i=this._handlers;this._manageResize(t),(0,r.Kp)(document,n.nK,i.visibilityChange,t,!1)},this._manageResize=t=>{const i=this._handlers,e=this.container;if(!e.actualOptions.resize.enable)return;if("undefined"==typeof ResizeObserver)return void(0,r.Kp)(globalThis,n.NF,i.resize,t);const s=e.canvas.element;this._resizeObserver&&!t?(s&&this._resizeObserver.unobserve(s),this._resizeObserver.disconnect(),delete this._resizeObserver):!this._resizeObserver&&t&&s&&(this._resizeObserver=new ResizeObserver((t=>{t.find((t=>t.target===s))&&this._handleWindowResize()})),this._resizeObserver.observe(s))},this._handlers={visibilityChange:()=>{this._handleVisibilityChange()},resize:()=>{this._handleWindowResize()}}}addListeners(){this._manageListeners(!0)}removeListeners(){this._manageListeners(!1)}}var p=e(3838),u=e(2037),f=e(6423),_=e(8095),g=e(1953),y=e(1640),m=e(6312),v=e(9176);function w(t){if(!(0,r.hn)(t.outMode,t.checkModes))return;const i=t.radius*n.gd;t.coord>t.maxCoord-i?t.setCb(-t.radius):t.coord<i&&t.setCb(t.radius)}class b{constructor(t,i){this.container=i,this._cachedOpacityData={opacity:n.hv,strokeOpacity:n.hv},this._cachedPosition=_.p.origin,this._cachedRotateData={sin:0,cos:0},this._cachedTransform={a:1,b:0,c:0,d:1},this._calcPosition=(t,i)=>{let e=n.rq,a=t?_.p.create(t.x,t.y,i):void 0;const r=this.container,o=Array.from(r.plugins),h=this.options.move.outModes,c=this.getRadius(),l=r.canvas.size,d=new AbortController,{signal:p}=d;for(;!p.aborted;){for(const t of o){const e=t.particlePosition?.(a,this);if(e)return _.p.create(e.x,e.y,i)}const t=(0,s.Nx)({size:l,position:a}),r=_.p.create(t.x,t.y,i);this._fixHorizontal(r,c,h.left??h.default),this._fixHorizontal(r,c,h.right??h.default),this._fixVertical(r,c,h.top??h.default),this._fixVertical(r,c,h.bottom??h.default);let d=!0;for(const t of o)if(d=t.checkParticlePosition?.(this,r,e)??!0,!d)break;if(d)return r;e+=n.Eo,a=void 0}return a},this._calculateVelocity=()=>{const t=(0,s.$m)(this.direction).copy(),i=this.options.move;if(i.direction===g.F.inside||i.direction===g.F.outside)return t;const e=(0,s.pu)((0,s.VG)(i.angle.value)),a=(0,s.pu)((0,s.VG)(i.angle.offset)),r={left:a-e*n.MX,right:a+e*n.MX};return i.straight||(t.angle+=(0,s.vE)((0,s.DT)(r.left,r.right))),i.random&&"number"==typeof i.speed&&(t.length*=(0,s.G0)()),t},this._fixHorizontal=(t,i,e)=>{w({outMode:e,checkModes:[y.Y.bounce],coord:t.x,maxCoord:this.container.canvas.size.width,setCb:i=>t.x+=i,radius:i})},this._fixVertical=(t,i,e)=>{w({outMode:e,checkModes:[y.Y.bounce],coord:t.y,maxCoord:this.container.canvas.size.height,setCb:i=>t.y+=i,radius:i})},this._getRollColor=t=>{if(!t||!this.roll||!this.backColor&&!this.roll.alter)return t;const i=this.roll.horizontal&&this.roll.vertical?n.gd*n.l:n.l,e=this.roll.horizontal?Math.PI*n.MX:n.dv;return Math.floor((this.roll.angle+e)/(Math.PI/i))%n.gd?this.backColor?this.backColor:this.roll.alter?(0,a.yx)(t,this.roll.alter.type,this.roll.alter.value):t:t},this._initPosition=t=>{const i=this.container,e=(0,s.VG)(this.options.zIndex.value),a=this._calcPosition(t,(0,s.qE)(e,n.X_,i.zLayers));if(!a)throw new Error("a valid position cannot be found for particle");this.position=a,this.initialPosition=this.position.copy();const o=i.canvas.size;switch(this.moveCenter={...(0,r.E9)(this.options.move.center,o),radius:this.options.move.center.radius,mode:this.options.move.center.mode},this.direction=(0,s.JY)(this.options.move.direction,this.position,this.moveCenter),this.options.move.direction){case g.F.inside:this.outType=m.x.inside;break;case g.F.outside:this.outType=m.x.outside}this.offset=_.M.origin},this._engine=t}destroy(t){if(this.unbreakable||this.destroyed)return;this.destroyed=!0,this.bubble.inRange=!1,this.slow.inRange=!1;const i=this.container,e=this.pathGenerator,s=this.shape?i.shapeDrawers.get(this.shape):void 0;s?.particleDestroy?.(this);for(const e of i.plugins)e.particleDestroyed?.(this,t);for(const e of i.particles.updaters)e.particleDestroyed?.(this,t);e?.reset(this),this._engine.dispatchEvent(p.B.particleDestroyed,{container:this.container,data:{particle:this}})}draw(t){const i=this.container,e=i.canvas;for(const s of i.plugins)e.drawParticlePlugin(s,this,t);e.drawParticle(this,t)}getAngle(){return this.rotation+(this.pathRotation?this.velocity.angle:n.tA)}getFillColor(){return this._getRollColor(this.bubble.color??(0,o.O_)(this.color))}getMass(){return this.getRadius()**n.dm*Math.PI*n.MX}getOpacity(){const t=this.options.zIndex,i=(n.RV-this.zIndexFactor)**t.opacityRate,e=this.bubble.opacity??(0,s.VG)(this.opacity?.value??n.hv),a=this.strokeOpacity??e;return this._cachedOpacityData.opacity=e*i,this._cachedOpacityData.strokeOpacity=a*i,this._cachedOpacityData}getPosition(){return this._cachedPosition.x=this.position.x+this.offset.x,this._cachedPosition.y=this.position.y+this.offset.y,this._cachedPosition.z=this.position.z,this._cachedPosition}getRadius(){return this.bubble.radius??this.size.value}getRotateData(){const t=this.getAngle();return this._cachedRotateData.sin=Math.sin(t),this._cachedRotateData.cos=Math.cos(t),this._cachedRotateData}getStrokeColor(){return this._getRollColor(this.bubble.color??(0,o.O_)(this.strokeColor))}getTransformData(t){const i=this.getRotateData(),e=this.isRotating;return this._cachedTransform.a=i.cos*(t.a??n.Ug.a),this._cachedTransform.b=e?i.sin*(t.b??n.D_):t.b??n.Ug.b,this._cachedTransform.c=e?-i.sin*(t.c??n.D_):t.c??n.Ug.c,this._cachedTransform.d=i.cos*(t.d??n.Ug.d),this._cachedTransform}init(t,i,e,a){const o=this.container;this.id=t,this.group=a,this.effectClose=!0,this.effectFill=!0,this.shapeClose=!0,this.shapeFill=!0,this.pathRotation=!1,this.lastPathTime=0,this.destroyed=!1,this.unbreakable=!1,this.isRotating=!1,this.rotation=0,this.misplaced=!1,this.retina={maxDistance:{}},this.outType=m.x.normal,this.ignoresResizeRatio=!0;const h=o.retina.pixelRatio,c=o.actualOptions,l=(0,v.y)(this._engine,o,c.particles),d=l.reduceDuplicates,p=l.effect.type,u=l.shape.type;this.effect=(0,r.TA)(p,this.id,d),this.shape=(0,r.TA)(u,this.id,d);const f=l.effect,_=l.shape;if(e){if(e.effect?.type){const t=e.effect.type,i=(0,r.TA)(t,this.id,d);i&&(this.effect=i,f.load(e.effect))}if(e.shape?.type){const t=e.shape.type,i=(0,r.TA)(t,this.id,d);i&&(this.shape=i,_.load(e.shape))}}if(this.effect===n.mR){const t=[...this.container.effectDrawers.keys()];this.effect=t[Math.floor((0,s.G0)()*t.length)]}if(this.shape===n.mR){const t=[...this.container.shapeDrawers.keys()];this.shape=t[Math.floor((0,s.G0)()*t.length)]}this.effectData=this.effect?function(t,i,e,s){const n=i.options[t];return(0,r.zw)({close:i.close,fill:i.fill},(0,r.TA)(n,e,s))}(this.effect,f,this.id,d):void 0,this.shapeData=this.shape?function(t,i,e,s){const n=i.options[t];return(0,r.zw)({close:i.close,fill:i.fill},(0,r.TA)(n,e,s))}(this.shape,_,this.id,d):void 0,l.load(e);const g=this.effectData;g&&l.load(g.particles);const y=this.shapeData;y&&l.load(y.particles),this.effectFill=g?.fill??l.effect.fill,this.effectClose=g?.close??l.effect.close,this.shapeFill=y?.fill??l.shape.fill,this.shapeClose=y?.close??l.shape.close,this.options=l;const w=this.options.move.path;this.pathDelay=(0,s.VG)(w.delay.value)*n.Xu,w.generator&&(this.pathGenerator=this._engine.getPathGenerator(w.generator),this.pathGenerator&&o.addPath(w.generator,this.pathGenerator)&&this.pathGenerator.init(o)),o.retina.initParticle(this),this.size=(0,r.Xs)(this.options.size,h),this.bubble={inRange:!1},this.slow={inRange:!1,factor:1},this._initPosition(i),this.initialVelocity=this._calculateVelocity(),this.velocity=this.initialVelocity.copy(),this.moveDecay=n.WH-(0,s.VG)(this.options.move.decay);const b=o.particles;let z,P;b.setLastZIndex(this.position.z),this.zIndexFactor=this.position.z/o.zLayers,this.sides=24,this.effect&&(z=o.effectDrawers.get(this.effect),z||(z=this._engine.getEffectDrawer(this.effect),z&&o.effectDrawers.set(this.effect,z))),z?.loadEffect&&z.loadEffect(this),this.shape&&(P=o.shapeDrawers.get(this.shape),P||(P=this._engine.getShapeDrawer(this.shape),P&&o.shapeDrawers.set(this.shape,P))),P?.loadShape&&P.loadShape(this);const D=P?.getSidesCount;D&&(this.sides=D(this)),this.spawning=!1;for(const t of b.updaters)t.init(this);for(const t of b.movers)t.init(this);z?.particleInit?.(o,this),P?.particleInit?.(o,this);for(const t of o.plugins)t.particleCreated?.(this)}isInsideCanvas(){const t=this.getRadius(),i=this.container.canvas.size,e=this.position;return e.x>=-t&&e.y>=-t&&e.y<=i.height+t&&e.x<=i.width+t}isVisible(){return!this.destroyed&&!this.spawning&&this.isInsideCanvas()}reset(){for(const t of this.container.particles.updaters)t.reset?.(this)}}var z=e(8229),P=e(2984);class D{constructor(t,i){this.rectangle=t,this.capacity=i,this._subdivide=()=>{const{x:t,y:i}=this.rectangle.position,{width:e,height:s}=this.rectangle.size,{capacity:a}=this;for(let r=0;r<n.Pg;r++){const o=r%n.gd;this._subs.push(new D(new P.M_(t+e*n.MX*o,i+s*n.MX*(Math.round(r*n.MX)-o),e*n.MX,s*n.MX),a))}this._divided=!0},this._points=[],this._divided=!1,this._subs=[]}insert(t){return!!this.rectangle.contains(t.position)&&(this._points.length<this.capacity?(this._points.push(t),!0):(this._divided||this._subdivide(),this._subs.some((i=>i.insert(t)))))}query(t,i){const e=[];if(!t.intersects(this.rectangle))return[];for(const n of this._points)!t.contains(n.position)&&(0,s.Yf)(t.position,n.position)>n.particle.getRadius()&&(!i||i(n.particle))||e.push(n.particle);if(this._divided)for(const s of this._subs)e.push(...s.query(t,i));return e}queryCircle(t,i,e){return this.query(new P.jl(t.x,t.y,i),e)}queryRectangle(t,i,e){return this.query(new P.M_(t.x,t.y,i.width,i.height),e)}}var x=e(7932);const O=t=>{const{height:i,width:e}=t;return new P.M_(n.un*e,n.un*i,n.Rh*e,n.Rh*i)};class S{constructor(t,i){this._addToPool=(...t)=>{this._pool.push(...t)},this._applyDensity=(t,i,e,s)=>{const a=t.number;if(!a.density.enable)return void(void 0===e?this._limit=a.limit.value:(s?.number.limit.value??a.limit.value)&&this._groupLimits.set(e,s?.number.limit.value??a.limit.value));const r=this._initDensityFactor(a.density),o=a.value,h=a.limit.value>n.ou?a.limit.value:o,c=Math.min(o,h)*r+i,l=Math.min(this.count,this.filter((t=>t.group===e)).length);void 0===e?this._limit=a.limit.value*r:this._groupLimits.set(e,a.limit.value*r),l<c?this.push(Math.abs(c-l),void 0,t,e):l>c&&this.removeQuantity(l-c,e)},this._initDensityFactor=t=>{const i=this._container;if(!i.canvas.element||!t.enable)return n.lA;const e=i.canvas.element,s=i.retina.pixelRatio;return e.width*e.height/(t.height*t.width*s**n.dm)},this._pushParticle=(t,i,e,s)=>{try{const n=this._pool.pop()??new b(this._engine,this._container);n.init(this._nextId,t,i,e);let a=!0;if(s&&(a=s(n)),!a)return;return this._array.push(n),this._zArray.push(n),this._nextId++,this._engine.dispatchEvent(p.B.particleAdded,{container:this._container,data:{particle:n}}),n}catch(t){(0,x.t)().warning(`error adding particle: ${t}`)}},this._removeParticle=(t,i,e)=>{const s=this._array[t];if(!s)return!1;if(s.group!==i)return!1;const a=this._zArray.indexOf(s);return this._array.splice(t,n.LD),this._zArray.splice(a,n.LD),s.destroy(e),this._engine.dispatchEvent(p.B.particleRemoved,{container:this._container,data:{particle:s}}),this._addToPool(s),!0},this._engine=t,this._container=i,this._nextId=0,this._array=[],this._zArray=[],this._pool=[],this._limit=0,this._groupLimits=new Map,this._needsSort=!1,this._lastZIndex=0,this._pluginsInitialized=!1;const e=i.canvas.size;this.quadTree=new D(O(e),n.Kw),this.movers=[],this.updaters=[]}get count(){return this._array.length}addParticle(t,i,e,s){const a=this._container.actualOptions.particles.number.limit.mode,r=void 0===e?this._limit:this._groupLimits.get(e)??this._limit,o=this.count;if(r>n.ou)switch(a){case f.d.delete:{const t=o+n.nq-r;t>n.wM&&this.removeQuantity(t);break}case f.d.wait:if(o>=r)return}return this._pushParticle(t,i,e,s)}clear(){this._array=[],this._zArray=[],this._pluginsInitialized=!1}destroy(){this._array=[],this._zArray=[],this.movers=[],this.updaters=[]}drawParticles(t){for(const i of this._zArray)i.draw(t)}filter(t){return this._array.filter(t)}find(t){return this._array.find(t)}get(t){return this._array[t]}async init(){const t=this._container,i=t.actualOptions;this._lastZIndex=0,this._needsSort=!1;for(const i of t.plugins)i.redrawInit&&await i.redrawInit();await this.initPlugins();let e=!1;for(const i of t.plugins)if(e=i.particlesInitialization?.()??e,e)break;if(!e){const t=i.particles,e=t.groups;for(const i in e){const s=e[i];if(s)for(let e=this.count,n=0;n<s.number.value&&e<t.number.value;e++,n++)this.addParticle(void 0,s,i)}for(let i=this.count;i<t.number.value;i++)this.addParticle()}}async initPlugins(){if(this._pluginsInitialized)return;const t=this._container;this.movers=await this._engine.getMovers(t,!0),this.updaters=await this._engine.getUpdaters(t,!0);for(const i of t.pathGenerators.values())i.init(t)}push(t,i,e,s){for(let n=0;n<t;n++)this.addParticle(i,e,s)}async redraw(){this.clear(),await this.init(),this._container.canvas.drawParticles({value:0,factor:0})}remove(t,i,e){this.removeAt(this._array.indexOf(t),void 0,i,e)}removeAt(t,i=n.xd,e,s){if(t<n.z9||t>this.count)return;let a=0;for(let n=t;a<i&&n<this.count;n++)this._removeParticle(n,e,s)&&(n--,a++)}removeQuantity(t,i){this.removeAt(n.z9,t,i)}setDensity(){const t=this._container.actualOptions,i=t.particles.groups;let e=0;for(const t of this._container.plugins)t.particlesDensityCount&&(e+=t.particlesDensityCount());for(const t in i){const s=i[t];if(!s)continue;const n=(0,v.y)(this._engine,this._container,s);this._applyDensity(n,e,t)}this._applyDensity(t.particles,e)}setLastZIndex(t){this._lastZIndex=t,this._needsSort=this._needsSort||this._lastZIndex<t}setResizeFactor(t){this._resizeFactor=t}update(t){const i=this._container,e=new Set;this.quadTree=new D(O(i.canvas.size),n.Kw);for(const t of i.pathGenerators.values())t.update();for(const e of i.plugins)e.update?.(t);const s=this._resizeFactor;for(const i of this._array){s&&!i.ignoresResizeRatio&&(i.position.x*=s.width,i.position.y*=s.height,i.initialPosition.x*=s.width,i.initialPosition.y*=s.height),i.ignoresResizeRatio=!1;for(const t of this._container.plugins)t.particleReset&&t.particleReset(i);for(const e of this._container.plugins){if(i.destroyed)break;e.particleUpdate?.(i,t)}for(const e of this.movers)e.isEnabled(i)&&e.move(i,t);i.destroyed?e.add(i):this.quadTree.insert(new z.b(i.getPosition(),i))}if(e.size){const t=t=>!e.has(t);this._array=this.filter(t),this._zArray=this._zArray.filter(t);for(const t of e)this._engine.dispatchEvent(p.B.particleRemoved,{container:this._container,data:{particle:t}});this._addToPool(...e)}for(const e of i.plugins)e.postUpdate&&e.postUpdate(t);for(const e of this._array){for(const i of this.updaters)i.update(e,t);if(!e.destroyed&&!e.spawning)for(const s of i.plugins)s.postParticleUpdate&&s.postParticleUpdate(e,t)}if(delete this._resizeFactor,this._needsSort){const t=this._zArray;t.sort(((t,i)=>i.position.z-t.position.z||t.id-i.id));const i=t[t.length-n.K3];if(!i)return;this._lastZIndex=i.position.z,this._needsSort=!1}}}class R{constructor(t){this.container=t,this.pixelRatio=n.$x,this.reduceFactor=n.Zp}init(){const t=this.container,i=t.actualOptions;this.pixelRatio=i.detectRetina?devicePixelRatio:n.$x,this.reduceFactor=n.Zp;const e=this.pixelRatio,a=t.canvas;if(a.element){const t=a.element;a.size.width=t.offsetWidth*e,a.size.height=t.offsetHeight*e}const r=i.particles,o=r.move;this.maxSpeed=(0,s.VG)(o.gravity.maxSpeed)*e,this.sizeAnimationSpeed=(0,s.VG)(r.size.animation.speed)*e}initParticle(t){const i=t.options,e=this.pixelRatio,n=i.move,a=n.distance,r=t.retina;r.moveDrift=(0,s.VG)(n.drift)*e,r.moveSpeed=(0,s.VG)(n.speed)*e,r.sizeAnimationSpeed=(0,s.VG)(i.size.animation.speed)*e;const o=r.maxDistance;o.horizontal=void 0!==a.horizontal?a.horizontal*e:void 0,o.vertical=void 0!==a.vertical?a.vertical*e:void 0,r.maxSpeed=(0,s.VG)(n.gravity.maxSpeed)*e}}function C(t){return!t.destroyed}function T(t,i,...e){const s=new u.J(t,i);return(0,v.Z)(s,...e),s}class M{constructor(t,i,e){this._delta={value:0,factor:0},this._nextFrame=t=>{try{if(!this._smooth&&void 0!==this._lastFrameTime&&t<this._lastFrameTime+n.Xu/this.fpsLimit)return void this.draw(!1);if(this._lastFrameTime??=t,function(t,i,e=n.z$,s=!1){t.value=i,t.factor=s?n.z$/e:n.z$*i/n.Xu}(this._delta,t-this._lastFrameTime,this.fpsLimit,this._smooth),this.addLifeTime(this._delta.value),this._lastFrameTime=t,this._delta.value>n.Xu)return void this.draw(!1);if(this.canvas.drawParticles(this._delta),!this.alive())return void this.destroy();this.animationStatus&&this.draw(!1)}catch(t){(0,x.t)().error("error in animation loop",t)}},this._engine=t,this.id=Symbol(i),this.fpsLimit=120,this.hdr=!1,this._smooth=!1,this._delay=0,this._duration=0,this._lifeTime=0,this._firstStart=!0,this.started=!1,this.destroyed=!1,this._paused=!0,this._lastFrameTime=0,this.zLayers=100,this.pageHidden=!1,this._sourceOptions=e,this._initialSourceOptions=e,this.retina=new R(this),this.canvas=new l(this,this._engine),this.particles=new S(this._engine,this),this.pathGenerators=new Map,this.plugins=[],this.effectDrawers=new Map,this.shapeDrawers=new Map,this._options=T(this._engine,this),this.actualOptions=T(this._engine,this),this._eventListeners=new d(this),this._engine.dispatchEvent(p.B.containerBuilt,{container:this})}get animationStatus(){return!this._paused&&!this.pageHidden&&C(this)}get options(){return this._options}get sourceOptions(){return this._sourceOptions}addLifeTime(t){this._lifeTime+=t}addPath(t,i,e=!1){return!(!C(this)||!e&&this.pathGenerators.has(t))&&(this.pathGenerators.set(t,i),!0)}alive(){return!this._duration||this._lifeTime<=this._duration}destroy(t=!0){if(C(this)){this.stop(),this.particles.destroy(),this.canvas.destroy();for(const t of this.effectDrawers.values())t.destroy?.(this);this.effectDrawers.clear();for(const t of this.shapeDrawers.values())t.destroy?.(this);this.shapeDrawers.clear();for(const t of this.plugins)t.destroy?.();if(this.plugins.length=0,this._engine.clearPlugins(this),this.destroyed=!0,t){const t=this._engine.items,i=t.indexOf(this);i>=n.vF&&t.splice(i,n.JC)}this._engine.dispatchEvent(p.B.containerDestroyed,{container:this})}}draw(t){if(!C(this))return;let i=t;const e=t=>{i&&(this._lastFrameTime=void 0,i=!1),this._nextFrame(t)};this._drawAnimationFrame=(0,s.i0)((t=>{e(t)}))}async export(t,i={}){for(const e of this.plugins){if(!e.export)continue;const s=await e.export(t,i);if(s.supported)return s.blob}(0,x.t)().error(`Export plugin with type ${t} not found`)}async init(){if(!C(this))return;const t=this._engine.getSupportedEffects();for(const i of t){const t=this._engine.getEffectDrawer(i);t&&this.effectDrawers.set(i,t)}const i=this._engine.getSupportedShapes();for(const t of i){const i=this._engine.getShapeDrawer(t);i&&this.shapeDrawers.set(t,i)}const e=new Map;for(const t of this._engine.plugins){const i=await t.getPlugin(this);i.preInit&&await i.preInit(),e.set(t,i)}await this.particles.initPlugins(),this._options=T(this._engine,this,this._initialSourceOptions,this.sourceOptions),this.actualOptions=T(this._engine,this,this._options);for(const[t,i]of e)t.needsPlugin(this.actualOptions)&&this.plugins.push(i);this.retina.init(),this.canvas.init(),this.updateActualOptions(),this.canvas.initBackground(),this.canvas.resize();const{delay:a,duration:r,fpsLimit:o,hdr:h,smooth:c,zLayers:l}=this.actualOptions;this.hdr=h,this.zLayers=l,this._duration=(0,s.VG)(r)*n.Xu,this._delay=(0,s.VG)(a)*n.Xu,this._lifeTime=0,this.fpsLimit=o>n.DN?o:n.i8,this._smooth=c;for(const t of this.plugins)await(t.init?.());for(const t of this.effectDrawers.values())await(t.init?.(this));for(const t of this.shapeDrawers.values())await(t.init?.(this));this._engine.dispatchEvent(p.B.containerInit,{container:this}),await this.particles.init(),this.particles.setDensity();for(const t of this.plugins)t.particlesSetup?.();this._engine.dispatchEvent(p.B.particlesSetup,{container:this})}pause(){if(C(this)&&(void 0!==this._drawAnimationFrame&&((0,s.px)(this._drawAnimationFrame),delete this._drawAnimationFrame),!this._paused)){for(const t of this.plugins)t.pause?.();this.pageHidden||(this._paused=!0),this._engine.dispatchEvent(p.B.containerPaused,{container:this})}}play(t){if(!C(this))return;const i=this._paused||t;if(!this._firstStart||this.actualOptions.autoPlay){if(this._paused&&(this._paused=!1),i)for(const t of this.plugins)t.play&&t.play();this._engine.dispatchEvent(p.B.containerPlay,{container:this}),this.draw(i??!1)}else this._firstStart=!1}async refresh(){if(C(this))return this.stop(),this.start()}async reset(t){if(C(this))return this._initialSourceOptions=t,this._sourceOptions=t,this._options=T(this._engine,this,this._initialSourceOptions,this.sourceOptions),this.actualOptions=T(this._engine,this,this._options),this.refresh()}async start(){C(this)&&!this.started&&(await this.init(),this.started=!0,await new Promise((t=>{const i=async()=>{this._eventListeners.addListeners();for(const t of this.plugins)await(t.start?.());this._engine.dispatchEvent(p.B.containerStarted,{container:this}),this.play(),t()};this._delayTimeout=setTimeout((()=>{i()}),this._delay)})))}stop(){if(C(this)&&this.started){this._delayTimeout&&(clearTimeout(this._delayTimeout),delete this._delayTimeout),this._firstStart=!0,this.started=!1,this._eventListeners.removeListeners(),this.pause(),this.particles.clear(),this.canvas.stop();for(const t of this.plugins)t.stop?.();this.plugins.length=0,this._sourceOptions=this._options,this._engine.dispatchEvent(p.B.containerStopped,{container:this})}}updateActualOptions(){let t=!1;for(const i of this.plugins)i.updateActualOptions&&(t=i.updateActualOptions()||t);return t}}}}]);
|
package/794.min.js.LICENSE.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Engine v4.0.0-alpha.5 by Matteo Bruni */
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Circle, Rectangle } from "./Ranges.js";
|
|
2
|
-
import { double, half, subdivideCount } from "./Constants.js";
|
|
3
|
-
import { getDistance } from "../../Utils/MathUtils.js";
|
|
4
|
-
export class QuadTree {
|
|
5
|
-
constructor(rectangle, capacity) {
|
|
6
|
-
this.rectangle = rectangle;
|
|
7
|
-
this.capacity = capacity;
|
|
8
|
-
this._subdivide = () => {
|
|
9
|
-
const { x, y } = this.rectangle.position, { width, height } = this.rectangle.size, { capacity } = this;
|
|
10
|
-
for (let i = 0; i < subdivideCount; i++) {
|
|
11
|
-
const fixedIndex = i % double;
|
|
12
|
-
this._subs.push(new QuadTree(new Rectangle(x + width * half * fixedIndex, y + height * half * (Math.round(i * half) - fixedIndex), width * half, height * half), capacity));
|
|
13
|
-
}
|
|
14
|
-
this._divided = true;
|
|
15
|
-
};
|
|
16
|
-
this._points = [];
|
|
17
|
-
this._divided = false;
|
|
18
|
-
this._subs = [];
|
|
19
|
-
}
|
|
20
|
-
insert(point) {
|
|
21
|
-
if (!this.rectangle.contains(point.position)) {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
if (this._points.length < this.capacity) {
|
|
25
|
-
this._points.push(point);
|
|
26
|
-
return true;
|
|
27
|
-
}
|
|
28
|
-
if (!this._divided) {
|
|
29
|
-
this._subdivide();
|
|
30
|
-
}
|
|
31
|
-
return this._subs.some(sub => sub.insert(point));
|
|
32
|
-
}
|
|
33
|
-
query(range, check) {
|
|
34
|
-
const res = [];
|
|
35
|
-
if (!range.intersects(this.rectangle)) {
|
|
36
|
-
return [];
|
|
37
|
-
}
|
|
38
|
-
for (const p of this._points) {
|
|
39
|
-
if (!range.contains(p.position) &&
|
|
40
|
-
getDistance(range.position, p.position) > p.particle.getRadius() &&
|
|
41
|
-
(!check || check(p.particle))) {
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
res.push(p.particle);
|
|
45
|
-
}
|
|
46
|
-
if (this._divided) {
|
|
47
|
-
for (const sub of this._subs) {
|
|
48
|
-
res.push(...sub.query(range, check));
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return res;
|
|
52
|
-
}
|
|
53
|
-
queryCircle(position, radius, check) {
|
|
54
|
-
return this.query(new Circle(position.x, position.y, radius), check);
|
|
55
|
-
}
|
|
56
|
-
queryRectangle(position, size, check) {
|
|
57
|
-
return this.query(new Rectangle(position.x, position.y, size.width, size.height), check);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { isNull } from "../../../../Utils/TypeUtils.js";
|
|
2
|
-
import { setRangeValue } from "../../../../Utils/MathUtils.js";
|
|
3
|
-
export class MoveAttract {
|
|
4
|
-
constructor() {
|
|
5
|
-
this.distance = 200;
|
|
6
|
-
this.enable = false;
|
|
7
|
-
this.rotate = {
|
|
8
|
-
x: 3000,
|
|
9
|
-
y: 3000,
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
load(data) {
|
|
13
|
-
if (isNull(data)) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
if (data.distance !== undefined) {
|
|
17
|
-
this.distance = setRangeValue(data.distance);
|
|
18
|
-
}
|
|
19
|
-
if (data.enable !== undefined) {
|
|
20
|
-
this.enable = data.enable;
|
|
21
|
-
}
|
|
22
|
-
if (data.rotate) {
|
|
23
|
-
const rotateX = data.rotate.x;
|
|
24
|
-
if (rotateX !== undefined) {
|
|
25
|
-
this.rotate.x = rotateX;
|
|
26
|
-
}
|
|
27
|
-
const rotateY = data.rotate.y;
|
|
28
|
-
if (rotateY !== undefined) {
|
|
29
|
-
this.rotate.y = rotateY;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
package/cjs/Core/Utils/Point.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Circle, Rectangle } from "./Ranges.js";
|
|
2
|
-
import { double, half, subdivideCount } from "./Constants.js";
|
|
3
|
-
import { getDistance } from "../../Utils/MathUtils.js";
|
|
4
|
-
export class QuadTree {
|
|
5
|
-
constructor(rectangle, capacity) {
|
|
6
|
-
this.rectangle = rectangle;
|
|
7
|
-
this.capacity = capacity;
|
|
8
|
-
this._subdivide = () => {
|
|
9
|
-
const { x, y } = this.rectangle.position, { width, height } = this.rectangle.size, { capacity } = this;
|
|
10
|
-
for (let i = 0; i < subdivideCount; i++) {
|
|
11
|
-
const fixedIndex = i % double;
|
|
12
|
-
this._subs.push(new QuadTree(new Rectangle(x + width * half * fixedIndex, y + height * half * (Math.round(i * half) - fixedIndex), width * half, height * half), capacity));
|
|
13
|
-
}
|
|
14
|
-
this._divided = true;
|
|
15
|
-
};
|
|
16
|
-
this._points = [];
|
|
17
|
-
this._divided = false;
|
|
18
|
-
this._subs = [];
|
|
19
|
-
}
|
|
20
|
-
insert(point) {
|
|
21
|
-
if (!this.rectangle.contains(point.position)) {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
if (this._points.length < this.capacity) {
|
|
25
|
-
this._points.push(point);
|
|
26
|
-
return true;
|
|
27
|
-
}
|
|
28
|
-
if (!this._divided) {
|
|
29
|
-
this._subdivide();
|
|
30
|
-
}
|
|
31
|
-
return this._subs.some(sub => sub.insert(point));
|
|
32
|
-
}
|
|
33
|
-
query(range, check) {
|
|
34
|
-
const res = [];
|
|
35
|
-
if (!range.intersects(this.rectangle)) {
|
|
36
|
-
return [];
|
|
37
|
-
}
|
|
38
|
-
for (const p of this._points) {
|
|
39
|
-
if (!range.contains(p.position) &&
|
|
40
|
-
getDistance(range.position, p.position) > p.particle.getRadius() &&
|
|
41
|
-
(!check || check(p.particle))) {
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
res.push(p.particle);
|
|
45
|
-
}
|
|
46
|
-
if (this._divided) {
|
|
47
|
-
for (const sub of this._subs) {
|
|
48
|
-
res.push(...sub.query(range, check));
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return res;
|
|
52
|
-
}
|
|
53
|
-
queryCircle(position, radius, check) {
|
|
54
|
-
return this.query(new Circle(position.x, position.y, radius), check);
|
|
55
|
-
}
|
|
56
|
-
queryRectangle(position, size, check) {
|
|
57
|
-
return this.query(new Rectangle(position.x, position.y, size.width, size.height), check);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { isNull } from "../../../../Utils/TypeUtils.js";
|
|
2
|
-
import { setRangeValue } from "../../../../Utils/MathUtils.js";
|
|
3
|
-
export class MoveAttract {
|
|
4
|
-
constructor() {
|
|
5
|
-
this.distance = 200;
|
|
6
|
-
this.enable = false;
|
|
7
|
-
this.rotate = {
|
|
8
|
-
x: 3000,
|
|
9
|
-
y: 3000,
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
load(data) {
|
|
13
|
-
if (isNull(data)) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
if (data.distance !== undefined) {
|
|
17
|
-
this.distance = setRangeValue(data.distance);
|
|
18
|
-
}
|
|
19
|
-
if (data.enable !== undefined) {
|
|
20
|
-
this.enable = data.enable;
|
|
21
|
-
}
|
|
22
|
-
if (data.rotate) {
|
|
23
|
-
const rotateX = data.rotate.x;
|
|
24
|
-
if (rotateX !== undefined) {
|
|
25
|
-
this.rotate.x = rotateX;
|
|
26
|
-
}
|
|
27
|
-
const rotateY = data.rotate.y;
|
|
28
|
-
if (rotateY !== undefined) {
|
|
29
|
-
this.rotate.y = rotateY;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|