@tsparticles/engine 4.0.0-alpha.25 → 4.0.0-alpha.27

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.
Files changed (140) hide show
  1. package/164.min.js +1 -0
  2. package/README.md +3 -3
  3. package/browser/Core/Canvas.js +7 -4
  4. package/browser/Core/Engine.js +6 -16
  5. package/browser/Core/Particle.js +10 -35
  6. package/browser/Core/Particles.js +0 -23
  7. package/browser/Core/Utils/Constants.js +1 -1
  8. package/browser/Core/Utils/Ranges.js +2 -2
  9. package/browser/Core/Utils/Vectors.js +10 -7
  10. package/browser/Options/Classes/ColorAnimation.js +11 -1
  11. package/browser/Options/Classes/HslAnimation.js +4 -3
  12. package/browser/Options/Classes/Options.js +38 -1
  13. package/browser/Options/Classes/Particles/Effect/Effect.js +0 -5
  14. package/browser/Options/Classes/Particles/Fill.js +28 -0
  15. package/browser/Options/Classes/Particles/Move/Move.js +0 -4
  16. package/browser/Options/Classes/Particles/ParticlesOptions.js +12 -6
  17. package/browser/Options/Classes/Particles/Shape/Shape.js +0 -5
  18. package/browser/Utils/CanvasUtils.js +33 -36
  19. package/browser/Utils/ColorUtils.js +22 -19
  20. package/browser/Utils/MathUtils.js +8 -1
  21. package/browser/Utils/Utils.js +93 -24
  22. package/browser/exports.js +1 -1
  23. package/cjs/Core/Canvas.js +7 -4
  24. package/cjs/Core/Engine.js +6 -16
  25. package/cjs/Core/Particle.js +10 -35
  26. package/cjs/Core/Particles.js +0 -23
  27. package/cjs/Core/Utils/Constants.js +1 -1
  28. package/cjs/Core/Utils/Ranges.js +2 -2
  29. package/cjs/Core/Utils/Vectors.js +10 -7
  30. package/cjs/Options/Classes/ColorAnimation.js +11 -1
  31. package/cjs/Options/Classes/HslAnimation.js +4 -3
  32. package/cjs/Options/Classes/Options.js +38 -1
  33. package/cjs/Options/Classes/Particles/Effect/Effect.js +0 -5
  34. package/cjs/Options/Classes/Particles/Fill.js +28 -0
  35. package/cjs/Options/Classes/Particles/Move/Move.js +0 -4
  36. package/cjs/Options/Classes/Particles/ParticlesOptions.js +12 -6
  37. package/cjs/Options/Classes/Particles/Shape/Shape.js +0 -5
  38. package/cjs/Utils/CanvasUtils.js +33 -36
  39. package/cjs/Utils/ColorUtils.js +22 -19
  40. package/cjs/Utils/MathUtils.js +8 -1
  41. package/cjs/Utils/Utils.js +93 -24
  42. package/cjs/exports.js +1 -1
  43. package/dist_browser_Core_Container_js.js +4 -4
  44. package/esm/Core/Canvas.js +7 -4
  45. package/esm/Core/Engine.js +6 -16
  46. package/esm/Core/Particle.js +10 -35
  47. package/esm/Core/Particles.js +0 -23
  48. package/esm/Core/Utils/Constants.js +1 -1
  49. package/esm/Core/Utils/Ranges.js +2 -2
  50. package/esm/Core/Utils/Vectors.js +10 -7
  51. package/esm/Options/Classes/ColorAnimation.js +11 -1
  52. package/esm/Options/Classes/HslAnimation.js +4 -3
  53. package/esm/Options/Classes/Options.js +38 -1
  54. package/esm/Options/Classes/Particles/Effect/Effect.js +0 -5
  55. package/esm/Options/Classes/Particles/Fill.js +28 -0
  56. package/esm/Options/Classes/Particles/Move/Move.js +0 -4
  57. package/esm/Options/Classes/Particles/ParticlesOptions.js +12 -6
  58. package/esm/Options/Classes/Particles/Shape/Shape.js +0 -5
  59. package/esm/Utils/CanvasUtils.js +33 -36
  60. package/esm/Utils/ColorUtils.js +22 -19
  61. package/esm/Utils/MathUtils.js +8 -1
  62. package/esm/Utils/Utils.js +93 -24
  63. package/esm/exports.js +1 -1
  64. package/package.json +1 -1
  65. package/report.html +1 -1
  66. package/scripts/install.js +4 -20
  67. package/tsparticles.engine.js +34 -34
  68. package/tsparticles.engine.min.js +2 -2
  69. package/types/Core/Engine.d.ts +5 -9
  70. package/types/Core/Interfaces/IPalette.d.ts +7 -0
  71. package/types/Core/Interfaces/IParticleOpacityData.d.ts +1 -0
  72. package/types/Core/Interfaces/IParticleValueAnimation.d.ts +3 -3
  73. package/types/Core/Interfaces/IShapeValues.d.ts +0 -1
  74. package/types/Core/Particle.d.ts +3 -7
  75. package/types/Core/Particles.d.ts +0 -5
  76. package/types/Core/Utils/Constants.d.ts +1 -1
  77. package/types/Core/Utils/Vectors.d.ts +6 -6
  78. package/types/Options/Classes/ColorAnimation.d.ts +3 -1
  79. package/types/Options/Classes/Options.d.ts +2 -0
  80. package/types/Options/Classes/Particles/Effect/Effect.d.ts +0 -1
  81. package/types/Options/Classes/Particles/Fill.d.ts +12 -0
  82. package/types/Options/Classes/Particles/Move/Move.d.ts +0 -2
  83. package/types/Options/Classes/Particles/ParticlesOptions.d.ts +2 -2
  84. package/types/Options/Classes/Particles/Shape/Shape.d.ts +0 -1
  85. package/types/Options/Interfaces/IColorAnimation.d.ts +2 -0
  86. package/types/Options/Interfaces/IOptions.d.ts +1 -0
  87. package/types/Options/Interfaces/Particles/Effect/IEffect.d.ts +0 -1
  88. package/types/Options/Interfaces/Particles/IFill.d.ts +9 -0
  89. package/types/Options/Interfaces/Particles/IParticlesOptions.d.ts +2 -2
  90. package/types/Options/Interfaces/Particles/IStroke.d.ts +2 -2
  91. package/types/Options/Interfaces/Particles/Move/IMove.d.ts +0 -2
  92. package/types/Options/Interfaces/Particles/Shape/IShape.d.ts +0 -1
  93. package/types/Types/EngineInitializers.d.ts +0 -6
  94. package/types/Utils/CanvasUtils.d.ts +6 -7
  95. package/types/Utils/ColorUtils.d.ts +1 -2
  96. package/types/Utils/MathUtils.d.ts +2 -0
  97. package/types/Utils/Utils.d.ts +7 -0
  98. package/types/export-types.d.ts +2 -4
  99. package/types/exports.d.ts +1 -1
  100. package/umd/Core/Canvas.js +6 -3
  101. package/umd/Core/Engine.js +6 -16
  102. package/umd/Core/Particle.js +11 -36
  103. package/umd/Core/Particles.js +0 -23
  104. package/umd/Core/Utils/Constants.js +2 -2
  105. package/umd/Core/Utils/Ranges.js +1 -1
  106. package/umd/Core/Utils/Vectors.js +10 -7
  107. package/umd/Options/Classes/ColorAnimation.js +11 -1
  108. package/umd/Options/Classes/HslAnimation.js +5 -4
  109. package/umd/Options/Classes/Options.js +38 -1
  110. package/umd/Options/Classes/Particles/Effect/Effect.js +0 -5
  111. package/umd/Options/Classes/Particles/Fill.js +42 -0
  112. package/umd/Options/Classes/Particles/Move/Move.js +1 -5
  113. package/umd/Options/Classes/Particles/ParticlesOptions.js +13 -7
  114. package/umd/Options/Classes/Particles/Shape/Shape.js +0 -5
  115. package/umd/Utils/CanvasUtils.js +33 -36
  116. package/umd/Utils/ColorUtils.js +21 -18
  117. package/umd/Utils/MathUtils.js +10 -1
  118. package/umd/Utils/Utils.js +94 -24
  119. package/umd/exports.js +2 -2
  120. package/152.min.js +0 -1
  121. package/browser/Options/Classes/Particles/Move/MoveAttract.js +0 -36
  122. package/cjs/Options/Classes/Particles/Move/MoveAttract.js +0 -36
  123. package/esm/Core/Interfaces/IMovePathGenerator.js +0 -1
  124. package/esm/Core/Interfaces/IParticleMover.js +0 -1
  125. package/esm/Options/Classes/Particles/Move/MoveAttract.js +0 -36
  126. package/esm/Options/Interfaces/Particles/Move/IMoveAttract.js +0 -1
  127. package/types/Core/Interfaces/IMovePathGenerator.d.ts +0 -9
  128. package/types/Core/Interfaces/IParticleMover.d.ts +0 -7
  129. package/types/Options/Classes/Particles/Move/MoveAttract.d.ts +0 -12
  130. package/types/Options/Interfaces/Particles/Move/IMoveAttract.d.ts +0 -7
  131. package/umd/Options/Classes/Particles/Move/MoveAttract.js +0 -50
  132. package/umd/Options/Interfaces/Particles/Move/IMoveAttract.js +0 -12
  133. /package/browser/Core/Interfaces/{IMovePathGenerator.js → IPalette.js} +0 -0
  134. /package/browser/{Core/Interfaces/IParticleMover.js → Options/Interfaces/Particles/IFill.js} +0 -0
  135. /package/{browser/Options/Interfaces/Particles/Move/IMoveAttract.js → cjs/Core/Interfaces/IPalette.js} +0 -0
  136. /package/cjs/{Core/Interfaces/IMovePathGenerator.js → Options/Interfaces/Particles/IFill.js} +0 -0
  137. /package/{cjs/Core/Interfaces/IParticleMover.js → esm/Core/Interfaces/IPalette.js} +0 -0
  138. /package/{cjs/Options/Interfaces/Particles/Move/IMoveAttract.js → esm/Options/Interfaces/Particles/IFill.js} +0 -0
  139. /package/umd/Core/Interfaces/{IMovePathGenerator.js → IPalette.js} +0 -0
  140. /package/umd/{Core/Interfaces/IParticleMover.js → Options/Interfaces/Particles/IFill.js} +0 -0
