@tsparticles/engine 3.9.1 → 4.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/638.min.js +2 -0
- package/638.min.js.LICENSE.txt +1 -0
- package/browser/Core/Canvas.js +126 -181
- package/browser/Core/Container.js +22 -18
- package/browser/Core/Engine.js +64 -54
- package/browser/Core/Particle.js +43 -48
- package/browser/Core/Particles.js +33 -24
- package/browser/Core/Retina.js +2 -3
- package/browser/Core/Utils/Constants.js +2 -2
- package/browser/Core/Utils/EventListeners.js +74 -64
- package/browser/Core/Utils/QuadTree.js +1 -1
- package/browser/Core/Utils/Ranges.js +2 -2
- package/browser/Core/Utils/Vectors.js +15 -21
- package/browser/Options/Classes/AnimatableColor.js +3 -3
- package/browser/Options/Classes/AnimationOptions.js +1 -1
- package/browser/Options/Classes/ColorAnimation.js +1 -1
- package/browser/Options/Classes/Options.js +13 -10
- package/browser/Options/Classes/Particles/Move/Move.js +1 -4
- package/browser/Options/Classes/Particles/Move/MoveAngle.js +1 -1
- package/browser/Options/Classes/Particles/Move/MoveAttract.js +1 -1
- package/browser/Options/Classes/Particles/Move/MoveGravity.js +1 -1
- package/browser/Options/Classes/Particles/Move/Spin.js +1 -1
- package/browser/Options/Classes/Particles/ParticlesOptions.js +0 -6
- package/browser/Options/Classes/Particles/Stroke.js +1 -1
- package/browser/Options/Classes/ValueWithRandom.js +1 -1
- package/browser/Utils/CanvasUtils.js +65 -21
- package/browser/Utils/ColorUtils.js +61 -45
- package/browser/Utils/EventDispatcher.js +3 -1
- package/browser/Utils/LogUtils.js +22 -0
- package/browser/Utils/{NumberUtils.js → MathUtils.js} +14 -7
- package/browser/Utils/Utils.js +23 -125
- package/browser/bundle.js +3 -3
- package/browser/export-types.js +1 -99
- package/browser/exports.js +2 -9
- package/browser/index.js +3 -7
- package/browser/initEngine.js +4 -0
- package/cjs/Core/Canvas.js +136 -195
- package/cjs/Core/Container.js +57 -57
- package/cjs/Core/Engine.js +77 -71
- package/cjs/Core/Interfaces/Colors.js +1 -2
- package/cjs/Core/Interfaces/IBounds.js +1 -2
- package/cjs/Core/Interfaces/IBubbleParticleData.js +1 -2
- package/cjs/Core/Interfaces/ICircleBouncer.js +1 -2
- package/cjs/Core/Interfaces/IColorManager.js +1 -2
- package/cjs/Core/Interfaces/IContainerInteractivity.js +1 -2
- package/cjs/Core/Interfaces/IContainerPlugin.js +1 -2
- package/cjs/Core/Interfaces/ICoordinates.js +1 -2
- package/cjs/Core/Interfaces/IDelta.js +1 -2
- package/cjs/Core/Interfaces/IDimension.js +1 -2
- package/cjs/Core/Interfaces/IDistance.js +1 -2
- package/cjs/Core/Interfaces/IDrawParticleParams.js +1 -2
- package/cjs/Core/Interfaces/IEffectDrawer.js +1 -2
- package/cjs/Core/Interfaces/IExternalInteractor.js +1 -2
- package/cjs/Core/Interfaces/IInteractor.js +1 -2
- package/cjs/Core/Interfaces/ILoadParams.js +1 -2
- package/cjs/Core/Interfaces/IMouseData.js +1 -2
- package/cjs/Core/Interfaces/IMovePathGenerator.js +1 -2
- package/cjs/Core/Interfaces/IParticleColorStyle.js +1 -2
- package/cjs/Core/Interfaces/IParticleHslAnimation.js +1 -2
- package/cjs/Core/Interfaces/IParticleLife.js +1 -2
- package/cjs/Core/Interfaces/IParticleMover.js +1 -2
- package/cjs/Core/Interfaces/IParticleRetinaProps.js +1 -2
- package/cjs/Core/Interfaces/IParticleRoll.js +1 -2
- package/cjs/Core/Interfaces/IParticleTransformValues.js +1 -2
- package/cjs/Core/Interfaces/IParticleUpdater.js +1 -2
- package/cjs/Core/Interfaces/IParticleValueAnimation.js +1 -2
- package/cjs/Core/Interfaces/IParticlesInteractor.js +1 -2
- package/cjs/Core/Interfaces/IPlugin.js +1 -2
- package/cjs/Core/Interfaces/IPositionFromSizeParams.js +1 -2
- package/cjs/Core/Interfaces/IRangeValue.js +1 -2
- package/cjs/Core/Interfaces/IShapeDrawData.js +1 -2
- package/cjs/Core/Interfaces/IShapeDrawer.js +1 -2
- package/cjs/Core/Interfaces/IShapeValues.js +1 -2
- package/cjs/Core/Interfaces/ISlowParticleData.js +1 -2
- package/cjs/Core/Particle.js +99 -108
- package/cjs/Core/Particles.js +63 -58
- package/cjs/Core/Retina.js +13 -18
- package/cjs/Core/Utils/Constants.js +3 -7
- package/cjs/Core/Utils/EventListeners.js +94 -88
- package/cjs/Core/Utils/ExternalInteractorBase.js +3 -7
- package/cjs/Core/Utils/InteractionManager.js +4 -8
- package/cjs/Core/Utils/ParticlesInteractorBase.js +3 -7
- package/cjs/Core/Utils/Point.js +1 -5
- package/cjs/Core/Utils/QuadTree.js +10 -14
- package/cjs/Core/Utils/Ranges.js +14 -20
- package/cjs/Core/Utils/Vectors.js +24 -35
- package/cjs/Enums/AnimationStatus.js +2 -5
- package/cjs/Enums/Directions/MoveDirection.js +2 -5
- package/cjs/Enums/Directions/OutModeDirection.js +2 -5
- package/cjs/Enums/Directions/RotateDirection.js +2 -5
- package/cjs/Enums/InteractivityDetect.js +2 -5
- package/cjs/Enums/Modes/AnimationMode.js +2 -5
- package/cjs/Enums/Modes/LimitMode.js +2 -5
- package/cjs/Enums/Modes/OutMode.js +2 -5
- package/cjs/Enums/Modes/PixelMode.js +2 -5
- package/cjs/Enums/Modes/ResponsiveMode.js +2 -5
- package/cjs/Enums/Modes/ThemeMode.js +2 -5
- package/cjs/Enums/Types/AlterType.js +2 -5
- package/cjs/Enums/Types/DestroyType.js +2 -5
- package/cjs/Enums/Types/DivType.js +2 -5
- package/cjs/Enums/Types/EasingType.js +2 -5
- package/cjs/Enums/Types/EventType.js +2 -5
- package/cjs/Enums/Types/GradientType.js +2 -5
- package/cjs/Enums/Types/InteractorType.js +2 -5
- package/cjs/Enums/Types/ParticleOutType.js +2 -5
- package/cjs/Enums/Types/StartValueType.js +2 -5
- package/cjs/Options/Classes/AnimatableColor.js +10 -14
- package/cjs/Options/Classes/AnimationOptions.js +14 -19
- package/cjs/Options/Classes/Background/Background.js +6 -10
- package/cjs/Options/Classes/ColorAnimation.js +6 -10
- package/cjs/Options/Classes/FullScreen/FullScreen.js +3 -7
- package/cjs/Options/Classes/HslAnimation.js +7 -11
- package/cjs/Options/Classes/Interactivity/Events/ClickEvent.js +3 -7
- package/cjs/Options/Classes/Interactivity/Events/DivEvent.js +5 -9
- package/cjs/Options/Classes/Interactivity/Events/Events.js +14 -18
- package/cjs/Options/Classes/Interactivity/Events/HoverEvent.js +5 -9
- package/cjs/Options/Classes/Interactivity/Events/Parallax.js +3 -7
- package/cjs/Options/Classes/Interactivity/Events/ResizeEvent.js +3 -7
- package/cjs/Options/Classes/Interactivity/Interactivity.js +9 -13
- package/cjs/Options/Classes/Interactivity/Modes/Modes.js +3 -7
- package/cjs/Options/Classes/ManualParticle.js +10 -14
- package/cjs/Options/Classes/Options.js +41 -42
- package/cjs/Options/Classes/OptionsColor.js +5 -9
- package/cjs/Options/Classes/Particles/Bounce/ParticlesBounce.js +6 -10
- package/cjs/Options/Classes/Particles/Bounce/ParticlesBounceFactor.js +2 -6
- package/cjs/Options/Classes/Particles/Effect/Effect.js +5 -9
- package/cjs/Options/Classes/Particles/Move/Move.js +26 -33
- package/cjs/Options/Classes/Particles/Move/MoveAngle.js +6 -10
- package/cjs/Options/Classes/Particles/Move/MoveAttract.js +5 -9
- package/cjs/Options/Classes/Particles/Move/MoveCenter.js +5 -9
- package/cjs/Options/Classes/Particles/Move/MoveGravity.js +6 -10
- package/cjs/Options/Classes/Particles/Move/OutModes.js +5 -9
- package/cjs/Options/Classes/Particles/Move/Path/MovePath.js +7 -11
- package/cjs/Options/Classes/Particles/Move/Spin.js +7 -11
- package/cjs/Options/Classes/Particles/Number/ParticlesDensity.js +3 -7
- package/cjs/Options/Classes/Particles/Number/ParticlesNumber.js +7 -11
- package/cjs/Options/Classes/Particles/Number/ParticlesNumberLimit.js +5 -9
- package/cjs/Options/Classes/Particles/Opacity/Opacity.js +6 -10
- package/cjs/Options/Classes/Particles/Opacity/OpacityAnimation.js +6 -10
- package/cjs/Options/Classes/Particles/ParticlesOptions.js +29 -39
- package/cjs/Options/Classes/Particles/Shape/Shape.js +5 -9
- package/cjs/Options/Classes/Particles/Size/Size.js +6 -10
- package/cjs/Options/Classes/Particles/Size/SizeAnimation.js +6 -10
- package/cjs/Options/Classes/Particles/Stroke.js +8 -12
- package/cjs/Options/Classes/Particles/ZIndex/ZIndex.js +4 -8
- package/cjs/Options/Classes/Responsive.js +13 -17
- package/cjs/Options/Classes/Theme/Theme.js +7 -11
- package/cjs/Options/Classes/Theme/ThemeDefault.js +5 -9
- package/cjs/Options/Classes/ValueWithRandom.js +12 -18
- package/cjs/Options/Interfaces/Background/IBackground.js +1 -2
- package/cjs/Options/Interfaces/FullScreen/IFullScreen.js +1 -2
- package/cjs/Options/Interfaces/IAnimatable.js +1 -2
- package/cjs/Options/Interfaces/IAnimatableColor.js +1 -2
- package/cjs/Options/Interfaces/IAnimation.js +1 -2
- package/cjs/Options/Interfaces/IColorAnimation.js +1 -2
- package/cjs/Options/Interfaces/IHslAnimation.js +1 -2
- package/cjs/Options/Interfaces/IManualParticle.js +1 -2
- package/cjs/Options/Interfaces/IOptionLoader.js +1 -2
- package/cjs/Options/Interfaces/IOptions.js +1 -2
- package/cjs/Options/Interfaces/IOptionsColor.js +1 -2
- package/cjs/Options/Interfaces/IResponsive.js +1 -2
- package/cjs/Options/Interfaces/IValueWithRandom.js +1 -2
- package/cjs/Options/Interfaces/Interactivity/Events/IClickEvent.js +1 -2
- package/cjs/Options/Interfaces/Interactivity/Events/IDivEvent.js +1 -2
- package/cjs/Options/Interfaces/Interactivity/Events/IEvents.js +1 -2
- package/cjs/Options/Interfaces/Interactivity/Events/IHoverEvent.js +1 -2
- package/cjs/Options/Interfaces/Interactivity/Events/IParallax.js +1 -2
- package/cjs/Options/Interfaces/Interactivity/Events/IResizeEvent.js +1 -2
- package/cjs/Options/Interfaces/Interactivity/IInteractivity.js +1 -2
- package/cjs/Options/Interfaces/Interactivity/Modes/IModeDiv.js +1 -2
- package/cjs/Options/Interfaces/Interactivity/Modes/IModes.js +1 -2
- package/cjs/Options/Interfaces/Particles/Bounce/IParticlesBounce.js +1 -2
- package/cjs/Options/Interfaces/Particles/Effect/IEffect.js +1 -2
- package/cjs/Options/Interfaces/Particles/IParticlesOptions.js +1 -2
- package/cjs/Options/Interfaces/Particles/IStroke.js +1 -2
- package/cjs/Options/Interfaces/Particles/Move/IMove.js +1 -2
- package/cjs/Options/Interfaces/Particles/Move/IMoveAngle.js +1 -2
- package/cjs/Options/Interfaces/Particles/Move/IMoveAttract.js +1 -2
- package/cjs/Options/Interfaces/Particles/Move/IMoveCenter.js +1 -2
- package/cjs/Options/Interfaces/Particles/Move/IMoveGravity.js +1 -2
- package/cjs/Options/Interfaces/Particles/Move/IOutModes.js +1 -2
- package/cjs/Options/Interfaces/Particles/Move/ISpin.js +1 -2
- package/cjs/Options/Interfaces/Particles/Move/Path/IMovePath.js +1 -2
- package/cjs/Options/Interfaces/Particles/Number/IParticlesDensity.js +1 -2
- package/cjs/Options/Interfaces/Particles/Number/IParticlesNumber.js +1 -2
- package/cjs/Options/Interfaces/Particles/Number/IParticlesNumberLimit.js +1 -2
- package/cjs/Options/Interfaces/Particles/Opacity/IOpacity.js +1 -2
- package/cjs/Options/Interfaces/Particles/Opacity/IOpacityAnimation.js +1 -2
- package/cjs/Options/Interfaces/Particles/Shape/IShape.js +1 -2
- package/cjs/Options/Interfaces/Particles/Size/ISize.js +1 -2
- package/cjs/Options/Interfaces/Particles/Size/ISizeAnimation.js +1 -2
- package/cjs/Options/Interfaces/Particles/ZIndex/IZIndex.js +1 -2
- package/cjs/Options/Interfaces/Theme/ITheme.js +1 -2
- package/cjs/Options/Interfaces/Theme/IThemeDefault.js +1 -2
- package/cjs/Types/CustomEventArgs.js +1 -2
- package/cjs/Types/CustomEventListener.js +1 -2
- package/cjs/Types/EasingFunction.js +1 -2
- package/cjs/Types/ExportResult.js +1 -2
- package/cjs/Types/ISourceOptions.js +1 -2
- package/cjs/Types/ParticlesGroups.js +1 -2
- package/cjs/Types/PathOptions.js +1 -2
- package/cjs/Types/RangeValue.js +1 -2
- package/cjs/Types/RecursivePartial.js +1 -2
- package/cjs/Types/ShapeData.js +1 -2
- package/cjs/Types/SingleOrMultiple.js +1 -2
- package/cjs/Utils/CanvasUtils.js +86 -55
- package/cjs/Utils/ColorUtils.js +136 -141
- package/cjs/Utils/EventDispatcher.js +8 -10
- package/cjs/Utils/LogUtils.js +22 -0
- package/{esm/Utils/NumberUtils.js → cjs/Utils/MathUtils.js} +14 -7
- package/cjs/Utils/OptionsUtils.js +4 -8
- package/cjs/Utils/TypeUtils.js +7 -16
- package/cjs/Utils/Utils.js +104 -239
- package/cjs/bundle.js +5 -22
- package/cjs/export-types.js +1 -115
- package/cjs/exports.js +77 -100
- package/cjs/index.js +5 -26
- package/cjs/initEngine.js +4 -0
- package/dist_browser_Core_Container_js.js +102 -0
- package/esm/Core/Canvas.js +126 -181
- package/esm/Core/Container.js +22 -18
- package/esm/Core/Engine.js +64 -54
- package/esm/Core/Particle.js +43 -48
- package/esm/Core/Particles.js +33 -24
- package/esm/Core/Retina.js +2 -3
- package/esm/Core/Utils/Constants.js +2 -2
- package/esm/Core/Utils/EventListeners.js +74 -64
- package/esm/Core/Utils/QuadTree.js +1 -1
- package/esm/Core/Utils/Ranges.js +2 -2
- package/esm/Core/Utils/Vectors.js +15 -21
- package/esm/Enums/RangeType.js +5 -0
- package/esm/Options/Classes/AnimatableColor.js +3 -3
- package/esm/Options/Classes/AnimationOptions.js +1 -1
- package/esm/Options/Classes/ColorAnimation.js +1 -1
- package/esm/Options/Classes/Options.js +13 -10
- package/esm/Options/Classes/Particles/Move/Move.js +1 -4
- package/esm/Options/Classes/Particles/Move/MoveAngle.js +1 -1
- package/esm/Options/Classes/Particles/Move/MoveAttract.js +1 -1
- package/esm/Options/Classes/Particles/Move/MoveGravity.js +1 -1
- package/esm/Options/Classes/Particles/Move/Spin.js +1 -1
- package/esm/Options/Classes/Particles/ParticlesOptions.js +0 -6
- package/esm/Options/Classes/Particles/Stroke.js +1 -1
- package/esm/Options/Classes/ValueWithRandom.js +1 -1
- package/esm/Utils/CanvasUtils.js +65 -21
- package/esm/Utils/ColorUtils.js +61 -45
- package/esm/Utils/EventDispatcher.js +3 -1
- package/esm/Utils/LogUtils.js +22 -0
- package/esm/Utils/MathUtils.js +158 -0
- package/esm/Utils/Utils.js +23 -125
- package/esm/bundle.js +3 -3
- package/esm/export-types.js +1 -99
- package/esm/exports.js +2 -9
- package/esm/index.js +3 -7
- package/esm/initEngine.js +4 -0
- package/package.json +3 -2
- package/report.html +5 -4
- package/scripts/install.js +204 -118
- package/tsparticles.engine.js +492 -451
- package/tsparticles.engine.min.js +1 -1
- package/tsparticles.engine.min.js.LICENSE.txt +1 -1
- package/types/Core/Canvas.d.ts +6 -9
- package/types/Core/Container.d.ts +1 -0
- package/types/Core/Engine.d.ts +20 -16
- package/types/Core/Interfaces/Colors.d.ts +46 -2
- package/types/Core/Interfaces/IColorManager.d.ts +1 -1
- package/types/Core/Interfaces/IContainerPlugin.d.ts +4 -0
- package/types/Core/Interfaces/IDrawParticleParams.d.ts +0 -4
- package/types/Core/Interfaces/IEffectDrawer.d.ts +2 -1
- package/types/Core/Interfaces/IShapeDrawData.d.ts +2 -0
- package/types/Core/Interfaces/IShapeDrawer.d.ts +1 -0
- package/types/Core/Particle.d.ts +4 -5
- package/types/Core/Particles.d.ts +1 -1
- package/types/Core/Utils/Constants.d.ts +2 -2
- package/types/Core/Utils/EventListeners.d.ts +1 -0
- package/types/Core/Utils/Vectors.d.ts +3 -3
- package/types/Options/Classes/Options.d.ts +1 -2
- package/types/Options/Classes/OptionsColor.d.ts +2 -2
- package/types/Options/Classes/Particles/Move/Move.d.ts +0 -2
- package/types/Options/Classes/Particles/ParticlesOptions.d.ts +0 -4
- package/types/Options/Interfaces/IOptions.d.ts +1 -2
- package/types/Options/Interfaces/Particles/IParticlesOptions.d.ts +0 -4
- package/types/Options/Interfaces/Particles/Move/IMove.d.ts +0 -2
- package/types/Utils/CanvasUtils.d.ts +4 -1
- package/types/Utils/ColorUtils.d.ts +2 -2
- package/types/Utils/LogUtils.d.ts +11 -0
- package/types/Utils/{NumberUtils.d.ts → MathUtils.d.ts} +2 -1
- package/types/Utils/TypeUtils.d.ts +2 -2
- package/types/Utils/Utils.d.ts +4 -16
- package/types/export-types.d.ts +91 -101
- package/types/exports.d.ts +2 -9
- package/types/index.d.ts +1 -1
- package/types/initEngine.d.ts +2 -0
- package/umd/Core/Canvas.js +123 -178
- package/umd/Core/Container.js +25 -21
- package/umd/Core/Engine.js +97 -53
- package/umd/Core/Particle.js +54 -59
- package/umd/Core/Particles.js +33 -24
- package/umd/Core/Retina.js +9 -10
- package/umd/Core/Utils/Constants.js +3 -3
- package/umd/Core/Utils/EventListeners.js +72 -62
- package/umd/Core/Utils/QuadTree.js +3 -3
- package/umd/Core/Utils/Ranges.js +4 -4
- package/umd/Core/Utils/Vectors.js +15 -21
- package/umd/Options/Classes/AnimatableColor.js +3 -3
- package/umd/Options/Classes/AnimationOptions.js +6 -6
- package/umd/Options/Classes/ColorAnimation.js +3 -3
- package/umd/Options/Classes/Options.js +16 -13
- package/umd/Options/Classes/Particles/Move/Move.js +5 -8
- package/umd/Options/Classes/Particles/Move/MoveAngle.js +4 -4
- package/umd/Options/Classes/Particles/Move/MoveAttract.js +3 -3
- package/umd/Options/Classes/Particles/Move/MoveGravity.js +4 -4
- package/umd/Options/Classes/Particles/Move/Spin.js +3 -3
- package/umd/Options/Classes/Particles/ParticlesOptions.js +1 -7
- package/umd/Options/Classes/Particles/Stroke.js +4 -4
- package/umd/Options/Classes/ValueWithRandom.js +3 -3
- package/umd/Utils/CanvasUtils.js +69 -22
- package/umd/Utils/ColorUtils.js +72 -56
- package/umd/Utils/EventDispatcher.js +3 -1
- package/umd/Utils/LogUtils.js +36 -0
- package/umd/Utils/{NumberUtils.js → MathUtils.js} +16 -8
- package/umd/Utils/Utils.js +36 -141
- package/umd/bundle.js +4 -4
- package/umd/export-types.js +1 -114
- package/umd/exports.js +3 -10
- package/umd/index.js +4 -8
- package/umd/{init.js → initEngine.js} +3 -5
- package/browser/Core/Interfaces/IRectSideResult.js +0 -1
- package/browser/Core/Interfaces/ITrailFillData.js +0 -1
- package/browser/Enums/Modes/CollisionMode.js +0 -6
- package/browser/Options/Classes/BackgroundMask/BackgroundMask.js +0 -24
- package/browser/Options/Classes/BackgroundMask/BackgroundMaskCover.js +0 -21
- package/browser/Options/Classes/Particles/Collisions/Collisions.js +0 -33
- package/browser/Options/Classes/Particles/Collisions/CollisionsAbsorb.js +0 -14
- package/browser/Options/Classes/Particles/Collisions/CollisionsOverlap.js +0 -18
- package/browser/Options/Classes/Particles/Move/MoveTrail.js +0 -23
- package/browser/Options/Classes/Particles/Move/MoveTrailFill.js +0 -15
- package/browser/Options/Classes/Particles/Shadow.js +0 -35
- package/browser/Options/Interfaces/BackgroundMask/IBackgroundMask.js +0 -1
- package/browser/Options/Interfaces/BackgroundMask/IBackgroundMaskCover.js +0 -1
- package/browser/Options/Interfaces/Particles/Collisions/ICollisions.js +0 -1
- package/browser/Options/Interfaces/Particles/Collisions/ICollisionsAbsorb.js +0 -1
- package/browser/Options/Interfaces/Particles/Collisions/ICollisionsOverlap.js +0 -1
- package/browser/Options/Interfaces/Particles/IShadow.js +0 -1
- package/browser/Options/Interfaces/Particles/Move/IMoveTrail.js +0 -1
- package/browser/Options/Interfaces/Particles/Move/IMoveTrailFill.js +0 -1
- package/browser/init.js +0 -6
- package/cjs/Core/Interfaces/IRectSideResult.js +0 -2
- package/cjs/Core/Interfaces/ITrailFillData.js +0 -2
- package/cjs/Enums/Modes/CollisionMode.js +0 -9
- package/cjs/Options/Classes/BackgroundMask/BackgroundMask.js +0 -28
- package/cjs/Options/Classes/BackgroundMask/BackgroundMaskCover.js +0 -25
- package/cjs/Options/Classes/Particles/Collisions/Collisions.js +0 -37
- package/cjs/Options/Classes/Particles/Collisions/CollisionsAbsorb.js +0 -18
- package/cjs/Options/Classes/Particles/Collisions/CollisionsOverlap.js +0 -22
- package/cjs/Options/Classes/Particles/Move/MoveTrail.js +0 -27
- package/cjs/Options/Classes/Particles/Move/MoveTrailFill.js +0 -19
- package/cjs/Options/Classes/Particles/Shadow.js +0 -39
- package/cjs/Options/Interfaces/BackgroundMask/IBackgroundMask.js +0 -2
- package/cjs/Options/Interfaces/BackgroundMask/IBackgroundMaskCover.js +0 -2
- package/cjs/Options/Interfaces/Particles/Collisions/ICollisions.js +0 -2
- package/cjs/Options/Interfaces/Particles/Collisions/ICollisionsAbsorb.js +0 -2
- package/cjs/Options/Interfaces/Particles/Collisions/ICollisionsOverlap.js +0 -2
- package/cjs/Options/Interfaces/Particles/IShadow.js +0 -2
- package/cjs/Options/Interfaces/Particles/Move/IMoveTrail.js +0 -2
- package/cjs/Options/Interfaces/Particles/Move/IMoveTrailFill.js +0 -2
- package/cjs/Types/RangeType.js +0 -8
- package/cjs/Utils/NumberUtils.js +0 -177
- package/cjs/init.js +0 -9
- package/esm/Core/Interfaces/IRectSideResult.js +0 -1
- package/esm/Core/Interfaces/ITrailFillData.js +0 -1
- package/esm/Enums/Modes/CollisionMode.js +0 -6
- package/esm/Options/Classes/BackgroundMask/BackgroundMask.js +0 -24
- package/esm/Options/Classes/BackgroundMask/BackgroundMaskCover.js +0 -21
- package/esm/Options/Classes/Particles/Collisions/Collisions.js +0 -33
- package/esm/Options/Classes/Particles/Collisions/CollisionsAbsorb.js +0 -14
- package/esm/Options/Classes/Particles/Collisions/CollisionsOverlap.js +0 -18
- package/esm/Options/Classes/Particles/Move/MoveTrail.js +0 -23
- package/esm/Options/Classes/Particles/Move/MoveTrailFill.js +0 -15
- package/esm/Options/Classes/Particles/Shadow.js +0 -35
- package/esm/Options/Interfaces/BackgroundMask/IBackgroundMask.js +0 -1
- package/esm/Options/Interfaces/BackgroundMask/IBackgroundMaskCover.js +0 -1
- package/esm/Options/Interfaces/Particles/Collisions/ICollisions.js +0 -1
- package/esm/Options/Interfaces/Particles/Collisions/ICollisionsAbsorb.js +0 -1
- package/esm/Options/Interfaces/Particles/Collisions/ICollisionsOverlap.js +0 -1
- package/esm/Options/Interfaces/Particles/IShadow.js +0 -1
- package/esm/Options/Interfaces/Particles/Move/IMoveTrail.js +0 -1
- package/esm/Options/Interfaces/Particles/Move/IMoveTrailFill.js +0 -1
- package/esm/init.js +0 -6
- package/types/Core/Interfaces/IRectSideResult.d.ts +0 -5
- package/types/Core/Interfaces/ITrailFillData.d.ts +0 -6
- package/types/Enums/Modes/CollisionMode.d.ts +0 -5
- package/types/Options/Classes/BackgroundMask/BackgroundMask.d.ts +0 -11
- package/types/Options/Classes/BackgroundMask/BackgroundMaskCover.d.ts +0 -11
- package/types/Options/Classes/Particles/Collisions/Collisions.d.ts +0 -18
- package/types/Options/Classes/Particles/Collisions/CollisionsAbsorb.d.ts +0 -8
- package/types/Options/Classes/Particles/Collisions/CollisionsOverlap.d.ts +0 -9
- package/types/Options/Classes/Particles/Move/MoveTrail.d.ts +0 -11
- package/types/Options/Classes/Particles/Move/MoveTrailFill.d.ts +0 -9
- package/types/Options/Classes/Particles/Shadow.d.ts +0 -13
- package/types/Options/Interfaces/BackgroundMask/IBackgroundMask.d.ts +0 -8
- package/types/Options/Interfaces/BackgroundMask/IBackgroundMaskCover.d.ts +0 -6
- package/types/Options/Interfaces/Particles/Collisions/ICollisions.d.ts +0 -13
- package/types/Options/Interfaces/Particles/Collisions/ICollisionsAbsorb.d.ts +0 -3
- package/types/Options/Interfaces/Particles/Collisions/ICollisionsOverlap.d.ts +0 -4
- package/types/Options/Interfaces/Particles/IShadow.d.ts +0 -8
- package/types/Options/Interfaces/Particles/Move/IMoveTrail.d.ts +0 -6
- package/types/Options/Interfaces/Particles/Move/IMoveTrailFill.d.ts +0 -5
- package/types/init.d.ts +0 -2
- package/umd/Core/Interfaces/IRectSideResult.js +0 -12
- package/umd/Core/Interfaces/ITrailFillData.js +0 -12
- package/umd/Enums/Modes/CollisionMode.js +0 -19
- package/umd/Options/Classes/BackgroundMask/BackgroundMask.js +0 -38
- package/umd/Options/Classes/BackgroundMask/BackgroundMaskCover.js +0 -35
- package/umd/Options/Classes/Particles/Collisions/Collisions.js +0 -47
- package/umd/Options/Classes/Particles/Collisions/CollisionsAbsorb.js +0 -28
- package/umd/Options/Classes/Particles/Collisions/CollisionsOverlap.js +0 -32
- package/umd/Options/Classes/Particles/Move/MoveTrail.js +0 -37
- package/umd/Options/Classes/Particles/Move/MoveTrailFill.js +0 -29
- package/umd/Options/Classes/Particles/Shadow.js +0 -49
- package/umd/Options/Interfaces/BackgroundMask/IBackgroundMask.js +0 -12
- package/umd/Options/Interfaces/BackgroundMask/IBackgroundMaskCover.js +0 -12
- package/umd/Options/Interfaces/Particles/Collisions/ICollisions.js +0 -12
- package/umd/Options/Interfaces/Particles/Collisions/ICollisionsAbsorb.js +0 -12
- package/umd/Options/Interfaces/Particles/Collisions/ICollisionsOverlap.js +0 -12
- package/umd/Options/Interfaces/Particles/IShadow.js +0 -12
- package/umd/Options/Interfaces/Particles/Move/IMoveTrail.js +0 -12
- package/umd/Options/Interfaces/Particles/Move/IMoveTrailFill.js +0 -12
- /package/browser/{Types → Enums}/RangeType.js +0 -0
- /package/{esm/Types → cjs/Enums}/RangeType.js +0 -0
- /package/types/{Types → Enums}/RangeType.d.ts +0 -0
- /package/umd/{Types → Enums}/RangeType.js +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { double, lengthOffset, millisecondsToSeconds,
|
|
2
|
-
import { executeOnSingleOrMultiple, safeMatchMedia } from "../../Utils/Utils.js";
|
|
1
|
+
import { double, lengthOffset, millisecondsToSeconds, mouseDownEvent, mouseLeaveEvent, mouseMoveEvent, mouseOutEvent, mouseUpEvent, resizeEvent, touchCancelEvent, touchDelay, touchEndEvent, touchMoveEvent, touchStartEvent, visibilityChangeEvent, } from "./Constants.js";
|
|
2
|
+
import { executeOnSingleOrMultiple, safeDocument, safeMatchMedia } from "../../Utils/Utils.js";
|
|
3
3
|
import { InteractivityDetect } from "../../Enums/InteractivityDetect.js";
|
|
4
4
|
import { isBoolean } from "../../Utils/TypeUtils.js";
|
|
5
5
|
function manageListener(element, event, handler, add, options) {
|
|
@@ -21,6 +21,7 @@ function manageListener(element, event, handler, add, options) {
|
|
|
21
21
|
export class EventListeners {
|
|
22
22
|
constructor(container) {
|
|
23
23
|
this.container = container;
|
|
24
|
+
this._canPush = true;
|
|
24
25
|
this._doMouseTouchClick = e => {
|
|
25
26
|
const container = this.container, options = container.actualOptions;
|
|
26
27
|
if (this._canPush) {
|
|
@@ -29,12 +30,16 @@ export class EventListeners {
|
|
|
29
30
|
return;
|
|
30
31
|
}
|
|
31
32
|
mouseInteractivity.clickPosition = { ...mousePos };
|
|
32
|
-
mouseInteractivity.clickTime =
|
|
33
|
+
mouseInteractivity.clickTime = Date.now();
|
|
33
34
|
const onClick = options.interactivity.events.onClick;
|
|
34
|
-
executeOnSingleOrMultiple(onClick.mode, mode =>
|
|
35
|
+
executeOnSingleOrMultiple(onClick.mode, mode => {
|
|
36
|
+
this.container.handleClickMode(mode);
|
|
37
|
+
});
|
|
35
38
|
}
|
|
36
39
|
if (e.type === "touchend") {
|
|
37
|
-
setTimeout(() =>
|
|
40
|
+
setTimeout(() => {
|
|
41
|
+
this._mouseTouchFinish();
|
|
42
|
+
}, touchDelay);
|
|
38
43
|
}
|
|
39
44
|
};
|
|
40
45
|
this._handleThemeChange = (e) => {
|
|
@@ -49,17 +54,17 @@ export class EventListeners {
|
|
|
49
54
|
if (!options.pauseOnBlur) {
|
|
50
55
|
return;
|
|
51
56
|
}
|
|
52
|
-
if (
|
|
57
|
+
if (safeDocument().hidden) {
|
|
53
58
|
container.pageHidden = true;
|
|
54
59
|
container.pause();
|
|
55
60
|
}
|
|
56
61
|
else {
|
|
57
62
|
container.pageHidden = false;
|
|
58
63
|
if (container.animationStatus) {
|
|
59
|
-
|
|
64
|
+
container.play(true);
|
|
60
65
|
}
|
|
61
66
|
else {
|
|
62
|
-
|
|
67
|
+
container.draw(true);
|
|
63
68
|
}
|
|
64
69
|
}
|
|
65
70
|
};
|
|
@@ -70,7 +75,7 @@ export class EventListeners {
|
|
|
70
75
|
}
|
|
71
76
|
const handleResize = async () => {
|
|
72
77
|
const canvas = this.container.canvas;
|
|
73
|
-
await canvas
|
|
78
|
+
await canvas.windowResize();
|
|
74
79
|
};
|
|
75
80
|
this._resizeTimeout = setTimeout(() => void handleResize(), this.container.actualOptions.interactivity.events.resize.delay * millisecondsToSeconds);
|
|
76
81
|
};
|
|
@@ -87,14 +92,14 @@ export class EventListeners {
|
|
|
87
92
|
manageListener(interactivityEl, mouseMoveEvent, handlers.mouseMove, add);
|
|
88
93
|
manageListener(interactivityEl, touchStartEvent, handlers.touchStart, add);
|
|
89
94
|
manageListener(interactivityEl, touchMoveEvent, handlers.touchMove, add);
|
|
90
|
-
if (
|
|
91
|
-
manageListener(interactivityEl, touchEndEvent, handlers.touchEnd, add);
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
95
|
+
if (options.interactivity.events.onClick.enable) {
|
|
94
96
|
manageListener(interactivityEl, touchEndEvent, handlers.touchEndClick, add);
|
|
95
97
|
manageListener(interactivityEl, mouseUpEvent, handlers.mouseUp, add);
|
|
96
98
|
manageListener(interactivityEl, mouseDownEvent, handlers.mouseDown, add);
|
|
97
99
|
}
|
|
100
|
+
else {
|
|
101
|
+
manageListener(interactivityEl, touchEndEvent, handlers.touchEnd, add);
|
|
102
|
+
}
|
|
98
103
|
manageListener(interactivityEl, mouseLeaveTmpEvent, handlers.mouseLeave, add);
|
|
99
104
|
manageListener(interactivityEl, touchCancelEvent, handlers.touchCancel, add);
|
|
100
105
|
};
|
|
@@ -114,36 +119,22 @@ export class EventListeners {
|
|
|
114
119
|
this._manageMediaMatch(add);
|
|
115
120
|
this._manageResize(add);
|
|
116
121
|
this._manageInteractivityListeners(mouseLeaveTmpEvent, add);
|
|
117
|
-
|
|
118
|
-
manageListener(document, visibilityChangeEvent, handlers.visibilityChange, add, false);
|
|
119
|
-
}
|
|
122
|
+
manageListener(document, visibilityChangeEvent, handlers.visibilityChange, add, false);
|
|
120
123
|
};
|
|
121
124
|
this._manageMediaMatch = add => {
|
|
122
|
-
const handlers = this._handlers
|
|
123
|
-
if (!
|
|
125
|
+
const handlers = this._handlers;
|
|
126
|
+
if (!this._matchMedia) {
|
|
124
127
|
return;
|
|
125
128
|
}
|
|
126
|
-
|
|
127
|
-
manageListener(mediaMatch, "change", handlers.themeChange, add);
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
if (mediaMatch.addListener === undefined) {
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
if (add) {
|
|
134
|
-
mediaMatch.addListener(handlers.oldThemeChange);
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
mediaMatch.removeListener(handlers.oldThemeChange);
|
|
138
|
-
}
|
|
129
|
+
manageListener(this._matchMedia, "change", handlers.themeChange, add);
|
|
139
130
|
};
|
|
140
131
|
this._manageResize = add => {
|
|
141
132
|
const handlers = this._handlers, container = this.container, options = container.actualOptions;
|
|
142
|
-
if (!options.interactivity.events.resize) {
|
|
133
|
+
if (!options.interactivity.events.resize.enable) {
|
|
143
134
|
return;
|
|
144
135
|
}
|
|
145
136
|
if (typeof ResizeObserver === "undefined") {
|
|
146
|
-
manageListener(
|
|
137
|
+
manageListener(globalThis, resizeEvent, handlers.resize, add);
|
|
147
138
|
return;
|
|
148
139
|
}
|
|
149
140
|
const canvasEl = container.canvas.element;
|
|
@@ -166,11 +157,7 @@ export class EventListeners {
|
|
|
166
157
|
}
|
|
167
158
|
};
|
|
168
159
|
this._mouseDown = () => {
|
|
169
|
-
const { interactivity } = this.container;
|
|
170
|
-
if (!interactivity) {
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
const { mouse } = interactivity;
|
|
160
|
+
const { interactivity } = this.container, { mouse } = interactivity;
|
|
174
161
|
mouse.clicking = true;
|
|
175
162
|
mouse.downPosition = mouse.position;
|
|
176
163
|
};
|
|
@@ -197,11 +184,7 @@ export class EventListeners {
|
|
|
197
184
|
mouse.clicking = false;
|
|
198
185
|
};
|
|
199
186
|
this._mouseTouchFinish = () => {
|
|
200
|
-
const interactivity = this.container
|
|
201
|
-
if (!interactivity) {
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
const mouse = interactivity.mouse;
|
|
187
|
+
const { interactivity } = this.container, { mouse } = interactivity;
|
|
205
188
|
delete mouse.position;
|
|
206
189
|
delete mouse.clickPosition;
|
|
207
190
|
delete mouse.downPosition;
|
|
@@ -211,7 +194,7 @@ export class EventListeners {
|
|
|
211
194
|
};
|
|
212
195
|
this._mouseTouchMove = e => {
|
|
213
196
|
const container = this.container, options = container.actualOptions, interactivity = container.interactivity, canvasEl = container.canvas.element;
|
|
214
|
-
if (!interactivity
|
|
197
|
+
if (!interactivity.element) {
|
|
215
198
|
return;
|
|
216
199
|
}
|
|
217
200
|
interactivity.mouse.inside = true;
|
|
@@ -230,7 +213,7 @@ export class EventListeners {
|
|
|
230
213
|
}
|
|
231
214
|
else if (options.interactivity.detectsOn === InteractivityDetect.parent) {
|
|
232
215
|
const source = mouseEvent.target, target = mouseEvent.currentTarget;
|
|
233
|
-
if (
|
|
216
|
+
if (canvasEl) {
|
|
234
217
|
const sourceRect = source.getBoundingClientRect(), targetRect = target.getBoundingClientRect(), canvasRect = canvasEl.getBoundingClientRect();
|
|
235
218
|
pos = {
|
|
236
219
|
x: mouseEvent.offsetX + double * sourceRect.left - (targetRect.left + canvasRect.left),
|
|
@@ -239,15 +222,15 @@ export class EventListeners {
|
|
|
239
222
|
}
|
|
240
223
|
else {
|
|
241
224
|
pos = {
|
|
242
|
-
x: mouseEvent.offsetX
|
|
243
|
-
y: mouseEvent.offsetY
|
|
225
|
+
x: mouseEvent.offsetX,
|
|
226
|
+
y: mouseEvent.offsetY,
|
|
244
227
|
};
|
|
245
228
|
}
|
|
246
229
|
}
|
|
247
230
|
else if (mouseEvent.target === canvasEl) {
|
|
248
231
|
pos = {
|
|
249
|
-
x: mouseEvent.offsetX
|
|
250
|
-
y: mouseEvent.offsetY
|
|
232
|
+
x: mouseEvent.offsetX,
|
|
233
|
+
y: mouseEvent.offsetY,
|
|
251
234
|
};
|
|
252
235
|
}
|
|
253
236
|
}
|
|
@@ -255,9 +238,12 @@ export class EventListeners {
|
|
|
255
238
|
this._canPush = e.type !== "touchmove";
|
|
256
239
|
if (canvasEl) {
|
|
257
240
|
const touchEvent = e, lastTouch = touchEvent.touches[touchEvent.touches.length - lengthOffset], canvasRect = canvasEl.getBoundingClientRect();
|
|
241
|
+
if (!lastTouch) {
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
258
244
|
pos = {
|
|
259
|
-
x: lastTouch.clientX -
|
|
260
|
-
y: lastTouch.clientY -
|
|
245
|
+
x: lastTouch.clientX - canvasRect.left,
|
|
246
|
+
y: lastTouch.clientY - canvasRect.top,
|
|
261
247
|
};
|
|
262
248
|
}
|
|
263
249
|
}
|
|
@@ -290,21 +276,45 @@ export class EventListeners {
|
|
|
290
276
|
}
|
|
291
277
|
this._mouseTouchMove(e);
|
|
292
278
|
};
|
|
293
|
-
this.
|
|
279
|
+
this._matchMedia = safeMatchMedia("(prefers-color-scheme: dark)");
|
|
294
280
|
this._touches = new Map();
|
|
295
281
|
this._handlers = {
|
|
296
|
-
mouseDown: () =>
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
282
|
+
mouseDown: () => {
|
|
283
|
+
this._mouseDown();
|
|
284
|
+
},
|
|
285
|
+
mouseLeave: () => {
|
|
286
|
+
this._mouseTouchFinish();
|
|
287
|
+
},
|
|
288
|
+
mouseMove: (e) => {
|
|
289
|
+
this._mouseTouchMove(e);
|
|
290
|
+
},
|
|
291
|
+
mouseUp: (e) => {
|
|
292
|
+
this._mouseTouchClick(e);
|
|
293
|
+
},
|
|
294
|
+
touchStart: (e) => {
|
|
295
|
+
this._touchStart(e);
|
|
296
|
+
},
|
|
297
|
+
touchMove: (e) => {
|
|
298
|
+
this._mouseTouchMove(e);
|
|
299
|
+
},
|
|
300
|
+
touchEnd: (e) => {
|
|
301
|
+
this._touchEnd(e);
|
|
302
|
+
},
|
|
303
|
+
touchCancel: (e) => {
|
|
304
|
+
this._touchEnd(e);
|
|
305
|
+
},
|
|
306
|
+
touchEndClick: (e) => {
|
|
307
|
+
this._touchEndClick(e);
|
|
308
|
+
},
|
|
309
|
+
visibilityChange: () => {
|
|
310
|
+
this._handleVisibilityChange();
|
|
311
|
+
},
|
|
312
|
+
themeChange: (e) => {
|
|
313
|
+
this._handleThemeChange(e);
|
|
314
|
+
},
|
|
315
|
+
oldThemeChange: (e) => {
|
|
316
|
+
this._handleThemeChange(e);
|
|
317
|
+
},
|
|
308
318
|
resize: () => {
|
|
309
319
|
this._handleWindowResize();
|
|
310
320
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Circle, Rectangle } from "./Ranges.js";
|
|
2
2
|
import { double, half, subdivideCount } from "./Constants.js";
|
|
3
|
-
import { getDistance } from "../../Utils/
|
|
3
|
+
import { getDistance } from "../../Utils/MathUtils.js";
|
|
4
4
|
export class QuadTree {
|
|
5
5
|
constructor(rectangle, capacity) {
|
|
6
6
|
this.rectangle = rectangle;
|
package/esm/Core/Utils/Ranges.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RangeType } from "../../
|
|
2
|
-
import { getDistance } from "../../Utils/
|
|
1
|
+
import { RangeType } from "../../Enums/RangeType.js";
|
|
2
|
+
import { getDistance } from "../../Utils/MathUtils.js";
|
|
3
3
|
import { squareExp } from "./Constants.js";
|
|
4
4
|
export class BaseRange {
|
|
5
5
|
constructor(x, y, type) {
|
|
@@ -1,25 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { isNumber } from "../../Utils/TypeUtils.js";
|
|
1
|
+
import { inverseFactorNumerator, none, originPoint, squareExp } from "./Constants.js";
|
|
3
2
|
export class Vector3d {
|
|
4
|
-
constructor(
|
|
3
|
+
constructor(x = originPoint.x, y = originPoint.y, z = originPoint.z) {
|
|
5
4
|
this._updateFromAngle = (angle, length) => {
|
|
6
5
|
this.x = Math.cos(angle) * length;
|
|
7
6
|
this.y = Math.sin(angle) * length;
|
|
8
7
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const coords3d = xOrCoords;
|
|
13
|
-
this.z = coords3d.z ? coords3d.z : originPoint.z;
|
|
14
|
-
}
|
|
15
|
-
else if (xOrCoords !== undefined && y !== undefined) {
|
|
16
|
-
this.x = xOrCoords;
|
|
17
|
-
this.y = y;
|
|
18
|
-
this.z = z ?? originPoint.z;
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
throw new Error(`${errorPrefix} Vector3d not initialized correctly`);
|
|
22
|
-
}
|
|
8
|
+
this.x = x;
|
|
9
|
+
this.y = y;
|
|
10
|
+
this.z = z;
|
|
23
11
|
}
|
|
24
12
|
static get origin() {
|
|
25
13
|
return Vector3d.create(originPoint.x, originPoint.y, originPoint.z);
|
|
@@ -40,7 +28,10 @@ export class Vector3d {
|
|
|
40
28
|
return Vector3d.create(source.x, source.y, source.z);
|
|
41
29
|
}
|
|
42
30
|
static create(x, y, z) {
|
|
43
|
-
|
|
31
|
+
if (typeof x === "number") {
|
|
32
|
+
return new Vector3d(x, y ?? originPoint.y, z ?? originPoint.z);
|
|
33
|
+
}
|
|
34
|
+
return new Vector3d(x.x, x.y, Object.hasOwn(x, "z") ? x.z : originPoint.z);
|
|
44
35
|
}
|
|
45
36
|
add(v) {
|
|
46
37
|
return Vector3d.create(this.x + v.x, this.y + v.y, this.z + v.z);
|
|
@@ -103,8 +94,8 @@ export class Vector3d {
|
|
|
103
94
|
}
|
|
104
95
|
}
|
|
105
96
|
export class Vector extends Vector3d {
|
|
106
|
-
constructor(
|
|
107
|
-
super(
|
|
97
|
+
constructor(x = originPoint.x, y = originPoint.y) {
|
|
98
|
+
super(x, y, originPoint.z);
|
|
108
99
|
}
|
|
109
100
|
static get origin() {
|
|
110
101
|
return Vector.create(originPoint.x, originPoint.y);
|
|
@@ -113,6 +104,9 @@ export class Vector extends Vector3d {
|
|
|
113
104
|
return Vector.create(source.x, source.y);
|
|
114
105
|
}
|
|
115
106
|
static create(x, y) {
|
|
116
|
-
|
|
107
|
+
if (typeof x === "number") {
|
|
108
|
+
return new Vector(x, y ?? originPoint.y);
|
|
109
|
+
}
|
|
110
|
+
return new Vector(x.x, x.y);
|
|
117
111
|
}
|
|
118
112
|
}
|
|
@@ -26,11 +26,11 @@ export class AnimatableColor extends OptionsColor {
|
|
|
26
26
|
}
|
|
27
27
|
const colorAnimation = data.animation;
|
|
28
28
|
if (colorAnimation !== undefined) {
|
|
29
|
-
if (colorAnimation.enable
|
|
30
|
-
this.animation.
|
|
29
|
+
if (colorAnimation.enable === undefined) {
|
|
30
|
+
this.animation.load(data.animation);
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
33
|
-
this.animation.load(
|
|
33
|
+
this.animation.h.load(colorAnimation);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AnimationMode } from "../../Enums/Modes/AnimationMode.js";
|
|
2
2
|
import { StartValueType } from "../../Enums/Types/StartValueType.js";
|
|
3
3
|
import { isNull } from "../../Utils/TypeUtils.js";
|
|
4
|
-
import { setRangeValue } from "../../Utils/
|
|
4
|
+
import { setRangeValue } from "../../Utils/MathUtils.js";
|
|
5
5
|
export class AnimationOptions {
|
|
6
6
|
constructor() {
|
|
7
7
|
this.count = 0;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnimationOptions } from "./AnimationOptions.js";
|
|
2
2
|
import { isNull } from "../../Utils/TypeUtils.js";
|
|
3
|
-
import { setRangeValue } from "../../Utils/
|
|
3
|
+
import { setRangeValue } from "../../Utils/MathUtils.js";
|
|
4
4
|
export class ColorAnimation extends AnimationOptions {
|
|
5
5
|
constructor() {
|
|
6
6
|
super();
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { deepExtend, executeOnSingleOrMultiple, safeMatchMedia } from "../../Utils/Utils.js";
|
|
2
2
|
import { isBoolean, isNull } from "../../Utils/TypeUtils.js";
|
|
3
3
|
import { Background } from "./Background/Background.js";
|
|
4
|
-
import { BackgroundMask } from "./BackgroundMask/BackgroundMask.js";
|
|
5
4
|
import { FullScreen } from "./FullScreen/FullScreen.js";
|
|
6
5
|
import { Interactivity } from "./Interactivity/Interactivity.js";
|
|
7
6
|
import { ManualParticle } from "./ManualParticle.js";
|
|
@@ -10,7 +9,7 @@ import { ResponsiveMode } from "../../Enums/Modes/ResponsiveMode.js";
|
|
|
10
9
|
import { Theme } from "./Theme/Theme.js";
|
|
11
10
|
import { ThemeMode } from "../../Enums/Modes/ThemeMode.js";
|
|
12
11
|
import { loadParticlesOptions } from "../../Utils/OptionsUtils.js";
|
|
13
|
-
import { setRangeValue } from "../../Utils/
|
|
12
|
+
import { setRangeValue } from "../../Utils/MathUtils.js";
|
|
14
13
|
export class Options {
|
|
15
14
|
constructor(engine, container) {
|
|
16
15
|
this._findDefaultTheme = mode => {
|
|
@@ -24,7 +23,6 @@ export class Options {
|
|
|
24
23
|
this._container = container;
|
|
25
24
|
this.autoPlay = true;
|
|
26
25
|
this.background = new Background();
|
|
27
|
-
this.backgroundMask = new BackgroundMask();
|
|
28
26
|
this.clear = true;
|
|
29
27
|
this.defaultThemes = {};
|
|
30
28
|
this.delay = 0;
|
|
@@ -32,6 +30,7 @@ export class Options {
|
|
|
32
30
|
this.detectRetina = true;
|
|
33
31
|
this.duration = 0;
|
|
34
32
|
this.fpsLimit = 120;
|
|
33
|
+
this.hdr = true;
|
|
35
34
|
this.interactivity = new Interactivity(engine, container);
|
|
36
35
|
this.manualParticles = [];
|
|
37
36
|
this.particles = loadParticlesOptions(this._engine, this._container);
|
|
@@ -48,7 +47,9 @@ export class Options {
|
|
|
48
47
|
return;
|
|
49
48
|
}
|
|
50
49
|
if (data.preset !== undefined) {
|
|
51
|
-
executeOnSingleOrMultiple(data.preset, preset =>
|
|
50
|
+
executeOnSingleOrMultiple(data.preset, preset => {
|
|
51
|
+
this._importPreset(preset);
|
|
52
|
+
});
|
|
52
53
|
}
|
|
53
54
|
if (data.autoPlay !== undefined) {
|
|
54
55
|
this.autoPlay = data.autoPlay;
|
|
@@ -76,6 +77,9 @@ export class Options {
|
|
|
76
77
|
if (fpsLimit !== undefined) {
|
|
77
78
|
this.fpsLimit = fpsLimit;
|
|
78
79
|
}
|
|
80
|
+
if (data.hdr !== undefined) {
|
|
81
|
+
this.hdr = data.hdr;
|
|
82
|
+
}
|
|
79
83
|
if (data.pauseOnBlur !== undefined) {
|
|
80
84
|
this.pauseOnBlur = data.pauseOnBlur;
|
|
81
85
|
}
|
|
@@ -93,7 +97,6 @@ export class Options {
|
|
|
93
97
|
else {
|
|
94
98
|
this.fullScreen.load(fullScreen);
|
|
95
99
|
}
|
|
96
|
-
this.backgroundMask.load(data.backgroundMask);
|
|
97
100
|
this.interactivity.load(data.interactivity);
|
|
98
101
|
if (data.manualParticles) {
|
|
99
102
|
this.manualParticles = data.manualParticles.map(t => {
|
|
@@ -127,14 +130,14 @@ export class Options {
|
|
|
127
130
|
if (data.themes !== undefined) {
|
|
128
131
|
for (const theme of data.themes) {
|
|
129
132
|
const existingTheme = this.themes.find(t => t.name === theme.name);
|
|
130
|
-
if (
|
|
133
|
+
if (existingTheme) {
|
|
134
|
+
existingTheme.load(theme);
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
131
137
|
const optTheme = new Theme();
|
|
132
138
|
optTheme.load(theme);
|
|
133
139
|
this.themes.push(optTheme);
|
|
134
140
|
}
|
|
135
|
-
else {
|
|
136
|
-
existingTheme.load(theme);
|
|
137
|
-
}
|
|
138
141
|
}
|
|
139
142
|
}
|
|
140
143
|
this.defaultThemes.dark = this._findDefaultTheme(ThemeMode.dark)?.name;
|
|
@@ -142,7 +145,7 @@ export class Options {
|
|
|
142
145
|
}
|
|
143
146
|
setResponsive(width, pxRatio, defaultOptions) {
|
|
144
147
|
this.load(defaultOptions);
|
|
145
|
-
const responsiveOptions = this.responsive.find(t => t.mode === ResponsiveMode.screen
|
|
148
|
+
const responsiveOptions = this.responsive.find(t => t.mode === ResponsiveMode.screen ? t.maxWidth > screen.availWidth : t.maxWidth * pxRatio > width);
|
|
146
149
|
this.load(responsiveOptions?.options);
|
|
147
150
|
return responsiveOptions?.maxWidth;
|
|
148
151
|
}
|
|
@@ -5,10 +5,9 @@ import { MoveAttract } from "./MoveAttract.js";
|
|
|
5
5
|
import { MoveCenter } from "./MoveCenter.js";
|
|
6
6
|
import { MoveGravity } from "./MoveGravity.js";
|
|
7
7
|
import { MovePath } from "./Path/MovePath.js";
|
|
8
|
-
import { MoveTrail } from "./MoveTrail.js";
|
|
9
8
|
import { OutModes } from "./OutModes.js";
|
|
10
9
|
import { Spin } from "./Spin.js";
|
|
11
|
-
import { setRangeValue } from "../../../../Utils/
|
|
10
|
+
import { setRangeValue } from "../../../../Utils/MathUtils.js";
|
|
12
11
|
export class Move {
|
|
13
12
|
constructor() {
|
|
14
13
|
this.angle = new MoveAngle();
|
|
@@ -27,7 +26,6 @@ export class Move {
|
|
|
27
26
|
this.speed = 2;
|
|
28
27
|
this.spin = new Spin();
|
|
29
28
|
this.straight = false;
|
|
30
|
-
this.trail = new MoveTrail();
|
|
31
29
|
this.vibrate = false;
|
|
32
30
|
this.warp = false;
|
|
33
31
|
}
|
|
@@ -84,7 +82,6 @@ export class Move {
|
|
|
84
82
|
if (data.straight !== undefined) {
|
|
85
83
|
this.straight = data.straight;
|
|
86
84
|
}
|
|
87
|
-
this.trail.load(data.trail);
|
|
88
85
|
if (data.vibrate !== undefined) {
|
|
89
86
|
this.vibrate = data.vibrate;
|
|
90
87
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { deepExtend } from "../../../../Utils/Utils.js";
|
|
2
2
|
import { isNull } from "../../../../Utils/TypeUtils.js";
|
|
3
|
-
import { setRangeValue } from "../../../../Utils/
|
|
3
|
+
import { setRangeValue } from "../../../../Utils/MathUtils.js";
|
|
4
4
|
export class Spin {
|
|
5
5
|
constructor() {
|
|
6
6
|
this.acceleration = 0;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { deepExtend, executeOnSingleOrMultiple } from "../../../Utils/Utils.js";
|
|
2
2
|
import { AnimatableColor } from "../AnimatableColor.js";
|
|
3
|
-
import { Collisions } from "./Collisions/Collisions.js";
|
|
4
3
|
import { Effect } from "./Effect/Effect.js";
|
|
5
4
|
import { Move } from "./Move/Move.js";
|
|
6
5
|
import { Opacity } from "./Opacity/Opacity.js";
|
|
7
6
|
import { ParticlesBounce } from "./Bounce/ParticlesBounce.js";
|
|
8
7
|
import { ParticlesNumber } from "./Number/ParticlesNumber.js";
|
|
9
|
-
import { Shadow } from "./Shadow.js";
|
|
10
8
|
import { Shape } from "./Shape/Shape.js";
|
|
11
9
|
import { Size } from "./Size/Size.js";
|
|
12
10
|
import { Stroke } from "./Stroke.js";
|
|
@@ -17,7 +15,6 @@ export class ParticlesOptions {
|
|
|
17
15
|
this._engine = engine;
|
|
18
16
|
this._container = container;
|
|
19
17
|
this.bounce = new ParticlesBounce();
|
|
20
|
-
this.collisions = new Collisions();
|
|
21
18
|
this.color = new AnimatableColor();
|
|
22
19
|
this.color.value = "#fff";
|
|
23
20
|
this.effect = new Effect();
|
|
@@ -26,7 +23,6 @@ export class ParticlesOptions {
|
|
|
26
23
|
this.number = new ParticlesNumber();
|
|
27
24
|
this.opacity = new Opacity();
|
|
28
25
|
this.reduceDuplicates = false;
|
|
29
|
-
this.shadow = new Shadow();
|
|
30
26
|
this.shape = new Shape();
|
|
31
27
|
this.size = new Size();
|
|
32
28
|
this.stroke = new Stroke();
|
|
@@ -58,9 +54,7 @@ export class ParticlesOptions {
|
|
|
58
54
|
this.opacity.load(data.opacity);
|
|
59
55
|
this.shape.load(data.shape);
|
|
60
56
|
this.size.load(data.size);
|
|
61
|
-
this.shadow.load(data.shadow);
|
|
62
57
|
this.zIndex.load(data.zIndex);
|
|
63
|
-
this.collisions.load(data.collisions);
|
|
64
58
|
if (data.interactivity !== undefined) {
|
|
65
59
|
this.interactivity = deepExtend({}, data.interactivity);
|
|
66
60
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnimatableColor } from "../AnimatableColor.js";
|
|
2
2
|
import { isNull } from "../../../Utils/TypeUtils.js";
|
|
3
|
-
import { setRangeValue } from "../../../Utils/
|
|
3
|
+
import { setRangeValue } from "../../../Utils/MathUtils.js";
|
|
4
4
|
export class Stroke {
|
|
5
5
|
constructor() {
|
|
6
6
|
this.width = 0;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnimationOptions, RangedAnimationOptions } from "./AnimationOptions.js";
|
|
2
2
|
import { isNull } from "../../Utils/TypeUtils.js";
|
|
3
|
-
import { setRangeValue } from "../../Utils/
|
|
3
|
+
import { setRangeValue } from "../../Utils/MathUtils.js";
|
|
4
4
|
export class ValueWithRandom {
|
|
5
5
|
constructor() {
|
|
6
6
|
this.value = 0;
|