@tsparticles/engine 3.0.0-alpha.0 → 3.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/README.md +246 -211
- package/browser/Core/Canvas.js +271 -241
- package/browser/Core/Container.js +90 -106
- package/browser/Core/Engine.js +271 -0
- package/browser/Core/Particle.js +158 -162
- package/browser/Core/Particles.js +148 -134
- package/browser/Core/Retina.js +15 -13
- package/browser/Core/Utils/Circle.js +10 -6
- package/browser/Core/Utils/Constants.js +4 -3
- package/browser/Core/Utils/EventListeners.js +259 -220
- package/browser/Core/Utils/InteractionManager.js +6 -16
- package/browser/Core/Utils/QuadTree.js +14 -20
- package/browser/Core/Utils/Vector3d.js +17 -9
- package/browser/Options/Classes/AnimatableColor.js +2 -1
- package/browser/Options/Classes/AnimationOptions.js +7 -2
- package/browser/Options/Classes/BackgroundMask/BackgroundMask.js +2 -1
- package/browser/Options/Classes/ColorAnimation.js +4 -0
- package/browser/Options/Classes/Interactivity/Events/DivEvent.js +0 -24
- package/browser/Options/Classes/Interactivity/Events/Events.js +5 -24
- package/browser/Options/Classes/Interactivity/Interactivity.js +1 -8
- package/browser/Options/Classes/Interactivity/Modes/Modes.js +11 -8
- package/browser/Options/Classes/ManualParticle.js +5 -5
- package/browser/Options/Classes/Options.js +19 -39
- package/browser/Options/Classes/OptionsColor.js +3 -2
- package/browser/Options/Classes/Particles/Collisions/Collisions.js +5 -0
- package/browser/Options/Classes/Particles/Move/Move.js +11 -41
- package/browser/Options/Classes/Particles/Move/MoveAttract.js +9 -20
- package/browser/Options/Classes/Particles/Move/MoveTrail.js +2 -8
- package/browser/Options/Classes/Particles/Move/OutModes.js +4 -5
- package/browser/Options/Classes/Particles/Move/Spin.js +3 -1
- package/browser/Options/Classes/Particles/Number/ParticlesDensity.js +2 -21
- package/browser/Options/Classes/Particles/Number/ParticlesNumber.js +2 -9
- package/browser/Options/Classes/Particles/Opacity/Opacity.js +11 -7
- package/browser/Options/Classes/Particles/Opacity/OpacityAnimation.js +0 -9
- package/browser/Options/Classes/Particles/ParticlesOptions.js +6 -11
- package/browser/Options/Classes/Particles/Shape/Shape.js +9 -2
- package/browser/Options/Classes/Particles/Size/Size.js +11 -7
- package/browser/Options/Classes/Particles/Size/SizeAnimation.js +0 -9
- package/browser/Options/Classes/ValueWithRandom.js +4 -17
- package/browser/Utils/CanvasUtils.js +18 -54
- package/browser/Utils/ColorUtils.js +17 -19
- package/browser/Utils/EventDispatcher.js +7 -6
- package/browser/Utils/HslColorManager.js +2 -4
- package/browser/Utils/NumberUtils.js +41 -45
- package/browser/Utils/RgbColorManager.js +2 -4
- package/browser/Utils/Utils.js +150 -59
- package/browser/bundle.js +4 -96
- package/browser/export-types.js +97 -0
- package/browser/exports.js +89 -0
- package/browser/index.js +8 -198
- package/browser/init.js +12 -0
- package/cjs/Core/Canvas.js +269 -239
- package/cjs/Core/Container.js +90 -106
- package/cjs/Core/Engine.js +275 -0
- package/cjs/Core/Particle.js +157 -161
- package/cjs/Core/Particles.js +148 -134
- package/cjs/Core/Retina.js +15 -13
- package/cjs/Core/Utils/Circle.js +10 -6
- package/cjs/Core/Utils/Constants.js +5 -4
- package/cjs/Core/Utils/EventListeners.js +258 -219
- package/cjs/Core/Utils/InteractionManager.js +6 -16
- package/cjs/Core/Utils/QuadTree.js +14 -20
- package/cjs/Core/Utils/Vector3d.js +17 -9
- package/cjs/Options/Classes/AnimatableColor.js +2 -1
- package/cjs/Options/Classes/AnimationOptions.js +7 -2
- package/cjs/Options/Classes/BackgroundMask/BackgroundMask.js +2 -1
- package/cjs/Options/Classes/ColorAnimation.js +4 -0
- package/cjs/Options/Classes/Interactivity/Events/DivEvent.js +0 -24
- package/cjs/Options/Classes/Interactivity/Events/Events.js +5 -24
- package/cjs/Options/Classes/Interactivity/Interactivity.js +1 -8
- package/cjs/Options/Classes/Interactivity/Modes/Modes.js +11 -8
- package/cjs/Options/Classes/ManualParticle.js +5 -5
- package/cjs/Options/Classes/Options.js +18 -38
- package/cjs/Options/Classes/OptionsColor.js +3 -2
- package/cjs/Options/Classes/Particles/Collisions/Collisions.js +5 -0
- package/cjs/Options/Classes/Particles/Move/Move.js +11 -41
- package/cjs/Options/Classes/Particles/Move/MoveAttract.js +9 -20
- package/cjs/Options/Classes/Particles/Move/MoveTrail.js +2 -8
- package/cjs/Options/Classes/Particles/Move/OutModes.js +4 -5
- package/cjs/Options/Classes/Particles/Move/Spin.js +3 -1
- package/cjs/Options/Classes/Particles/Number/ParticlesDensity.js +2 -21
- package/cjs/Options/Classes/Particles/Number/ParticlesNumber.js +2 -9
- package/cjs/Options/Classes/Particles/Opacity/Opacity.js +10 -6
- package/cjs/Options/Classes/Particles/Opacity/OpacityAnimation.js +0 -9
- package/cjs/Options/Classes/Particles/ParticlesOptions.js +6 -11
- package/cjs/Options/Classes/Particles/Shape/Shape.js +9 -2
- package/cjs/Options/Classes/Particles/Size/Size.js +11 -7
- package/cjs/Options/Classes/Particles/Size/SizeAnimation.js +0 -9
- package/cjs/Options/Classes/ValueWithRandom.js +4 -17
- package/cjs/Utils/CanvasUtils.js +21 -58
- package/cjs/Utils/ColorUtils.js +16 -18
- package/cjs/Utils/EventDispatcher.js +7 -6
- package/cjs/Utils/HslColorManager.js +2 -4
- package/cjs/Utils/NumberUtils.js +41 -45
- package/cjs/Utils/RgbColorManager.js +2 -4
- package/cjs/Utils/Utils.js +163 -63
- package/cjs/bundle.js +4 -96
- package/cjs/export-types.js +113 -0
- package/cjs/exports.js +105 -0
- package/cjs/index.js +8 -198
- package/cjs/init.js +16 -0
- package/esm/Core/Canvas.js +271 -241
- package/esm/Core/Container.js +90 -106
- package/esm/Core/Engine.js +271 -0
- package/esm/Core/Particle.js +158 -162
- package/esm/Core/Particles.js +148 -134
- package/esm/Core/Retina.js +15 -13
- package/esm/Core/Utils/Circle.js +10 -6
- package/esm/Core/Utils/Constants.js +4 -3
- package/esm/Core/Utils/EventListeners.js +259 -220
- package/esm/Core/Utils/InteractionManager.js +6 -16
- package/esm/Core/Utils/QuadTree.js +14 -20
- package/esm/Core/Utils/Vector3d.js +17 -9
- package/esm/Options/Classes/AnimatableColor.js +2 -1
- package/esm/Options/Classes/AnimationOptions.js +7 -2
- package/esm/Options/Classes/BackgroundMask/BackgroundMask.js +2 -1
- package/esm/Options/Classes/ColorAnimation.js +4 -0
- package/esm/Options/Classes/Interactivity/Events/DivEvent.js +0 -24
- package/esm/Options/Classes/Interactivity/Events/Events.js +5 -24
- package/esm/Options/Classes/Interactivity/Interactivity.js +1 -8
- package/esm/Options/Classes/Interactivity/Modes/Modes.js +11 -8
- package/esm/Options/Classes/ManualParticle.js +5 -5
- package/esm/Options/Classes/Options.js +19 -39
- package/esm/Options/Classes/OptionsColor.js +3 -2
- package/esm/Options/Classes/Particles/Collisions/Collisions.js +5 -0
- package/esm/Options/Classes/Particles/Move/Move.js +11 -41
- package/esm/Options/Classes/Particles/Move/MoveAttract.js +9 -20
- package/esm/Options/Classes/Particles/Move/MoveTrail.js +2 -8
- package/esm/Options/Classes/Particles/Move/OutModes.js +4 -5
- package/esm/Options/Classes/Particles/Move/Spin.js +3 -1
- package/esm/Options/Classes/Particles/Number/ParticlesDensity.js +2 -21
- package/esm/Options/Classes/Particles/Number/ParticlesNumber.js +2 -9
- package/esm/Options/Classes/Particles/Opacity/Opacity.js +11 -7
- package/esm/Options/Classes/Particles/Opacity/OpacityAnimation.js +0 -9
- package/esm/Options/Classes/Particles/ParticlesOptions.js +6 -11
- package/esm/Options/Classes/Particles/Shape/Shape.js +9 -2
- package/esm/Options/Classes/Particles/Size/Size.js +11 -7
- package/esm/Options/Classes/Particles/Size/SizeAnimation.js +0 -9
- package/esm/Options/Classes/ValueWithRandom.js +4 -17
- package/esm/Utils/CanvasUtils.js +18 -54
- package/esm/Utils/ColorUtils.js +17 -19
- package/esm/Utils/EventDispatcher.js +7 -6
- package/esm/Utils/HslColorManager.js +2 -4
- package/esm/Utils/NumberUtils.js +41 -45
- package/esm/Utils/RgbColorManager.js +2 -4
- package/esm/Utils/Utils.js +150 -59
- package/esm/bundle.js +4 -96
- package/esm/export-types.js +97 -0
- package/esm/exports.js +89 -0
- package/esm/index.js +8 -198
- package/esm/init.js +12 -0
- package/package.json +17 -2
- package/report.html +4 -4
- package/scripts/install.js +90 -33
- package/tsparticles.engine.js +1848 -1961
- package/tsparticles.engine.min.js +1 -1
- package/tsparticles.engine.min.js.LICENSE.txt +1 -10
- package/types/Core/Canvas.d.ts +20 -16
- package/types/Core/Container.d.ts +10 -14
- package/types/Core/Engine.d.ts +71 -0
- package/types/Core/Interfaces/IContainerPlugin.d.ts +2 -0
- package/types/Core/Interfaces/ICoordinates.d.ts +5 -3
- package/types/Core/Interfaces/IDimension.d.ts +4 -0
- package/types/Core/Interfaces/IMovePathGenerator.d.ts +2 -1
- package/types/Core/Interfaces/IParticleUpdater.d.ts +0 -2
- package/types/Core/Interfaces/IParticleValueAnimation.d.ts +2 -0
- package/types/Core/Interfaces/IPlugin.d.ts +4 -3
- package/types/Core/Particle.d.ts +7 -7
- package/types/Core/Particles.d.ts +14 -10
- package/types/Core/Utils/Constants.d.ts +4 -3
- package/types/Core/Utils/EventListeners.d.ts +20 -14
- package/types/Core/Utils/InteractionManager.d.ts +1 -1
- package/types/Core/Utils/QuadTree.d.ts +2 -5
- package/types/Core/Utils/Vector3d.d.ts +2 -1
- package/types/Enums/Modes/AnimationMode.d.ts +6 -0
- package/types/Enums/Modes/{SizeMode.d.ts → PixelMode.d.ts} +1 -1
- package/types/Options/Classes/AnimationOptions.d.ts +3 -1
- package/types/Options/Classes/ColorAnimation.d.ts +1 -0
- package/types/Options/Classes/Interactivity/Events/DivEvent.d.ts +0 -6
- package/types/Options/Classes/Interactivity/Events/Events.d.ts +0 -6
- package/types/Options/Classes/Interactivity/Interactivity.d.ts +1 -3
- package/types/Options/Classes/Interactivity/Modes/Modes.d.ts +1 -1
- package/types/Options/Classes/ManualParticle.d.ts +2 -2
- package/types/Options/Classes/Options.d.ts +5 -12
- package/types/Options/Classes/Particles/Collisions/Collisions.d.ts +2 -0
- package/types/Options/Classes/Particles/Move/Move.d.ts +0 -11
- package/types/Options/Classes/Particles/Move/MoveAttract.d.ts +0 -4
- package/types/Options/Classes/Particles/Move/MoveCenter.d.ts +2 -2
- package/types/Options/Classes/Particles/Move/MoveTrail.d.ts +0 -3
- package/types/Options/Classes/Particles/Move/Spin.d.ts +2 -2
- package/types/Options/Classes/Particles/Number/ParticlesDensity.d.ts +0 -6
- package/types/Options/Classes/Particles/Number/ParticlesNumber.d.ts +0 -2
- package/types/Options/Classes/Particles/Opacity/Opacity.d.ts +4 -4
- package/types/Options/Classes/Particles/Opacity/OpacityAnimation.d.ts +0 -2
- package/types/Options/Classes/Particles/ParticlesOptions.d.ts +1 -1
- package/types/Options/Classes/Particles/Shape/Shape.d.ts +2 -0
- package/types/Options/Classes/Particles/Size/Size.d.ts +4 -4
- package/types/Options/Classes/Particles/Size/SizeAnimation.d.ts +0 -2
- package/types/Options/Classes/Responsive.d.ts +3 -3
- package/types/Options/Classes/Theme/Theme.d.ts +2 -2
- package/types/Options/Classes/ValueWithRandom.d.ts +2 -6
- package/types/Options/Interfaces/IAnimation.d.ts +3 -1
- package/types/Options/Interfaces/IManualParticle.d.ts +2 -2
- package/types/Options/Interfaces/IOptions.d.ts +1 -4
- package/types/Options/Interfaces/IResponsive.d.ts +4 -3
- package/types/Options/Interfaces/Interactivity/Events/IDivEvent.d.ts +0 -3
- package/types/Options/Interfaces/Interactivity/Events/IEvents.d.ts +0 -3
- package/types/Options/Interfaces/Interactivity/IInteractivity.d.ts +0 -1
- package/types/Options/Interfaces/Interactivity/Modes/IModeDiv.d.ts +0 -1
- package/types/Options/Interfaces/Particles/Collisions/ICollisions.d.ts +2 -0
- package/types/Options/Interfaces/Particles/IStroke.d.ts +2 -1
- package/types/Options/Interfaces/Particles/Move/IMove.d.ts +0 -5
- package/types/Options/Interfaces/Particles/Move/IMoveAttract.d.ts +0 -2
- package/types/Options/Interfaces/Particles/Move/IMoveTrail.d.ts +0 -2
- package/types/Options/Interfaces/Particles/Move/ISpin.d.ts +2 -2
- package/types/Options/Interfaces/Particles/Number/IParticlesDensity.d.ts +0 -3
- package/types/Options/Interfaces/Particles/Number/IParticlesNumber.d.ts +0 -1
- package/types/Options/Interfaces/Particles/Opacity/IOpacity.d.ts +0 -1
- package/types/Options/Interfaces/Particles/Opacity/IOpacityAnimation.d.ts +0 -1
- package/types/Options/Interfaces/Particles/Shape/IShape.d.ts +2 -0
- package/types/Options/Interfaces/Particles/Size/ISize.d.ts +0 -1
- package/types/Options/Interfaces/Particles/Size/ISizeAnimation.d.ts +0 -1
- package/types/Options/Interfaces/Theme/ITheme.d.ts +3 -2
- package/types/Types/ExportResult.d.ts +5 -0
- package/types/Utils/CanvasUtils.d.ts +2 -5
- package/types/Utils/OptionsUtils.d.ts +1 -1
- package/types/Utils/Utils.d.ts +22 -4
- package/types/bundle.d.ts +2 -90
- package/types/export-types.d.ts +107 -0
- package/types/exports.d.ts +89 -0
- package/types/index.d.ts +3 -203
- package/types/init.d.ts +2 -0
- package/umd/Core/Canvas.js +269 -239
- package/umd/Core/Container.js +91 -107
- package/umd/Core/Engine.js +285 -0
- package/umd/Core/Particle.js +158 -162
- package/umd/Core/Particles.js +149 -135
- package/umd/Core/Retina.js +15 -13
- package/umd/Core/Utils/Circle.js +11 -7
- package/umd/Core/Utils/Constants.js +5 -4
- package/umd/Core/Utils/EventListeners.js +258 -219
- package/umd/Core/Utils/InteractionManager.js +6 -16
- package/umd/Core/Utils/QuadTree.js +14 -20
- package/umd/Core/Utils/Vector3d.js +18 -10
- package/umd/Options/Classes/AnimatableColor.js +3 -2
- package/umd/Options/Classes/AnimationOptions.js +7 -2
- package/umd/Options/Classes/BackgroundMask/BackgroundMask.js +3 -2
- package/umd/Options/Classes/ColorAnimation.js +4 -0
- package/umd/Options/Classes/Interactivity/Events/DivEvent.js +1 -25
- package/umd/Options/Classes/Interactivity/Events/Events.js +6 -25
- package/umd/Options/Classes/Interactivity/Interactivity.js +1 -8
- package/umd/Options/Classes/Interactivity/Modes/Modes.js +11 -8
- package/umd/Options/Classes/ManualParticle.js +5 -5
- package/umd/Options/Classes/Options.js +18 -38
- package/umd/Options/Classes/OptionsColor.js +4 -3
- package/umd/Options/Classes/Particles/Collisions/Collisions.js +6 -1
- package/umd/Options/Classes/Particles/Move/Move.js +12 -42
- package/umd/Options/Classes/Particles/Move/MoveAttract.js +9 -20
- package/umd/Options/Classes/Particles/Move/MoveTrail.js +2 -8
- package/umd/Options/Classes/Particles/Move/OutModes.js +4 -5
- package/umd/Options/Classes/Particles/Move/Spin.js +3 -1
- package/umd/Options/Classes/Particles/Number/ParticlesDensity.js +2 -21
- package/umd/Options/Classes/Particles/Number/ParticlesNumber.js +2 -9
- package/umd/Options/Classes/Particles/Opacity/Opacity.js +10 -6
- package/umd/Options/Classes/Particles/Opacity/OpacityAnimation.js +0 -9
- package/umd/Options/Classes/Particles/ParticlesOptions.js +6 -11
- package/umd/Options/Classes/Particles/Shape/Shape.js +9 -2
- package/umd/Options/Classes/Particles/Size/Size.js +12 -8
- package/umd/Options/Classes/Particles/Size/SizeAnimation.js +0 -9
- package/umd/Options/Classes/ValueWithRandom.js +5 -18
- package/umd/Utils/CanvasUtils.js +21 -58
- package/umd/Utils/ColorUtils.js +16 -18
- package/umd/Utils/EventDispatcher.js +7 -6
- package/umd/Utils/HslColorManager.js +2 -4
- package/umd/Utils/NumberUtils.js +42 -46
- package/umd/Utils/RgbColorManager.js +2 -4
- package/umd/Utils/Utils.js +163 -63
- package/umd/bundle.js +5 -97
- package/umd/export-types.js +123 -0
- package/umd/exports.js +115 -0
- package/umd/index.js +9 -199
- package/umd/init.js +26 -0
- package/browser/Core/Utils/FrameManager.js +0 -42
- package/browser/Core/Utils/Plugins.js +0 -112
- package/browser/Options/Interfaces/Particles/Shape/IShapeValues.js +0 -1
- package/browser/Options/Interfaces/Particles/Shape/IStarShape.js +0 -1
- package/browser/engine.js +0 -175
- package/cjs/Core/Utils/FrameManager.js +0 -46
- package/cjs/Core/Utils/Plugins.js +0 -116
- package/cjs/Options/Interfaces/Particles/Shape/ICharacterShape.js +0 -2
- package/cjs/Options/Interfaces/Particles/Shape/IImageShape.js +0 -2
- package/cjs/Options/Interfaces/Particles/Shape/IPolygonShape.js +0 -2
- package/cjs/Options/Interfaces/Particles/Shape/IShapeValues.js +0 -17
- package/cjs/Options/Interfaces/Particles/Shape/IStarShape.js +0 -2
- package/cjs/engine.js +0 -179
- package/esm/Core/Interfaces/IParticleOverride.js +0 -1
- package/esm/Core/Interfaces/IParticlesMover.js +0 -1
- package/esm/Core/Utils/FrameManager.js +0 -42
- package/esm/Core/Utils/Plugins.js +0 -112
- package/esm/Enums/Modes/SizeMode.js +0 -1
- package/esm/Options/Interfaces/Particles/Shape/ICharacterShape.js +0 -1
- package/esm/Options/Interfaces/Particles/Shape/IImageShape.js +0 -1
- package/esm/Options/Interfaces/Particles/Shape/IPolygonShape.js +0 -1
- package/esm/Options/Interfaces/Particles/Shape/IShapeValues.js +0 -1
- package/esm/Options/Interfaces/Particles/Shape/IStarShape.js +0 -1
- package/esm/engine.js +0 -175
- package/types/Core/Interfaces/IParticleOverride.d.ts +0 -6
- package/types/Core/Interfaces/IParticlesMover.d.ts +0 -7
- package/types/Core/Utils/FrameManager.d.ts +0 -6
- package/types/Core/Utils/Plugins.d.ts +0 -51
- package/types/Options/Interfaces/Particles/Shape/ICharacterShape.d.ts +0 -8
- package/types/Options/Interfaces/Particles/Shape/IImageShape.d.ts +0 -8
- package/types/Options/Interfaces/Particles/Shape/IPolygonShape.d.ts +0 -5
- package/types/Options/Interfaces/Particles/Shape/IShapeValues.d.ts +0 -1
- package/types/Options/Interfaces/Particles/Shape/IStarShape.d.ts +0 -6
- package/types/engine.d.ts +0 -39
- package/umd/Core/Utils/FrameManager.js +0 -56
- package/umd/Core/Utils/Plugins.js +0 -126
- package/umd/Options/Interfaces/Particles/Shape/ICharacterShape.js +0 -12
- package/umd/Options/Interfaces/Particles/Shape/IImageShape.js +0 -12
- package/umd/Options/Interfaces/Particles/Shape/IPolygonShape.js +0 -12
- package/umd/Options/Interfaces/Particles/Shape/IShapeValues.js +0 -27
- package/umd/Options/Interfaces/Particles/Shape/IStarShape.js +0 -12
- package/umd/engine.js +0 -189
- /package/browser/{Core/Interfaces/IParticleOverride.js → Enums/Modes/AnimationMode.js} +0 -0
- /package/browser/{Core/Interfaces/IParticlesMover.js → Enums/Modes/PixelMode.js} +0 -0
- /package/browser/{Enums/Modes/SizeMode.js → Types/ExportResult.js} +0 -0
- /package/cjs/{Core/Interfaces/IParticleOverride.js → Enums/Modes/AnimationMode.js} +0 -0
- /package/cjs/{Core/Interfaces/IParticlesMover.js → Enums/Modes/PixelMode.js} +0 -0
- /package/cjs/{Enums/Modes/SizeMode.js → Types/ExportResult.js} +0 -0
- /package/{browser/Options/Interfaces/Particles/Shape/ICharacterShape.js → esm/Enums/Modes/AnimationMode.js} +0 -0
- /package/{browser/Options/Interfaces/Particles/Shape/IImageShape.js → esm/Enums/Modes/PixelMode.js} +0 -0
- /package/{browser/Options/Interfaces/Particles/Shape/IPolygonShape.js → esm/Types/ExportResult.js} +0 -0
- /package/umd/{Core/Interfaces/IParticleOverride.js → Enums/Modes/AnimationMode.js} +0 -0
- /package/umd/{Core/Interfaces/IParticlesMover.js → Enums/Modes/PixelMode.js} +0 -0
- /package/umd/{Enums/Modes/SizeMode.js → Types/ExportResult.js} +0 -0
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Vector3d = void 0;
|
|
4
|
+
const Constants_1 = require("./Constants");
|
|
5
|
+
const Utils_1 = require("../../Utils/Utils");
|
|
4
6
|
class Vector3d {
|
|
5
7
|
constructor(xOrCoords, y, z) {
|
|
6
|
-
|
|
8
|
+
this._updateFromAngle = (angle, length) => {
|
|
9
|
+
this.x = Math.cos(angle) * length;
|
|
10
|
+
this.y = Math.sin(angle) * length;
|
|
11
|
+
};
|
|
12
|
+
if (!(0, Utils_1.isNumber)(xOrCoords) && xOrCoords) {
|
|
7
13
|
this.x = xOrCoords.x;
|
|
8
14
|
this.y = xOrCoords.y;
|
|
9
15
|
const coords3d = xOrCoords;
|
|
@@ -12,10 +18,10 @@ class Vector3d {
|
|
|
12
18
|
else if (xOrCoords !== undefined && y !== undefined) {
|
|
13
19
|
this.x = xOrCoords;
|
|
14
20
|
this.y = y;
|
|
15
|
-
this.z = z
|
|
21
|
+
this.z = z ?? 0;
|
|
16
22
|
}
|
|
17
23
|
else {
|
|
18
|
-
throw new Error(
|
|
24
|
+
throw new Error(`${Constants_1.errorPrefix} Vector3d not initialized correctly`);
|
|
19
25
|
}
|
|
20
26
|
}
|
|
21
27
|
static get origin() {
|
|
@@ -25,13 +31,13 @@ class Vector3d {
|
|
|
25
31
|
return Math.atan2(this.y, this.x);
|
|
26
32
|
}
|
|
27
33
|
set angle(angle) {
|
|
28
|
-
this.
|
|
34
|
+
this._updateFromAngle(angle, this.length);
|
|
29
35
|
}
|
|
30
36
|
get length() {
|
|
31
37
|
return Math.sqrt(this.getLengthSq());
|
|
32
38
|
}
|
|
33
39
|
set length(length) {
|
|
34
|
-
this.
|
|
40
|
+
this._updateFromAngle(this.angle, length);
|
|
35
41
|
}
|
|
36
42
|
static clone(source) {
|
|
37
43
|
return Vector3d.create(source.x, source.y, source.z);
|
|
@@ -75,6 +81,12 @@ class Vector3d {
|
|
|
75
81
|
this.y *= n;
|
|
76
82
|
this.z *= n;
|
|
77
83
|
}
|
|
84
|
+
normalize() {
|
|
85
|
+
const length = this.length;
|
|
86
|
+
if (length != 0) {
|
|
87
|
+
this.multTo(1.0 / length);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
78
90
|
rotate(angle) {
|
|
79
91
|
return Vector3d.create(this.x * Math.cos(angle) - this.y * Math.sin(angle), this.x * Math.sin(angle) + this.y * Math.cos(angle), 0);
|
|
80
92
|
}
|
|
@@ -92,9 +104,5 @@ class Vector3d {
|
|
|
92
104
|
this.y -= v.y;
|
|
93
105
|
this.z -= v.z;
|
|
94
106
|
}
|
|
95
|
-
updateFromAngle(angle, length) {
|
|
96
|
-
this.x = Math.cos(angle) * length;
|
|
97
|
-
this.y = Math.sin(angle) * length;
|
|
98
|
-
}
|
|
99
107
|
}
|
|
100
108
|
exports.Vector3d = Vector3d;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AnimatableColor = void 0;
|
|
4
|
+
const Utils_1 = require("../../Utils/Utils");
|
|
4
5
|
const HslAnimation_1 = require("./HslAnimation");
|
|
5
6
|
const OptionsColor_1 = require("./OptionsColor");
|
|
6
7
|
class AnimatableColor extends OptionsColor_1.OptionsColor {
|
|
@@ -12,7 +13,7 @@ class AnimatableColor extends OptionsColor_1.OptionsColor {
|
|
|
12
13
|
const color = new AnimatableColor();
|
|
13
14
|
color.load(source);
|
|
14
15
|
if (data !== undefined) {
|
|
15
|
-
if (
|
|
16
|
+
if ((0, Utils_1.isString)(data) || (0, Utils_1.isArray)(data)) {
|
|
16
17
|
color.load({ value: data });
|
|
17
18
|
}
|
|
18
19
|
else {
|
|
@@ -8,6 +8,7 @@ class AnimationOptions {
|
|
|
8
8
|
this.enable = false;
|
|
9
9
|
this.speed = 1;
|
|
10
10
|
this.decay = 0;
|
|
11
|
+
this.delay = 0;
|
|
11
12
|
this.sync = false;
|
|
12
13
|
}
|
|
13
14
|
load(data) {
|
|
@@ -26,6 +27,9 @@ class AnimationOptions {
|
|
|
26
27
|
if (data.decay !== undefined) {
|
|
27
28
|
this.decay = (0, NumberUtils_1.setRangeValue)(data.decay);
|
|
28
29
|
}
|
|
30
|
+
if (data.delay !== undefined) {
|
|
31
|
+
this.delay = (0, NumberUtils_1.setRangeValue)(data.delay);
|
|
32
|
+
}
|
|
29
33
|
if (data.sync !== undefined) {
|
|
30
34
|
this.sync = data.sync;
|
|
31
35
|
}
|
|
@@ -35,6 +39,7 @@ exports.AnimationOptions = AnimationOptions;
|
|
|
35
39
|
class RangedAnimationOptions extends AnimationOptions {
|
|
36
40
|
constructor() {
|
|
37
41
|
super();
|
|
42
|
+
this.mode = "auto";
|
|
38
43
|
this.startValue = "random";
|
|
39
44
|
}
|
|
40
45
|
load(data) {
|
|
@@ -42,8 +47,8 @@ class RangedAnimationOptions extends AnimationOptions {
|
|
|
42
47
|
if (!data) {
|
|
43
48
|
return;
|
|
44
49
|
}
|
|
45
|
-
if (data.
|
|
46
|
-
this.
|
|
50
|
+
if (data.mode !== undefined) {
|
|
51
|
+
this.mode = data.mode;
|
|
47
52
|
}
|
|
48
53
|
if (data.startValue !== undefined) {
|
|
49
54
|
this.startValue = data.startValue;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BackgroundMask = void 0;
|
|
4
4
|
const BackgroundMaskCover_1 = require("./BackgroundMaskCover");
|
|
5
|
+
const Utils_1 = require("../../../Utils/Utils");
|
|
5
6
|
class BackgroundMask {
|
|
6
7
|
constructor() {
|
|
7
8
|
this.composite = "destination-out";
|
|
@@ -17,7 +18,7 @@ class BackgroundMask {
|
|
|
17
18
|
}
|
|
18
19
|
if (data.cover !== undefined) {
|
|
19
20
|
const cover = data.cover;
|
|
20
|
-
const color = (
|
|
21
|
+
const color = ((0, Utils_1.isString)(data.cover) ? { color: data.cover } : data.cover);
|
|
21
22
|
this.cover.load(cover.color !== undefined ? cover : { color: color });
|
|
22
23
|
}
|
|
23
24
|
if (data.enable !== undefined) {
|
|
@@ -8,6 +8,7 @@ class ColorAnimation {
|
|
|
8
8
|
this.enable = false;
|
|
9
9
|
this.offset = 0;
|
|
10
10
|
this.speed = 1;
|
|
11
|
+
this.delay = 0;
|
|
11
12
|
this.decay = 0;
|
|
12
13
|
this.sync = true;
|
|
13
14
|
}
|
|
@@ -30,6 +31,9 @@ class ColorAnimation {
|
|
|
30
31
|
if (data.decay !== undefined) {
|
|
31
32
|
this.decay = (0, NumberUtils_1.setRangeValue)(data.decay);
|
|
32
33
|
}
|
|
34
|
+
if (data.delay !== undefined) {
|
|
35
|
+
this.delay = (0, NumberUtils_1.setRangeValue)(data.delay);
|
|
36
|
+
}
|
|
33
37
|
if (data.sync !== undefined) {
|
|
34
38
|
this.sync = data.sync;
|
|
35
39
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DivEvent = void 0;
|
|
4
|
-
const Utils_1 = require("../../../../Utils/Utils");
|
|
5
4
|
class DivEvent {
|
|
6
5
|
constructor() {
|
|
7
6
|
this.selectors = [];
|
|
@@ -9,33 +8,10 @@ class DivEvent {
|
|
|
9
8
|
this.mode = [];
|
|
10
9
|
this.type = "circle";
|
|
11
10
|
}
|
|
12
|
-
get el() {
|
|
13
|
-
return this.elementId;
|
|
14
|
-
}
|
|
15
|
-
set el(value) {
|
|
16
|
-
this.elementId = value;
|
|
17
|
-
}
|
|
18
|
-
get elementId() {
|
|
19
|
-
return this.ids;
|
|
20
|
-
}
|
|
21
|
-
set elementId(value) {
|
|
22
|
-
this.ids = value;
|
|
23
|
-
}
|
|
24
|
-
get ids() {
|
|
25
|
-
return (0, Utils_1.executeOnSingleOrMultiple)(this.selectors, (t) => t.replace("#", ""));
|
|
26
|
-
}
|
|
27
|
-
set ids(value) {
|
|
28
|
-
this.selectors = (0, Utils_1.executeOnSingleOrMultiple)(value, (t) => `#${t}`);
|
|
29
|
-
}
|
|
30
11
|
load(data) {
|
|
31
|
-
var _a, _b;
|
|
32
12
|
if (!data) {
|
|
33
13
|
return;
|
|
34
14
|
}
|
|
35
|
-
const ids = (_b = (_a = data.ids) !== null && _a !== void 0 ? _a : data.elementId) !== null && _b !== void 0 ? _b : data.el;
|
|
36
|
-
if (ids !== undefined) {
|
|
37
|
-
this.ids = ids;
|
|
38
|
-
}
|
|
39
15
|
if (data.selectors !== undefined) {
|
|
40
16
|
this.selectors = data.selectors;
|
|
41
17
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Events = void 0;
|
|
4
|
+
const Utils_1 = require("../../../../Utils/Utils");
|
|
4
5
|
const ClickEvent_1 = require("./ClickEvent");
|
|
5
6
|
const DivEvent_1 = require("./DivEvent");
|
|
6
7
|
const HoverEvent_1 = require("./HoverEvent");
|
|
7
8
|
const ResizeEvent_1 = require("./ResizeEvent");
|
|
8
|
-
const Utils_1 = require("../../../../Utils/Utils");
|
|
9
9
|
class Events {
|
|
10
10
|
constructor() {
|
|
11
11
|
this.onClick = new ClickEvent_1.ClickEvent();
|
|
@@ -13,31 +13,12 @@ class Events {
|
|
|
13
13
|
this.onHover = new HoverEvent_1.HoverEvent();
|
|
14
14
|
this.resize = new ResizeEvent_1.ResizeEvent();
|
|
15
15
|
}
|
|
16
|
-
get onclick() {
|
|
17
|
-
return this.onClick;
|
|
18
|
-
}
|
|
19
|
-
set onclick(value) {
|
|
20
|
-
this.onClick = value;
|
|
21
|
-
}
|
|
22
|
-
get ondiv() {
|
|
23
|
-
return this.onDiv;
|
|
24
|
-
}
|
|
25
|
-
set ondiv(value) {
|
|
26
|
-
this.onDiv = value;
|
|
27
|
-
}
|
|
28
|
-
get onhover() {
|
|
29
|
-
return this.onHover;
|
|
30
|
-
}
|
|
31
|
-
set onhover(value) {
|
|
32
|
-
this.onHover = value;
|
|
33
|
-
}
|
|
34
16
|
load(data) {
|
|
35
|
-
var _a, _b, _c;
|
|
36
17
|
if (!data) {
|
|
37
18
|
return;
|
|
38
19
|
}
|
|
39
|
-
this.onClick.load(
|
|
40
|
-
const onDiv =
|
|
20
|
+
this.onClick.load(data.onClick);
|
|
21
|
+
const onDiv = data.onDiv;
|
|
41
22
|
if (onDiv !== undefined) {
|
|
42
23
|
this.onDiv = (0, Utils_1.executeOnSingleOrMultiple)(onDiv, (t) => {
|
|
43
24
|
const tmp = new DivEvent_1.DivEvent();
|
|
@@ -45,8 +26,8 @@ class Events {
|
|
|
45
26
|
return tmp;
|
|
46
27
|
});
|
|
47
28
|
}
|
|
48
|
-
this.onHover.load(
|
|
49
|
-
if (
|
|
29
|
+
this.onHover.load(data.onHover);
|
|
30
|
+
if ((0, Utils_1.isBoolean)(data.resize)) {
|
|
50
31
|
this.resize.enable = data.resize;
|
|
51
32
|
}
|
|
52
33
|
else {
|
|
@@ -9,18 +9,11 @@ class Interactivity {
|
|
|
9
9
|
this.events = new Events_1.Events();
|
|
10
10
|
this.modes = new Modes_1.Modes(engine, container);
|
|
11
11
|
}
|
|
12
|
-
get detect_on() {
|
|
13
|
-
return this.detectsOn;
|
|
14
|
-
}
|
|
15
|
-
set detect_on(value) {
|
|
16
|
-
this.detectsOn = value;
|
|
17
|
-
}
|
|
18
12
|
load(data) {
|
|
19
|
-
var _a;
|
|
20
13
|
if (!data) {
|
|
21
14
|
return;
|
|
22
15
|
}
|
|
23
|
-
const detectsOn =
|
|
16
|
+
const detectsOn = data.detectsOn;
|
|
24
17
|
if (detectsOn !== undefined) {
|
|
25
18
|
this.detectsOn = detectsOn;
|
|
26
19
|
}
|
|
@@ -10,15 +10,18 @@ class Modes {
|
|
|
10
10
|
if (!data) {
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
|
-
if (this._container) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
if (!this._container) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const interactors = this._engine.interactors.get(this._container);
|
|
17
|
+
if (!interactors) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
for (const interactor of interactors) {
|
|
21
|
+
if (!interactor.loadModeOptions) {
|
|
22
|
+
continue;
|
|
21
23
|
}
|
|
24
|
+
interactor.loadModeOptions(this, data);
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
27
|
}
|
|
@@ -4,17 +4,17 @@ exports.ManualParticle = void 0;
|
|
|
4
4
|
const Utils_1 = require("../../Utils/Utils");
|
|
5
5
|
class ManualParticle {
|
|
6
6
|
load(data) {
|
|
7
|
-
var _a, _b;
|
|
8
7
|
if (!data) {
|
|
9
8
|
return;
|
|
10
9
|
}
|
|
11
|
-
if (data.position
|
|
10
|
+
if (data.position) {
|
|
12
11
|
this.position = {
|
|
13
|
-
x:
|
|
14
|
-
y:
|
|
12
|
+
x: data.position.x ?? 50,
|
|
13
|
+
y: data.position.y ?? 50,
|
|
14
|
+
mode: data.position.mode ?? "percent",
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
if (data.options
|
|
17
|
+
if (data.options) {
|
|
18
18
|
this.options = (0, Utils_1.deepExtend)({}, data.options);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -13,6 +13,13 @@ const OptionsUtils_1 = require("../../Utils/OptionsUtils");
|
|
|
13
13
|
const NumberUtils_1 = require("../../Utils/NumberUtils");
|
|
14
14
|
class Options {
|
|
15
15
|
constructor(engine, container) {
|
|
16
|
+
this._findDefaultTheme = (mode) => {
|
|
17
|
+
return (this.themes.find((theme) => theme.default.value && theme.default.mode === mode) ??
|
|
18
|
+
this.themes.find((theme) => theme.default.value && theme.default.mode === "any"));
|
|
19
|
+
};
|
|
20
|
+
this._importPreset = (preset) => {
|
|
21
|
+
this.load(this._engine.getPreset(preset));
|
|
22
|
+
};
|
|
16
23
|
this._engine = engine;
|
|
17
24
|
this._container = container;
|
|
18
25
|
this.autoPlay = true;
|
|
@@ -26,7 +33,6 @@ class Options {
|
|
|
26
33
|
this.fpsLimit = 120;
|
|
27
34
|
this.interactivity = new Interactivity_1.Interactivity(engine, container);
|
|
28
35
|
this.manualParticles = [];
|
|
29
|
-
this.name = "default";
|
|
30
36
|
this.particles = (0, OptionsUtils_1.loadParticlesOptions)(this._engine, this._container);
|
|
31
37
|
this.pauseOnBlur = true;
|
|
32
38
|
this.pauseOnOutsideViewport = true;
|
|
@@ -36,26 +42,7 @@ class Options {
|
|
|
36
42
|
this.themes = [];
|
|
37
43
|
this.zLayers = 100;
|
|
38
44
|
}
|
|
39
|
-
get backgroundMode() {
|
|
40
|
-
return this.fullScreen;
|
|
41
|
-
}
|
|
42
|
-
set backgroundMode(value) {
|
|
43
|
-
this.fullScreen.load(value);
|
|
44
|
-
}
|
|
45
|
-
get fps_limit() {
|
|
46
|
-
return this.fpsLimit;
|
|
47
|
-
}
|
|
48
|
-
set fps_limit(value) {
|
|
49
|
-
this.fpsLimit = value;
|
|
50
|
-
}
|
|
51
|
-
get retina_detect() {
|
|
52
|
-
return this.detectRetina;
|
|
53
|
-
}
|
|
54
|
-
set retina_detect(value) {
|
|
55
|
-
this.detectRetina = value;
|
|
56
|
-
}
|
|
57
45
|
load(data) {
|
|
58
|
-
var _a, _b, _c, _d, _e;
|
|
59
46
|
if (!data) {
|
|
60
47
|
return;
|
|
61
48
|
}
|
|
@@ -68,14 +55,14 @@ class Options {
|
|
|
68
55
|
if (data.delay !== undefined) {
|
|
69
56
|
this.delay = (0, NumberUtils_1.setRangeValue)(data.delay);
|
|
70
57
|
}
|
|
71
|
-
const detectRetina =
|
|
58
|
+
const detectRetina = data.detectRetina;
|
|
72
59
|
if (detectRetina !== undefined) {
|
|
73
60
|
this.detectRetina = detectRetina;
|
|
74
61
|
}
|
|
75
62
|
if (data.duration !== undefined) {
|
|
76
63
|
this.duration = (0, NumberUtils_1.setRangeValue)(data.duration);
|
|
77
64
|
}
|
|
78
|
-
const fpsLimit =
|
|
65
|
+
const fpsLimit = data.fpsLimit;
|
|
79
66
|
if (fpsLimit !== undefined) {
|
|
80
67
|
this.fpsLimit = fpsLimit;
|
|
81
68
|
}
|
|
@@ -89,8 +76,8 @@ class Options {
|
|
|
89
76
|
this.zLayers = data.zLayers;
|
|
90
77
|
}
|
|
91
78
|
this.background.load(data.background);
|
|
92
|
-
const fullScreen =
|
|
93
|
-
if (
|
|
79
|
+
const fullScreen = data.fullScreen;
|
|
80
|
+
if ((0, Utils_1.isBoolean)(fullScreen)) {
|
|
94
81
|
this.fullScreen.enable = fullScreen;
|
|
95
82
|
}
|
|
96
83
|
else {
|
|
@@ -98,7 +85,7 @@ class Options {
|
|
|
98
85
|
}
|
|
99
86
|
this.backgroundMask.load(data.backgroundMask);
|
|
100
87
|
this.interactivity.load(data.interactivity);
|
|
101
|
-
if (data.manualParticles
|
|
88
|
+
if (data.manualParticles) {
|
|
102
89
|
this.manualParticles = data.manualParticles.map((t) => {
|
|
103
90
|
const tmp = new ManualParticle_1.ManualParticle();
|
|
104
91
|
tmp.load(t);
|
|
@@ -107,11 +94,11 @@ class Options {
|
|
|
107
94
|
}
|
|
108
95
|
this.particles.load(data.particles);
|
|
109
96
|
this.style = (0, Utils_1.deepExtend)(this.style, data.style);
|
|
110
|
-
this._engine.
|
|
97
|
+
this._engine.loadOptions(this, data);
|
|
111
98
|
if (data.smooth !== undefined) {
|
|
112
99
|
this.smooth = data.smooth;
|
|
113
100
|
}
|
|
114
|
-
const interactors = this._engine.
|
|
101
|
+
const interactors = this._engine.interactors.get(this._container);
|
|
115
102
|
if (interactors) {
|
|
116
103
|
for (const interactor of interactors) {
|
|
117
104
|
if (interactor.loadOptions) {
|
|
@@ -140,14 +127,14 @@ class Options {
|
|
|
140
127
|
}
|
|
141
128
|
}
|
|
142
129
|
}
|
|
143
|
-
this.defaultThemes.dark =
|
|
144
|
-
this.defaultThemes.light =
|
|
130
|
+
this.defaultThemes.dark = this._findDefaultTheme("dark")?.name;
|
|
131
|
+
this.defaultThemes.light = this._findDefaultTheme("light")?.name;
|
|
145
132
|
}
|
|
146
133
|
setResponsive(width, pxRatio, defaultOptions) {
|
|
147
134
|
this.load(defaultOptions);
|
|
148
135
|
const responsiveOptions = this.responsive.find((t) => t.mode === "screen" && screen ? t.maxWidth > screen.availWidth : t.maxWidth * pxRatio > width);
|
|
149
|
-
this.load(responsiveOptions
|
|
150
|
-
return responsiveOptions
|
|
136
|
+
this.load(responsiveOptions?.options);
|
|
137
|
+
return responsiveOptions?.maxWidth;
|
|
151
138
|
}
|
|
152
139
|
setTheme(name) {
|
|
153
140
|
if (name) {
|
|
@@ -163,12 +150,5 @@ class Options {
|
|
|
163
150
|
}
|
|
164
151
|
}
|
|
165
152
|
}
|
|
166
|
-
_findDefaultTheme(mode) {
|
|
167
|
-
var _a;
|
|
168
|
-
return ((_a = this.themes.find((theme) => theme.default.value && theme.default.mode === mode)) !== null && _a !== void 0 ? _a : this.themes.find((theme) => theme.default.value && theme.default.mode === "any"));
|
|
169
|
-
}
|
|
170
|
-
_importPreset(preset) {
|
|
171
|
-
this.load(this._engine.plugins.getPreset(preset));
|
|
172
|
-
}
|
|
173
153
|
}
|
|
174
154
|
exports.Options = Options;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OptionsColor = void 0;
|
|
4
|
+
const Utils_1 = require("../../Utils/Utils");
|
|
4
5
|
class OptionsColor {
|
|
5
6
|
constructor() {
|
|
6
7
|
this.value = "";
|
|
@@ -9,7 +10,7 @@ class OptionsColor {
|
|
|
9
10
|
const color = new OptionsColor();
|
|
10
11
|
color.load(source);
|
|
11
12
|
if (data !== undefined) {
|
|
12
|
-
if (
|
|
13
|
+
if ((0, Utils_1.isString)(data) || (0, Utils_1.isArray)(data)) {
|
|
13
14
|
color.load({ value: data });
|
|
14
15
|
}
|
|
15
16
|
else {
|
|
@@ -19,7 +20,7 @@ class OptionsColor {
|
|
|
19
20
|
return color;
|
|
20
21
|
}
|
|
21
22
|
load(data) {
|
|
22
|
-
if (
|
|
23
|
+
if (data?.value === undefined) {
|
|
23
24
|
return;
|
|
24
25
|
}
|
|
25
26
|
this.value = data.value;
|
|
@@ -4,11 +4,13 @@ exports.Collisions = void 0;
|
|
|
4
4
|
const CollisionsAbsorb_1 = require("./CollisionsAbsorb");
|
|
5
5
|
const CollisionsOverlap_1 = require("./CollisionsOverlap");
|
|
6
6
|
const ParticlesBounce_1 = require("../Bounce/ParticlesBounce");
|
|
7
|
+
const NumberUtils_1 = require("../../../../Utils/NumberUtils");
|
|
7
8
|
class Collisions {
|
|
8
9
|
constructor() {
|
|
9
10
|
this.absorb = new CollisionsAbsorb_1.CollisionsAbsorb();
|
|
10
11
|
this.bounce = new ParticlesBounce_1.ParticlesBounce();
|
|
11
12
|
this.enable = false;
|
|
13
|
+
this.maxSpeed = 50;
|
|
12
14
|
this.mode = "bounce";
|
|
13
15
|
this.overlap = new CollisionsOverlap_1.CollisionsOverlap();
|
|
14
16
|
}
|
|
@@ -21,6 +23,9 @@ class Collisions {
|
|
|
21
23
|
if (data.enable !== undefined) {
|
|
22
24
|
this.enable = data.enable;
|
|
23
25
|
}
|
|
26
|
+
if (data.maxSpeed !== undefined) {
|
|
27
|
+
this.maxSpeed = (0, NumberUtils_1.setRangeValue)(data.maxSpeed);
|
|
28
|
+
}
|
|
24
29
|
if (data.mode !== undefined) {
|
|
25
30
|
this.mode = data.mode;
|
|
26
31
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Move = void 0;
|
|
4
|
+
const Utils_1 = require("../../../../Utils/Utils");
|
|
4
5
|
const MoveAngle_1 = require("./MoveAngle");
|
|
5
6
|
const MoveAttract_1 = require("./MoveAttract");
|
|
6
7
|
const MoveCenter_1 = require("./MoveCenter");
|
|
@@ -32,41 +33,11 @@ class Move {
|
|
|
32
33
|
this.vibrate = false;
|
|
33
34
|
this.warp = false;
|
|
34
35
|
}
|
|
35
|
-
get bounce() {
|
|
36
|
-
return this.collisions;
|
|
37
|
-
}
|
|
38
|
-
set bounce(value) {
|
|
39
|
-
this.collisions = value;
|
|
40
|
-
}
|
|
41
|
-
get collisions() {
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
set collisions(_) {
|
|
45
|
-
}
|
|
46
|
-
get noise() {
|
|
47
|
-
return this.path;
|
|
48
|
-
}
|
|
49
|
-
set noise(value) {
|
|
50
|
-
this.path = value;
|
|
51
|
-
}
|
|
52
|
-
get outMode() {
|
|
53
|
-
return this.outModes.default;
|
|
54
|
-
}
|
|
55
|
-
set outMode(value) {
|
|
56
|
-
this.outModes.default = value;
|
|
57
|
-
}
|
|
58
|
-
get out_mode() {
|
|
59
|
-
return this.outMode;
|
|
60
|
-
}
|
|
61
|
-
set out_mode(value) {
|
|
62
|
-
this.outMode = value;
|
|
63
|
-
}
|
|
64
36
|
load(data) {
|
|
65
|
-
var _a, _b, _c;
|
|
66
37
|
if (!data) {
|
|
67
38
|
return;
|
|
68
39
|
}
|
|
69
|
-
this.angle.load(
|
|
40
|
+
this.angle.load((0, Utils_1.isNumber)(data.angle) ? { value: data.angle } : data.angle);
|
|
70
41
|
this.attract.load(data.attract);
|
|
71
42
|
this.center.load(data.center);
|
|
72
43
|
if (data.decay !== undefined) {
|
|
@@ -76,13 +47,12 @@ class Move {
|
|
|
76
47
|
this.direction = data.direction;
|
|
77
48
|
}
|
|
78
49
|
if (data.distance !== undefined) {
|
|
79
|
-
this.distance =
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
: Object.assign({}, data.distance);
|
|
50
|
+
this.distance = (0, Utils_1.isNumber)(data.distance)
|
|
51
|
+
? {
|
|
52
|
+
horizontal: data.distance,
|
|
53
|
+
vertical: data.distance,
|
|
54
|
+
}
|
|
55
|
+
: { ...data.distance };
|
|
86
56
|
}
|
|
87
57
|
if (data.drift !== undefined) {
|
|
88
58
|
this.drift = (0, NumberUtils_1.setRangeValue)(data.drift);
|
|
@@ -91,9 +61,9 @@ class Move {
|
|
|
91
61
|
this.enable = data.enable;
|
|
92
62
|
}
|
|
93
63
|
this.gravity.load(data.gravity);
|
|
94
|
-
const outModes =
|
|
64
|
+
const outModes = data.outModes;
|
|
95
65
|
if (outModes !== undefined) {
|
|
96
|
-
if (
|
|
66
|
+
if ((0, Utils_1.isObject)(outModes)) {
|
|
97
67
|
this.outModes.load(outModes);
|
|
98
68
|
}
|
|
99
69
|
else {
|
|
@@ -102,7 +72,7 @@ class Move {
|
|
|
102
72
|
});
|
|
103
73
|
}
|
|
104
74
|
}
|
|
105
|
-
this.path.load(
|
|
75
|
+
this.path.load(data.path);
|
|
106
76
|
if (data.random !== undefined) {
|
|
107
77
|
this.random = data.random;
|
|
108
78
|
}
|
|
@@ -11,20 +11,7 @@ class MoveAttract {
|
|
|
11
11
|
y: 3000,
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
get rotateX() {
|
|
15
|
-
return this.rotate.x;
|
|
16
|
-
}
|
|
17
|
-
set rotateX(value) {
|
|
18
|
-
this.rotate.x = value;
|
|
19
|
-
}
|
|
20
|
-
get rotateY() {
|
|
21
|
-
return this.rotate.y;
|
|
22
|
-
}
|
|
23
|
-
set rotateY(value) {
|
|
24
|
-
this.rotate.y = value;
|
|
25
|
-
}
|
|
26
14
|
load(data) {
|
|
27
|
-
var _a, _b, _c, _d;
|
|
28
15
|
if (!data) {
|
|
29
16
|
return;
|
|
30
17
|
}
|
|
@@ -34,13 +21,15 @@ class MoveAttract {
|
|
|
34
21
|
if (data.enable !== undefined) {
|
|
35
22
|
this.enable = data.enable;
|
|
36
23
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
24
|
+
if (data.rotate) {
|
|
25
|
+
const rotateX = data.rotate.x;
|
|
26
|
+
if (rotateX !== undefined) {
|
|
27
|
+
this.rotate.x = rotateX;
|
|
28
|
+
}
|
|
29
|
+
const rotateY = data.rotate.y;
|
|
30
|
+
if (rotateY !== undefined) {
|
|
31
|
+
this.rotate.y = rotateY;
|
|
32
|
+
}
|
|
44
33
|
}
|
|
45
34
|
}
|
|
46
35
|
}
|
|
@@ -8,12 +8,6 @@ class MoveTrail {
|
|
|
8
8
|
this.length = 10;
|
|
9
9
|
this.fill = new MoveTrailFill_1.MoveTrailFill();
|
|
10
10
|
}
|
|
11
|
-
get fillColor() {
|
|
12
|
-
return this.fill.color;
|
|
13
|
-
}
|
|
14
|
-
set fillColor(value) {
|
|
15
|
-
this.fill.load({ color: value });
|
|
16
|
-
}
|
|
17
11
|
load(data) {
|
|
18
12
|
if (!data) {
|
|
19
13
|
return;
|
|
@@ -21,8 +15,8 @@ class MoveTrail {
|
|
|
21
15
|
if (data.enable !== undefined) {
|
|
22
16
|
this.enable = data.enable;
|
|
23
17
|
}
|
|
24
|
-
if (data.fill !== undefined
|
|
25
|
-
this.fill.load(data.fill
|
|
18
|
+
if (data.fill !== undefined) {
|
|
19
|
+
this.fill.load(data.fill);
|
|
26
20
|
}
|
|
27
21
|
if (data.length !== undefined) {
|
|
28
22
|
this.length = data.length;
|