@@ -1,9 +1,9 @@
1
1
  import type { IAnimatableColor } from "../IAnimatableColor.js";
2
- import type { IColor } from "../../../Core/Interfaces/Colors.js";
2
+ import type { IRangeColor } from "../../../Core/Interfaces/Colors.js";
3
3
  import type { RangeValue } from "../../../Types/RangeValue.js";
4
4
  import type { RecursivePartial } from "../../../Types/RecursivePartial.js";
5
5
  export interface IStroke {
6
- color?: string | RecursivePartial<IAnimatableColor> | RecursivePartial<IColor>;
6
+ color?: RecursivePartial<IAnimatableColor> | RecursivePartial<IRangeColor>;
7
7
  opacity?: RangeValue;
8
8
  width: RangeValue;
9
9
  }
@@ -1,7 +1,6 @@
1
1
  import type { MoveDirection, MoveDirectionAlt } from "../../../../Enums/Directions/MoveDirection.js";
2
2
  import type { IDistance } from "../../../../Core/Interfaces/IDistance.js";
3
3
  import type { IMoveAngle } from "./IMoveAngle.js";
4
- import type { IMoveAttract } from "./IMoveAttract.js";
5
4
  import type { IMoveCenter } from "./IMoveCenter.js";
6
5
  import type { IMoveGravity } from "./IMoveGravity.js";
7
6
  import type { IMovePath } from "./Path/IMovePath.js";
@@ -11,7 +10,6 @@ import type { OutMode } from "../../../../Enums/Modes/OutMode.js";
11
10
  import type { RangeValue } from "../../../../Types/RangeValue.js";
12
11
  export interface IMove {
13
12
  angle: number | IMoveAngle;
14
- attract: IMoveAttract;
15
13
  center: IMoveCenter;
16
14
  decay: RangeValue;
17
15
  direction: MoveDirection | keyof typeof MoveDirection | MoveDirectionAlt | number;
@@ -2,7 +2,6 @@ import type { ShapeData } from "../../../../Types/ShapeData.js";
2
2
  import type { SingleOrMultiple } from "../../../../Types/SingleOrMultiple.js";
3
3
  export interface IShape {
4
4
  close: boolean;
5
- fill: boolean;
6
5
  options: ShapeData;
7
6
  type: SingleOrMultiple<string>;
8
7
  }
@@ -1,19 +1,13 @@
1
1
  import type { Container } from "../Core/Container.js";
2
2
  import type { IEffectDrawer } from "../Core/Interfaces/IEffectDrawer.js";
3
- import type { IMovePathGenerator } from "../Core/Interfaces/IMovePathGenerator.js";
4
- import type { IParticleMover } from "../Core/Interfaces/IParticleMover.js";
5
3
  import type { IParticleUpdater } from "../Core/Interfaces/IParticleUpdater.js";
6
4
  import type { IShapeDrawer } from "../Core/Interfaces/IShapeDrawer.js";
7
5
  export type GenericInitializer<T> = (container: Container) => Promise<T>;
8
6
  export type EffectInitializer = GenericInitializer<IEffectDrawer>;
9
- export type MoverInitializer = GenericInitializer<IParticleMover>;
10
- export type PathGeneratorInitializer = GenericInitializer<IMovePathGenerator>;
11
7
  export type ShapeInitializer = GenericInitializer<IShapeDrawer>;
12
8
  export type UpdaterInitializer = GenericInitializer<IParticleUpdater>;
13
9
  export interface Initializers {
14
10
  effects: Map<string, EffectInitializer>;
15
- movers: Map<string, MoverInitializer>;
16
- pathGenerators: Map<string, PathGeneratorInitializer>;
17
11
  shapes: Map<string, ShapeInitializer>;
18
12
  updaters: Map<string, UpdaterInitializer>;
19
13
  }
@@ -1,17 +1,16 @@
1
- import type { Container } from "../Core/Container.js";
1
+ import type { IEffectDrawer, IShapeDrawData, IShapeDrawer } from "../export-types.js";
2
2
  import type { IContainerPlugin } from "../Core/Interfaces/IContainerPlugin.js";
3
3
  import type { IDelta } from "../Core/Interfaces/IDelta.js";
4
4
  import type { IDimension } from "../Core/Interfaces/IDimension.js";
5
5
  import type { IDrawParticleParams } from "../Core/Interfaces/IDrawParticleParams.js";
6
- import type { IShapeDrawData } from "../export-types.js";
7
6
  import type { Particle } from "../Core/Particle.js";
8
7
  export declare function paintBase(context: CanvasRenderingContext2D, dimension: IDimension, baseColor?: string): void;
9
8
  export declare function paintImage(context: CanvasRenderingContext2D, dimension: IDimension, image: HTMLImageElement | undefined, opacity: number): void;
10
9
  export declare function clear(context: CanvasRenderingContext2D, dimension: IDimension): void;
11
10
  export declare function drawParticle(data: IDrawParticleParams): void;
12
- export declare function drawAfterEffect(container: Container, data: IShapeDrawData): void;
13
- export declare function drawBeforeEffect(container: Container, data: IShapeDrawData): void;
14
- export declare function drawShape(container: Container, data: IShapeDrawData): void;
15
- export declare function drawShapeAfterDraw(container: Container, data: IShapeDrawData): void;
16
- export declare function drawShapeBeforeDraw(container: Container, data: IShapeDrawData): void;
11
+ export declare function drawAfterEffect(drawer: IEffectDrawer | undefined, data: IShapeDrawData): void;
12
+ export declare function drawBeforeEffect(drawer: IEffectDrawer | undefined, data: IShapeDrawData): void;
13
+ export declare function drawShape(drawer: IShapeDrawer | undefined, data: IShapeDrawData): void;
14
+ export declare function drawShapeAfterDraw(drawer: IShapeDrawer | undefined, data: IShapeDrawData): void;
15
+ export declare function drawShapeBeforeDraw(drawer: IShapeDrawer | undefined, data: IShapeDrawData): void;
17
16
  export declare function drawParticlePlugin(context: CanvasRenderingContext2D, plugin: IContainerPlugin, particle: Particle, delta: IDelta): void;
@@ -6,7 +6,6 @@ import type { IDelta } from "../Core/Interfaces/IDelta.js";
6
6
  import type { IOptionsColor } from "../Options/Interfaces/IOptionsColor.js";
7
7
  import type { IParticleColorAnimation } from "../Core/Interfaces/IParticleValueAnimation.js";
8
8
  import type { IParticleHslAnimation } from "../Core/Interfaces/IParticleHslAnimation.js";
9
- import type { IRangeValue } from "../Core/Interfaces/IRangeValue.js";
10
9
  import type { Particle } from "../Core/Particle.js";
11
10
  export declare function rangeColorToRgb(engine: Engine, input?: string | IRangeColor, index?: number, useIndex?: boolean): IRgb | undefined;
12
11
  export declare function colorToRgb(engine: Engine, input?: string | IColor, index?: number, useIndex?: boolean): IRgb | undefined;
@@ -25,6 +24,6 @@ export declare function getLinkColor(p1: Particle, p2?: Particle, linkColor?: st
25
24
  export declare function getLinkRandomColor(engine: Engine, optColor: string | IOptionsColor, blink: boolean, consent: boolean): IRgb | string | undefined;
26
25
  export declare function getHslFromAnimation(animation?: IParticleHslAnimation): IHsl | undefined;
27
26
  export declare function getHslAnimationFromHsl(hsl: IHsl, animationOptions: HslAnimation | undefined, reduceFactor: number): IParticleHslAnimation;
28
- export declare function updateColorValue(data: IParticleColorAnimation, range: IRangeValue, decrease: boolean, delta: IDelta): void;
27
+ export declare function updateColorValue(data: IParticleColorAnimation, decrease: boolean, delta: IDelta): void;
29
28
  export declare function updateColor(color: IParticleHslAnimation | undefined, delta: IDelta): void;
30
29
  export declare function alterHsl(color: IHsl, type: AlterType, value: number): IHsl;
@@ -21,7 +21,9 @@ export declare function getDistances(pointA: ICoordinates, pointB: ICoordinates)
21
21
  dx: number;
22
22
  dy: number;
23
23
  };
24
+ export declare function getDistanceSq(pointA: ICoordinates, pointB: ICoordinates): number;
24
25
  export declare function getDistance(pointA: ICoordinates, pointB: ICoordinates): number;
26
+ export declare function checkDistance(pointA: ICoordinates, pointB: ICoordinates, distance: number): boolean;
25
27
  export declare function degToRad(degrees: number): number;
26
28
  export declare function getParticleDirectionAngle(direction: MoveDirection | keyof typeof MoveDirection | MoveDirectionAlt | number, position: ICoordinates, center: ICoordinates): number;
27
29
  export declare function getParticleBaseVelocity(direction: number): Vector;
@@ -11,6 +11,12 @@ import { OutModeDirection } from "../Enums/Directions/OutModeDirection.js";
11
11
  import type { Particle } from "../Core/Particle.js";
12
12
  import type { RangedAnimationValueWithRandom } from "../Options/Classes/ValueWithRandom.js";
13
13
  import type { SingleOrMultiple } from "../Types/SingleOrMultiple.js";
14
+ interface MemoizeOptions<TArgs> {
15
+ keyFn?: (args: TArgs) => string;
16
+ maxSize?: number;
17
+ ttlMs?: number;
18
+ }
19
+ export declare function memoize<TArgs extends unknown[], Result>(fn: (...args: TArgs) => Result, options?: MemoizeOptions<TArgs>): (...args: TArgs) => Result;
14
20
  export declare function hasMatchMedia(): boolean;
15
21
  export declare function safeDocument(): Document;
16
22
  export declare function safeMatchMedia(query: string): MediaQueryList | undefined;
@@ -37,3 +43,4 @@ export declare const getFullScreenStyle: (zIndex: number) => CSSStyleDeclaration
37
43
  export declare function manageListener(element: HTMLElement | Node | Window | MediaQueryList | typeof globalThis, event: string, handler: EventListenerOrEventListenerObject, add: boolean, options?: boolean | AddEventListenerOptions | EventListenerObject): void;
38
44
  export declare function getItemsFromInitializer<TItem, TInitializer extends GenericInitializer<TItem>>(container: Container, map: Map<Container, TItem[]>, initializers: Map<string, TInitializer>, force?: boolean): Promise<TItem[]>;
39
45
  export declare function getItemMapFromInitializer<TItem, TInitializer extends GenericInitializer<TItem>>(container: Container, map: Map<Container, Map<string, TItem>>, initializers: Map<string, TInitializer>, force?: boolean): Promise<Map<string, TItem>>;
46
+ export {};
@@ -11,11 +11,10 @@ export type * from "./Core/Interfaces/IDistance.js";
11
11
  export type * from "./Core/Interfaces/IDrawParticleParams.js";
12
12
  export type * from "./Core/Interfaces/IEffectDrawer.js";
13
13
  export type * from "./Core/Interfaces/ILoadParams.js";
14
- export type * from "./Core/Interfaces/IMovePathGenerator.js";
14
+ export type * from "./Core/Interfaces/IPalette.js";
15
15
  export type * from "./Core/Interfaces/IParticleColorStyle.js";
16
16
  export type * from "./Core/Interfaces/IParticleHslAnimation.js";
17
17
  export type * from "./Core/Interfaces/IParticleLife.js";
18
- export type * from "./Core/Interfaces/IParticleMover.js";
19
18
  export type * from "./Core/Interfaces/IParticleRetinaProps.js";
20
19
  export type * from "./Core/Interfaces/IParticleRoll.js";
21
20
  export type * from "./Core/Interfaces/IParticleTransformValues.js";
@@ -43,8 +42,8 @@ export type * from "./Options/Interfaces/IValueWithRandom.js";
43
42
  export type * from "./Options/Interfaces/Particles/Bounce/IParticlesBounce.js";
44
43
  export type * from "./Options/Interfaces/Particles/Effect/IEffect.js";
45
44
  export type * from "./Options/Interfaces/Particles/IParticlesOptions.js";
45
+ export type * from "./Options/Interfaces/Particles/IFill.js";
46
46
  export type * from "./Options/Interfaces/Particles/IStroke.js";
47
- export type * from "./Options/Interfaces/Particles/Move/IMoveAttract.js";
48
47
  export type * from "./Options/Interfaces/Particles/Move/IMove.js";
49
48
  export type * from "./Options/Interfaces/Particles/Move/IMoveAngle.js";
50
49
  export type * from "./Options/Interfaces/Particles/Move/IMoveCenter.js";
@@ -81,4 +80,3 @@ export type { Particle } from "./Core/Particle.js";
81
80
  export type { Particles } from "./Core/Particles.js";
82
81
  export type { Retina } from "./Core/Retina.js";
83
82
  export type { Engine } from "./Core/Engine.js";
84
- export type { IParticlesNumberLimit } from "./Options/Interfaces/Particles/Number/IParticlesNumberLimit.js";
@@ -27,8 +27,8 @@ export * from "./Options/Classes/OptionsColor.js";
27
27
  export * from "./Options/Classes/Particles/Bounce/ParticlesBounce.js";
28
28
  export * from "./Options/Classes/Particles/Bounce/ParticlesBounceFactor.js";
29
29
  export * from "./Options/Classes/Particles/ParticlesOptions.js";
30
+ export * from "./Options/Classes/Particles/Fill.js";
30
31
  export * from "./Options/Classes/Particles/Stroke.js";
31
- export * from "./Options/Classes/Particles/Move/MoveAttract.js";
32
32
  export * from "./Options/Classes/Particles/Move/Move.js";
33
33
  export * from "./Options/Classes/Particles/Move/MoveAngle.js";
34
34
  export * from "./Options/Classes/Particles/Move/MoveCenter.js";
@@ -175,14 +175,14 @@
175
175
  if (radius <= Constants_js_1.minimumSize) {
176
176
  return;
177
177
  }
178
- const pfColor = particle.getFillColor(), psColor = particle.getStrokeColor() ?? pfColor;
178
+ const pfColor = particle.getFillColor(), psColor = particle.getStrokeColor();
179
179
  let [fColor, sColor] = this._getPluginParticleColors(particle);
180
180
  fColor ??= pfColor;
181
181
  sColor ??= psColor;
182
182
  if (!fColor && !sColor) {
183
183
  return;
184
184
  }
185
- const container = this.container, zIndexOptions = particle.options.zIndex, zIndexFactor = Constants_js_1.zIndexFactorOffset - particle.zIndexFactor, { opacity, strokeOpacity } = particle.getOpacity(), transform = this._reusableTransform, colorStyles = this._reusableColorStyles, fill = fColor ? (0, ColorUtils_js_1.getStyleFromHsl)(fColor, container.hdr, opacity) : undefined, stroke = sColor ? (0, ColorUtils_js_1.getStyleFromHsl)(sColor, container.hdr, strokeOpacity) : fill;
185
+ const container = this.container, zIndexOptions = particle.options.zIndex, zIndexFactor = Constants_js_1.zIndexFactorOffset - particle.zIndexFactor, { fillOpacity, opacity, strokeOpacity } = particle.getOpacity(), transform = this._reusableTransform, colorStyles = this._reusableColorStyles, fill = fColor ? (0, ColorUtils_js_1.getStyleFromHsl)(fColor, container.hdr, fillOpacity * opacity) : undefined, stroke = sColor ? (0, ColorUtils_js_1.getStyleFromHsl)(sColor, container.hdr, strokeOpacity * opacity) : fill;
186
186
  transform.a = transform.b = transform.c = transform.d = undefined;
187
187
  colorStyles.fill = fill;
188
188
  colorStyles.stroke = stroke;
@@ -369,6 +369,9 @@
369
369
  willReadFrequently: false,
370
370
  };
371
371
  this._context = this.element.getContext("2d", this._canvasSettings);
372
+ if (this._context) {
373
+ this._context.globalCompositeOperation = Constants_js_1.defaultCompositeValue;
374
+ }
372
375
  this._safeMutationObserver(obs => {
373
376
  obs.disconnect();
374
377
  });
@@ -526,7 +529,7 @@
526
529
  this._resetOriginalStyle();
527
530
  }
528
531
  for (const key in options.style) {
529
- if (!key || !Object.hasOwn(options.style, key)) {
532
+ if (!key || !(key in options.style)) {
530
533
  continue;
531
534
  }
532
535
  const value = options.style[key];
@@ -103,13 +103,10 @@ var __importStar = (this && this.__importStar) || (function () {
103
103
  effectDrawers = new Map();
104
104
  initializers = {
105
105
  effects: new Map(),
106
- movers: new Map(),
107
- pathGenerators: new Map(),
108
106
  shapes: new Map(),
109
107
  updaters: new Map(),
110
108
  };
111
- movers = new Map();
112
- pathGenerators = new Map();
109
+ palettes = new Map();
113
110
  plugins = [];
114
111
  presets = new Map();
115
112
  shapeDrawers = new Map();
@@ -133,7 +130,7 @@ var __importStar = (this && this.__importStar) || (function () {
133
130
  return this._domArray;
134
131
  }
135
132
  get version() {
136
- return "4.0.0-alpha.25";
133
+ return "4.0.0-alpha.27";
137
134
  }
138
135
  addColorManager(name, manager) {
139
136
  this.colorManagers.set(name, manager);
@@ -155,15 +152,12 @@ var __importStar = (this && this.__importStar) || (function () {
155
152
  addEventListener(type, listener) {
156
153
  this._eventDispatcher.addEventListener(type, listener);
157
154
  }
158
- addMover(name, moverInitializer) {
159
- this.initializers.movers.set(name, moverInitializer);
155
+ addPalette(name, palette) {
156
+ this.palettes.set(name, palette);
160
157
  }
161
158
  addParticleUpdater(name, updaterInitializer) {
162
159
  this.initializers.updaters.set(name, updaterInitializer);
163
160
  }
164
- addPathGenerator(name, generator) {
165
- this.initializers.pathGenerators.set(name, generator);
166
- }
167
161
  addPlugin(plugin) {
168
162
  if (this.getPlugin(plugin.id)) {
169
163
  return;
@@ -189,7 +183,6 @@ var __importStar = (this && this.__importStar) || (function () {
189
183
  }
190
184
  clearPlugins(container) {
191
185
  this.effectDrawers.delete(container);
192
- this.movers.delete(container);
193
186
  this.shapeDrawers.delete(container);
194
187
  this.updaters.delete(container);
195
188
  }
@@ -202,11 +195,8 @@ var __importStar = (this && this.__importStar) || (function () {
202
195
  getEffectDrawers(container, force = false) {
203
196
  return (0, Utils_js_1.getItemMapFromInitializer)(container, this.effectDrawers, this.initializers.effects, force);
204
197
  }
205
- getMovers(container, force = false) {
206
- return (0, Utils_js_1.getItemsFromInitializer)(container, this.movers, this.initializers.movers, force);
207
- }
208
- getPathGenerators(container, force = false) {
209
- return (0, Utils_js_1.getItemMapFromInitializer)(container, this.pathGenerators, this.initializers.pathGenerators, force);
198
+ getPalette(name) {
199
+ return this.palettes.get(name);
210
200
  }
211
201
  getPlugin(plugin) {
212
202
  return this.plugins.find(t => t.id === plugin);
@@ -4,7 +4,7 @@
4
4
  if (v !== undefined) module.exports = v;
5
5
  }
6
6
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "./Utils/Vectors.js", "../Utils/ColorUtils.js", "../Utils/MathUtils.js", "./Utils/Constants.js", "../Utils/Utils.js", "../Enums/Types/EventType.js", "../Enums/Directions/MoveDirection.js", "../Enums/Modes/OutMode.js", "../Enums/Types/ParticleOutType.js", "../Utils/OptionsUtils.js"], factory);
7
+ define(["require", "exports", "./Utils/Vectors.js", "../Utils/ColorUtils.js", "../Utils/MathUtils.js", "../Utils/Utils.js", "./Utils/Constants.js", "../Enums/Types/EventType.js", "../Enums/Directions/MoveDirection.js", "../Enums/Modes/OutMode.js", "../Enums/Types/ParticleOutType.js", "../Utils/OptionsUtils.js"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
@@ -13,8 +13,8 @@
13
13
  const Vectors_js_1 = require("./Utils/Vectors.js");
14
14
  const ColorUtils_js_1 = require("../Utils/ColorUtils.js");
15
15
  const MathUtils_js_1 = require("../Utils/MathUtils.js");
16
- const Constants_js_1 = require("./Utils/Constants.js");
17
16
  const Utils_js_1 = require("../Utils/Utils.js");
17
+ const Constants_js_1 = require("./Utils/Constants.js");
18
18
  const EventType_js_1 = require("../Enums/Types/EventType.js");
19
19
  const MoveDirection_js_1 = require("../Enums/Directions/MoveDirection.js");
20
20
  const OutMode_js_1 = require("../Enums/Modes/OutMode.js");
@@ -24,14 +24,12 @@
24
24
  const effectData = effectOptions.options[effect];
25
25
  return (0, Utils_js_1.deepExtend)({
26
26
  close: effectOptions.close,
27
- fill: effectOptions.fill,
28
27
  }, (0, Utils_js_1.itemFromSingleOrMultiple)(effectData, id, reduceDuplicates));
29
28
  }
30
29
  function loadShapeData(shape, shapeOptions, id, reduceDuplicates) {
31
30
  const shapeData = shapeOptions.options[shape];
32
31
  return (0, Utils_js_1.deepExtend)({
33
32
  close: shapeOptions.close,
34
- fill: shapeOptions.fill,
35
33
  }, (0, Utils_js_1.itemFromSingleOrMultiple)(shapeData, id, reduceDuplicates));
36
34
  }
37
35
  function fixOutMode(data) {
@@ -50,13 +48,14 @@
50
48
  container;
51
49
  backColor;
52
50
  bubble;
53
- color;
54
51
  destroyed;
55
52
  direction;
56
53
  effect;
57
54
  effectClose;
58
55
  effectData;
59
- effectFill;
56
+ fillColor;
57
+ fillEnabled;
58
+ fillOpacity;
60
59
  group;
61
60
  id;
62
61
  ignoresResizeRatio;
@@ -66,13 +65,10 @@
66
65
  lastPathTime;
67
66
  misplaced;
68
67
  moveCenter;
69
- moveDecay;
70
68
  offset;
71
69
  opacity;
72
70
  options;
73
71
  outType;
74
- pathDelay;
75
- pathGenerator;
76
72
  pathRotation;
77
73
  position;
78
74
  randomIndexData;
@@ -82,7 +78,6 @@
82
78
  shape;
83
79
  shapeClose;
84
80
  shapeData;
85
- shapeFill;
86
81
  sides;
87
82
  size;
88
83
  slow;
@@ -94,6 +89,7 @@
94
89
  velocity;
95
90
  zIndexFactor;
96
91
  _cachedOpacityData = {
92
+ fillOpacity: Constants_js_1.defaultOpacity,
97
93
  opacity: Constants_js_1.defaultOpacity,
98
94
  strokeOpacity: Constants_js_1.defaultOpacity,
99
95
  };
@@ -117,7 +113,7 @@
117
113
  this.destroyed = true;
118
114
  this.bubble.inRange = false;
119
115
  this.slow.inRange = false;
120
- const container = this.container, pathGenerator = this.pathGenerator, shapeDrawer = this.shape ? container.particles.shapeDrawers.get(this.shape) : undefined;
116
+ const container = this.container, shapeDrawer = this.shape ? container.particles.shapeDrawers.get(this.shape) : undefined;
121
117
  shapeDrawer?.particleDestroy?.(this);
122
118
  for (const plugin of container.particleDestroyedPlugins) {
123
119
  plugin.particleDestroyed?.(this, override);
@@ -125,7 +121,6 @@
125
121
  for (const updater of container.particles.updaters) {
126
122
  updater.particleDestroyed?.(this, override);
127
123
  }
128
- pathGenerator?.reset(this);
129
124
  this._engine.dispatchEvent(EventType_js_1.EventType.particleDestroyed, {
130
125
  container: this.container,
131
126
  data: {
@@ -142,15 +137,16 @@
142
137
  return this.rotation + (this.pathRotation ? this.velocity.angle : Constants_js_1.defaultAngle);
143
138
  }
144
139
  getFillColor() {
145
- return this._getRollColor(this.bubble.color ?? (0, ColorUtils_js_1.getHslFromAnimation)(this.color));
140
+ return this._getRollColor(this.bubble.color ?? (0, ColorUtils_js_1.getHslFromAnimation)(this.fillColor));
146
141
  }
147
142
  getMass() {
148
143
  return this.getRadius() ** Constants_js_1.squareExp * Math.PI * Constants_js_1.half;
149
144
  }
150
145
  getOpacity() {
151
- const zIndexOptions = this.options.zIndex, zIndexFactor = Constants_js_1.zIndexFactorOffset - this.zIndexFactor, zOpacityFactor = zIndexFactor ** zIndexOptions.opacityRate, opacity = this.bubble.opacity ?? (0, MathUtils_js_1.getRangeValue)(this.opacity?.value ?? Constants_js_1.defaultOpacity), strokeOpacity = this.strokeOpacity ?? opacity;
146
+ const zIndexOptions = this.options.zIndex, zIndexFactor = Constants_js_1.zIndexFactorOffset - this.zIndexFactor, zOpacityFactor = zIndexFactor ** zIndexOptions.opacityRate, opacity = this.bubble.opacity ?? (0, MathUtils_js_1.getRangeValue)(this.opacity?.value ?? Constants_js_1.defaultOpacity), fillOpacity = this.fillOpacity ?? Constants_js_1.defaultOpacity, strokeOpacity = this.strokeOpacity ?? Constants_js_1.defaultOpacity;
147
+ this._cachedOpacityData.fillOpacity = opacity * fillOpacity * zOpacityFactor;
152
148
  this._cachedOpacityData.opacity = opacity * zOpacityFactor;
153
- this._cachedOpacityData.strokeOpacity = strokeOpacity * zOpacityFactor;
149
+ this._cachedOpacityData.strokeOpacity = opacity * strokeOpacity * zOpacityFactor;
154
150
  return this._cachedOpacityData;
155
151
  }
156
152
  getPosition() {
@@ -188,9 +184,7 @@
188
184
  this.id = id;
189
185
  this.group = group;
190
186
  this.effectClose = true;
191
- this.effectFill = true;
192
187
  this.shapeClose = true;
193
- this.shapeFill = true;
194
188
  this.pathRotation = false;
195
189
  this.lastPathTime = 0;
196
190
  this.destroyed = false;
@@ -242,24 +236,9 @@
242
236
  if (shapeData) {
243
237
  particlesOptions.load(shapeData.particles);
244
238
  }
245
- this.effectFill = effectData?.fill ?? particlesOptions.effect.fill;
246
239
  this.effectClose = effectData?.close ?? particlesOptions.effect.close;
247
- this.shapeFill = shapeData?.fill ?? particlesOptions.shape.fill;
248
240
  this.shapeClose = shapeData?.close ?? particlesOptions.shape.close;
249
241
  this.options = particlesOptions;
250
- const pathOptions = this.options.move.path;
251
- this.pathDelay = (0, MathUtils_js_1.getRangeValue)(pathOptions.delay.value) * Constants_js_1.millisecondsToSeconds;
252
- if (pathOptions.generator) {
253
- let pathGenerator = this.container.particles.pathGenerators.get(pathOptions.generator);
254
- if (!pathGenerator) {
255
- pathGenerator = this.container.particles.availablePathGenerators.get(pathOptions.generator);
256
- if (pathGenerator) {
257
- this.container.particles.pathGenerators.set(pathOptions.generator, pathGenerator);
258
- pathGenerator.init();
259
- }
260
- }
261
- this.pathGenerator = pathGenerator;
262
- }
263
242
  container.retina.initParticle(this);
264
243
  this.size = (0, Utils_js_1.initParticleNumericAnimationValue)(this.options.size, pxRatio);
265
244
  this.bubble = {
@@ -272,7 +251,6 @@
272
251
  this._initPosition(position);
273
252
  this.initialVelocity = this._calculateVelocity();
274
253
  this.velocity = this.initialVelocity.copy();
275
- this.moveDecay = Constants_js_1.decayOffset - (0, MathUtils_js_1.getRangeValue)(this.options.move.decay);
276
254
  const particles = container.particles;
277
255
  particles.setLastZIndex(this.position.z);
278
256
  this.zIndexFactor = this.position.z / container.zLayers;
@@ -298,9 +276,6 @@
298
276
  for (const updater of particles.updaters) {
299
277
  updater.init(this);
300
278
  }
301
- for (const mover of particles.movers) {
302
- mover.init(this);
303
- }
304
279
  effectDrawer?.particleInit?.(container, this);
305
280
  shapeDrawer?.particleInit?.(container, this);
306
281
  for (const plugin of container.particleCreatedPlugins) {
@@ -18,12 +18,9 @@
18
18
  const LogUtils_js_1 = require("../Utils/LogUtils.js");
19
19
  const OptionsUtils_js_1 = require("../Utils/OptionsUtils.js");
20
20
  class Particles {
21
- availablePathGenerators;
22
21
  checkParticlePositionPlugins;
23
22
  effectDrawers;
24
23
  grid;
25
- movers;
26
- pathGenerators;
27
24
  shapeDrawers;
28
25
  updaters;
29
26
  _array;
@@ -57,9 +54,6 @@
57
54
  this._maxZIndex = 0;
58
55
  this.grid = new SpatialHashGrid_js_1.SpatialHashGrid(Constants_js_1.spatialHashGridCellSize);
59
56
  this.effectDrawers = new Map();
60
- this.movers = [];
61
- this.availablePathGenerators = new Map();
62
- this.pathGenerators = new Map();
63
57
  this.shapeDrawers = new Map();
64
58
  this.updaters = [];
65
59
  this.checkParticlePositionPlugins = [];
@@ -135,9 +129,6 @@
135
129
  this._pool.length = 0;
136
130
  this._zArray = [];
137
131
  this.effectDrawers = new Map();
138
- this.movers = [];
139
- this.availablePathGenerators = new Map();
140
- this.pathGenerators = new Map();
141
132
  this.shapeDrawers = new Map();
142
133
  this.updaters = [];
143
134
  this.checkParticlePositionPlugins = [];
@@ -229,14 +220,8 @@
229
220
  async initPlugins() {
230
221
  const container = this._container;
231
222
  this.effectDrawers = await this._engine.getEffectDrawers(container, true);
232
- this.movers = await this._engine.getMovers(container, true);
233
- this.availablePathGenerators = await this._engine.getPathGenerators(container, true);
234
- this.pathGenerators = new Map();
235
223
  this.shapeDrawers = await this._engine.getShapeDrawers(container, true);
236
224
  this.updaters = await this._engine.getUpdaters(container, true);
237
- for (const pathGenerator of this.pathGenerators.values()) {
238
- pathGenerator.init();
239
- }
240
225
  }
241
226
  push(nb, position, overrideOptions, group) {
242
227
  for (let i = 0; i < nb; i++) {
@@ -293,9 +278,6 @@
293
278
  update(delta) {
294
279
  const particlesToDelete = new Set();
295
280
  this.grid.clear();
296
- for (const pathGenerator of this.pathGenerators.values()) {
297
- pathGenerator.update();
298
- }
299
281
  for (const plugin of this._updatePlugins) {
300
282
  plugin.update?.(delta);
301
283
  }
@@ -317,11 +299,6 @@
317
299
  }
318
300
  plugin.particleUpdate?.(particle, delta);
319
301
  }
320
- for (const mover of this.movers) {
321
- if (mover.isEnabled(particle)) {
322
- mover.move(particle, delta);
323
- }
324
- }
325
302
  if (particle.destroyed) {
326
303
  particlesToDelete.add(particle);
327
304
  continue;
@@ -9,8 +9,8 @@
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.defaultZoom = exports.defaultTime = exports.defaultLoops = exports.defaultVelocity = exports.defaultRgbMin = exports.phaseNumerator = exports.sNormalizedOffset = exports.sextuple = exports.triple = exports.lMin = exports.lFactor = exports.minStrokeWidth = exports.identity = exports.defaultAngle = exports.manualDefaultPosition = exports.touchDelay = exports.deleteCount = exports.defaultDensityFactor = exports.lengthOffset = exports.minIndex = exports.minCount = exports.countOffset = exports.minLimit = exports.sizeFactor = exports.posOffset = exports.defaultRadius = exports.minZ = exports.minRetries = exports.tryCountIncrement = exports.decayOffset = exports.none = exports.one = exports.loadMinIndex = exports.loadRandomFactor = exports.canvasFirstIndex = exports.minFpsLimit = exports.defaultFpsLimit = exports.removeMinIndex = exports.removeDeleteCount = exports.minCoordinate = exports.touchEndLengthOffset = exports.clickRadius = exports.defaultOpacity = exports.zIndexFactorOffset = exports.minimumLength = exports.minimumSize = exports.defaultTransformValue = exports.minVelocity = exports.threeQuarter = exports.quarter = exports.empty = exports.hPhase = exports.sMin = exports.hMin = exports.lMax = exports.sMax = exports.hMax = exports.rgbMax = exports.inverseFactorNumerator = exports.subdivideCount = exports.defaultReduceFactor = exports.defaultRatio = exports.defaultRemoveQuantity = exports.spatialHashGridCellSize = exports.qTreeCapacity = exports.squareExp = exports.defaultRetryCount = exports.canvasTag = exports.generatedFalse = exports.generatedTrue = exports.defaultAlpha = exports.defaultFps = exports.doublePI = exports.double = exports.midColorValue = exports.randomColorValue = exports.defaultTransform = exports.originPoint = exports.millisecondsToSeconds = exports.half = exports.percentDenominator = exports.visibilityChangeEvent = exports.resizeEvent = exports.generatedAttribute = void 0;
13
- exports.generatedAttribute = "generated", exports.resizeEvent = "resize", exports.visibilityChangeEvent = "visibilitychange", exports.percentDenominator = 100, exports.half = 0.5, exports.millisecondsToSeconds = 1000, exports.originPoint = {
12
+ exports.defaultZoom = exports.defaultTime = exports.defaultLoops = exports.defaultVelocity = exports.defaultRgbMin = exports.phaseNumerator = exports.sNormalizedOffset = exports.sextuple = exports.triple = exports.lMin = exports.lFactor = exports.minStrokeWidth = exports.identity = exports.defaultAngle = exports.manualDefaultPosition = exports.touchDelay = exports.deleteCount = exports.defaultDensityFactor = exports.lengthOffset = exports.minIndex = exports.minCount = exports.countOffset = exports.minLimit = exports.sizeFactor = exports.posOffset = exports.defaultRadius = exports.minZ = exports.minRetries = exports.tryCountIncrement = exports.decayOffset = exports.none = exports.one = exports.loadMinIndex = exports.loadRandomFactor = exports.canvasFirstIndex = exports.minFpsLimit = exports.defaultFpsLimit = exports.removeMinIndex = exports.removeDeleteCount = exports.minCoordinate = exports.touchEndLengthOffset = exports.clickRadius = exports.defaultOpacity = exports.zIndexFactorOffset = exports.minimumLength = exports.minimumSize = exports.defaultTransformValue = exports.minVelocity = exports.threeQuarter = exports.quarter = exports.empty = exports.hPhase = exports.sMin = exports.hMin = exports.lMax = exports.sMax = exports.hMax = exports.rgbMax = exports.inverseFactorNumerator = exports.subdivideCount = exports.defaultReduceFactor = exports.defaultRatio = exports.defaultRemoveQuantity = exports.spatialHashGridCellSize = exports.qTreeCapacity = exports.squareExp = exports.defaultRetryCount = exports.canvasTag = exports.generatedFalse = exports.generatedTrue = exports.defaultAlpha = exports.defaultFps = exports.doublePI = exports.double = exports.midColorValue = exports.randomColorValue = exports.defaultTransform = exports.originPoint = exports.millisecondsToSeconds = exports.half = exports.percentDenominator = exports.visibilityChangeEvent = exports.resizeEvent = exports.defaultCompositeValue = exports.generatedAttribute = void 0;
13
+ exports.generatedAttribute = "generated", exports.defaultCompositeValue = "source-over", exports.resizeEvent = "resize", exports.visibilityChangeEvent = "visibilitychange", exports.percentDenominator = 100, exports.half = 0.5, exports.millisecondsToSeconds = 1000, exports.originPoint = {
14
14
  x: 0,
15
15
  y: 0,
16
16
  z: 0,
@@ -32,7 +32,7 @@
32
32
  this.radius = radius;
33
33
  }
34
34
  contains(point) {
35
- return (0, MathUtils_js_1.getDistance)(point, this.position) <= this.radius;
35
+ return (0, MathUtils_js_1.checkDistance)(point, this.position, this.radius);
36
36
  }
37
37
  intersects(range) {
38
38
  const pos1 = this.position, pos2 = range.position, distPos = { x: Math.abs(pos2.x - pos1.x), y: Math.abs(pos2.y - pos1.y) }, r = this.radius;
@@ -11,6 +11,9 @@
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.Vector = exports.Vector3d = void 0;
13
13
  const Constants_js_1 = require("./Constants.js");
14
+ function getZ(source) {
15
+ return "z" in source ? source.z : Constants_js_1.originPoint.z;
16
+ }
14
17
  class Vector3d {
15
18
  x;
16
19
  y;
@@ -36,21 +39,21 @@
36
39
  this._updateFromAngle(this.angle, length);
37
40
  }
38
41
  static clone(source) {
39
- return Vector3d.create(source.x, source.y, source.z);
42
+ return Vector3d.create(source.x, source.y, getZ(source));
40
43
  }
41
44
  static create(x, y, z) {
42
45
  if (typeof x === "number") {
43
46
  return new Vector3d(x, y ?? Constants_js_1.originPoint.y, z ?? Constants_js_1.originPoint.z);
44
47
  }
45
- return new Vector3d(x.x, x.y, Object.hasOwn(x, "z") ? x.z : Constants_js_1.originPoint.z);
48
+ return new Vector3d(x.x, x.y, getZ(x));
46
49
  }
47
50
  add(v) {
48
- return Vector3d.create(this.x + v.x, this.y + v.y, this.z + v.z);
51
+ return Vector3d.create(this.x + v.x, this.y + v.y, this.z + getZ(v));
49
52
  }
50
53
  addTo(v) {
51
54
  this.x += v.x;
52
55
  this.y += v.y;
53
- this.z += v.z;
56
+ this.z += getZ(v);
54
57
  }
55
58
  copy() {
56
59
  return Vector3d.clone(this);
@@ -86,15 +89,15 @@
86
89
  setTo(c) {
87
90
  this.x = c.x;
88
91
  this.y = c.y;
89
- this.z = "z" in c ? c.z : Constants_js_1.originPoint.z;
92
+ this.z = getZ(c);
90
93
  }
91
94
  sub(v) {
92
- return Vector3d.create(this.x - v.x, this.y - v.y, this.z - v.z);
95
+ return Vector3d.create(this.x - v.x, this.y - v.y, this.z - getZ(v));
93
96
  }
94
97
  subFrom(v) {
95
98
  this.x -= v.x;
96
99
  this.y -= v.y;
97
- this.z -= v.z;
100
+ this.z -= getZ(v);
98
101
  }
99
102
  _updateFromAngle(angle, length) {
100
103
  this.x = Math.cos(angle) * length;
@@ -14,9 +14,13 @@
14
14
  const TypeUtils_js_1 = require("../../Utils/TypeUtils.js");
15
15
  const MathUtils_js_1 = require("../../Utils/MathUtils.js");
16
16
  class ColorAnimation extends AnimationOptions_js_1.AnimationOptions {
17
+ max;
18
+ min;
17
19
  offset;
18
- constructor() {
20
+ constructor(min, max) {
19
21
  super();
22
+ this.min = min;
23
+ this.max = max;
20
24
  this.offset = 0;
21
25
  this.sync = true;
22
26
  }
@@ -25,6 +29,12 @@
25
29
  if ((0, TypeUtils_js_1.isNull)(data)) {
26
30
  return;
27
31
  }
32
+ if (data.max !== undefined) {
33
+ this.max = data.max;
34
+ }
35
+ if (data.min !== undefined) {
36
+ this.min = data.min;
37
+ }
28
38
  if (data.offset !== undefined) {
29
39
  this.offset = (0, MathUtils_js_1.setRangeValue)(data.offset);
30
40
  }