@tsparticles/engine 4.0.0-alpha.8 → 4.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/164.min.js +1 -0
- package/README.md +41 -7
- package/browser/Core/Canvas.js +238 -137
- package/browser/Core/Container.js +80 -74
- package/browser/Core/Engine.js +43 -64
- package/browser/Core/Particle.js +182 -169
- package/browser/Core/Particles.js +187 -138
- package/browser/Core/Retina.js +5 -0
- package/browser/Core/Utils/Constants.js +2 -2
- package/browser/Core/Utils/EventListeners.js +67 -63
- package/browser/Core/Utils/Ranges.js +29 -10
- package/browser/Core/Utils/SpatialHashGrid.js +102 -0
- package/browser/Core/Utils/Vectors.js +17 -18
- package/browser/Options/Classes/AnimatableColor.js +1 -0
- package/browser/Options/Classes/AnimationOptions.js +8 -0
- package/browser/Options/Classes/Background/Background.js +6 -0
- package/browser/Options/Classes/ColorAnimation.js +12 -1
- package/browser/Options/Classes/FullScreen/FullScreen.js +2 -0
- package/browser/Options/Classes/HslAnimation.js +4 -5
- package/browser/Options/Classes/Options.js +63 -4
- package/browser/Options/Classes/OptionsColor.js +1 -0
- package/browser/Options/Classes/Particles/Bounce/ParticlesBounce.js +2 -0
- package/browser/Options/Classes/Particles/Effect/Effect.js +3 -4
- package/browser/Options/Classes/Particles/Fill.js +28 -0
- package/browser/Options/Classes/Particles/Move/Move.js +17 -3
- package/browser/Options/Classes/Particles/Move/MoveAngle.js +2 -0
- package/browser/Options/Classes/Particles/Move/MoveCenter.js +4 -0
- package/browser/Options/Classes/Particles/Move/MoveGravity.js +4 -0
- package/browser/Options/Classes/Particles/Move/OutModes.js +5 -0
- package/browser/Options/Classes/Particles/Move/Path/MovePath.js +5 -0
- package/browser/Options/Classes/Particles/Move/Spin.js +3 -0
- package/browser/Options/Classes/Particles/Number/ParticlesDensity.js +3 -0
- package/browser/Options/Classes/Particles/Number/ParticlesNumber.js +3 -0
- package/browser/Options/Classes/Particles/Number/ParticlesNumberLimit.js +2 -0
- package/browser/Options/Classes/Particles/Opacity/Opacity.js +1 -0
- package/browser/Options/Classes/Particles/Opacity/OpacityAnimation.js +1 -0
- package/browser/Options/Classes/Particles/ParticlesOptions.js +25 -5
- package/browser/Options/Classes/Particles/Shape/Shape.js +3 -4
- package/browser/Options/Classes/Particles/Size/Size.js +1 -0
- package/browser/Options/Classes/Particles/Size/SizeAnimation.js +1 -0
- package/browser/Options/Classes/Particles/Stroke.js +3 -0
- package/browser/Options/Classes/Particles/ZIndex/ZIndex.js +3 -0
- package/browser/Options/Classes/ResizeEvent.js +2 -0
- package/browser/Options/Classes/ValueWithRandom.js +3 -4
- package/browser/Utils/CanvasUtils.js +44 -51
- package/browser/Utils/ColorUtils.js +30 -19
- package/browser/Utils/EventDispatcher.js +1 -0
- package/browser/Utils/MathUtils.js +12 -7
- package/browser/Utils/Utils.js +109 -31
- package/browser/exports.js +1 -2
- package/cjs/Core/Canvas.js +238 -137
- package/cjs/Core/Container.js +80 -74
- package/cjs/Core/Engine.js +43 -64
- package/cjs/Core/Particle.js +182 -169
- package/cjs/Core/Particles.js +187 -138
- package/cjs/Core/Retina.js +5 -0
- package/cjs/Core/Utils/Constants.js +2 -2
- package/cjs/Core/Utils/EventListeners.js +67 -63
- package/cjs/Core/Utils/Ranges.js +29 -10
- package/cjs/Core/Utils/SpatialHashGrid.js +102 -0
- package/cjs/Core/Utils/Vectors.js +17 -18
- package/cjs/Options/Classes/AnimatableColor.js +1 -0
- package/cjs/Options/Classes/AnimationOptions.js +8 -0
- package/cjs/Options/Classes/Background/Background.js +6 -0
- package/cjs/Options/Classes/ColorAnimation.js +12 -1
- package/cjs/Options/Classes/FullScreen/FullScreen.js +2 -0
- package/cjs/Options/Classes/HslAnimation.js +4 -5
- package/cjs/Options/Classes/Options.js +63 -4
- package/cjs/Options/Classes/OptionsColor.js +1 -0
- package/cjs/Options/Classes/Particles/Bounce/ParticlesBounce.js +2 -0
- package/cjs/Options/Classes/Particles/Effect/Effect.js +3 -4
- package/cjs/Options/Classes/Particles/Fill.js +28 -0
- package/cjs/Options/Classes/Particles/Move/Move.js +17 -3
- package/cjs/Options/Classes/Particles/Move/MoveAngle.js +2 -0
- package/cjs/Options/Classes/Particles/Move/MoveCenter.js +4 -0
- package/cjs/Options/Classes/Particles/Move/MoveGravity.js +4 -0
- package/cjs/Options/Classes/Particles/Move/OutModes.js +5 -0
- package/cjs/Options/Classes/Particles/Move/Path/MovePath.js +5 -0
- package/cjs/Options/Classes/Particles/Move/Spin.js +3 -0
- package/cjs/Options/Classes/Particles/Number/ParticlesDensity.js +3 -0
- package/cjs/Options/Classes/Particles/Number/ParticlesNumber.js +3 -0
- package/cjs/Options/Classes/Particles/Number/ParticlesNumberLimit.js +2 -0
- package/cjs/Options/Classes/Particles/Opacity/Opacity.js +1 -0
- package/cjs/Options/Classes/Particles/Opacity/OpacityAnimation.js +1 -0
- package/cjs/Options/Classes/Particles/ParticlesOptions.js +25 -5
- package/cjs/Options/Classes/Particles/Shape/Shape.js +3 -4
- package/cjs/Options/Classes/Particles/Size/Size.js +1 -0
- package/cjs/Options/Classes/Particles/Size/SizeAnimation.js +1 -0
- package/cjs/Options/Classes/Particles/Stroke.js +3 -0
- package/cjs/Options/Classes/Particles/ZIndex/ZIndex.js +3 -0
- package/cjs/Options/Classes/ResizeEvent.js +2 -0
- package/cjs/Options/Classes/ValueWithRandom.js +3 -4
- package/cjs/Utils/CanvasUtils.js +44 -51
- package/cjs/Utils/ColorUtils.js +30 -19
- package/cjs/Utils/EventDispatcher.js +1 -0
- package/cjs/Utils/MathUtils.js +12 -7
- package/cjs/Utils/Utils.js +109 -31
- package/cjs/exports.js +1 -2
- package/dist_browser_Core_Container_js.js +12 -12
- package/esm/Core/Canvas.js +238 -137
- package/esm/Core/Container.js +80 -74
- package/esm/Core/Engine.js +43 -64
- package/esm/Core/Particle.js +182 -169
- package/esm/Core/Particles.js +187 -138
- package/esm/Core/Retina.js +5 -0
- package/esm/Core/Utils/Constants.js +2 -2
- package/esm/Core/Utils/EventListeners.js +67 -63
- package/esm/Core/Utils/Ranges.js +29 -10
- package/esm/Core/Utils/SpatialHashGrid.js +102 -0
- package/esm/Core/Utils/Vectors.js +17 -18
- package/esm/Options/Classes/AnimatableColor.js +1 -0
- package/esm/Options/Classes/AnimationOptions.js +8 -0
- package/esm/Options/Classes/Background/Background.js +6 -0
- package/esm/Options/Classes/ColorAnimation.js +12 -1
- package/esm/Options/Classes/FullScreen/FullScreen.js +2 -0
- package/esm/Options/Classes/HslAnimation.js +4 -5
- package/esm/Options/Classes/Options.js +63 -4
- package/esm/Options/Classes/OptionsColor.js +1 -0
- package/esm/Options/Classes/Particles/Bounce/ParticlesBounce.js +2 -0
- package/esm/Options/Classes/Particles/Effect/Effect.js +3 -4
- package/esm/Options/Classes/Particles/Fill.js +28 -0
- package/esm/Options/Classes/Particles/Move/Move.js +17 -3
- package/esm/Options/Classes/Particles/Move/MoveAngle.js +2 -0
- package/esm/Options/Classes/Particles/Move/MoveCenter.js +4 -0
- package/esm/Options/Classes/Particles/Move/MoveGravity.js +4 -0
- package/esm/Options/Classes/Particles/Move/OutModes.js +5 -0
- package/esm/Options/Classes/Particles/Move/Path/MovePath.js +5 -0
- package/esm/Options/Classes/Particles/Move/Spin.js +3 -0
- package/esm/Options/Classes/Particles/Number/ParticlesDensity.js +3 -0
- package/esm/Options/Classes/Particles/Number/ParticlesNumber.js +3 -0
- package/esm/Options/Classes/Particles/Number/ParticlesNumberLimit.js +2 -0
- package/esm/Options/Classes/Particles/Opacity/Opacity.js +1 -0
- package/esm/Options/Classes/Particles/Opacity/OpacityAnimation.js +1 -0
- package/esm/Options/Classes/Particles/ParticlesOptions.js +25 -5
- package/esm/Options/Classes/Particles/Shape/Shape.js +3 -4
- package/esm/Options/Classes/Particles/Size/Size.js +1 -0
- package/esm/Options/Classes/Particles/Size/SizeAnimation.js +1 -0
- package/esm/Options/Classes/Particles/Stroke.js +3 -0
- package/esm/Options/Classes/Particles/ZIndex/ZIndex.js +3 -0
- package/esm/Options/Classes/ResizeEvent.js +2 -0
- package/esm/Options/Classes/ValueWithRandom.js +3 -4
- package/esm/Utils/CanvasUtils.js +44 -51
- package/esm/Utils/ColorUtils.js +30 -19
- package/esm/Utils/EventDispatcher.js +1 -0
- package/esm/Utils/MathUtils.js +12 -7
- package/esm/Utils/Utils.js +109 -31
- package/esm/exports.js +1 -2
- package/package.json +1 -1
- package/report.html +1 -1
- package/scripts/install.js +4 -20
- package/tsparticles.engine.js +93 -91
- package/tsparticles.engine.min.js +2 -2
- package/types/Core/Canvas.d.ts +17 -2
- package/types/Core/Container.d.ts +3 -7
- package/types/Core/Engine.d.ts +13 -20
- package/types/Core/Interfaces/IColorManager.d.ts +0 -1
- package/types/Core/Interfaces/IContainerPlugin.d.ts +2 -1
- package/types/Core/Interfaces/IPalette.d.ts +7 -0
- package/types/Core/Interfaces/IParticleOpacityData.d.ts +1 -0
- package/types/Core/Interfaces/IParticleValueAnimation.d.ts +3 -3
- package/types/Core/Interfaces/IShapeDrawData.d.ts +8 -0
- package/types/Core/Interfaces/IShapeDrawer.d.ts +0 -1
- package/types/Core/Interfaces/IShapeValues.d.ts +0 -1
- package/types/Core/Particle.d.ts +3 -7
- package/types/Core/Particles.d.ts +15 -7
- package/types/Core/Utils/Constants.d.ts +2 -2
- package/types/Core/Utils/Ranges.d.ts +4 -1
- package/types/Core/Utils/SpatialHashGrid.d.ts +25 -0
- package/types/Core/Utils/Vectors.d.ts +8 -10
- package/types/Options/Classes/ColorAnimation.d.ts +3 -1
- package/types/Options/Classes/HslAnimation.d.ts +3 -4
- package/types/Options/Classes/Options.d.ts +2 -0
- package/types/Options/Classes/Particles/Effect/Effect.d.ts +0 -1
- package/types/Options/Classes/Particles/Fill.d.ts +12 -0
- package/types/Options/Classes/Particles/Move/Move.d.ts +0 -2
- package/types/Options/Classes/Particles/ParticlesOptions.d.ts +2 -2
- package/types/Options/Classes/Particles/Shape/Shape.d.ts +0 -1
- package/types/Options/Classes/ValueWithRandom.d.ts +0 -1
- package/types/Options/Interfaces/IColorAnimation.d.ts +2 -0
- package/types/Options/Interfaces/IOptions.d.ts +1 -0
- package/types/Options/Interfaces/Particles/Effect/IEffect.d.ts +0 -1
- package/types/Options/Interfaces/Particles/IFill.d.ts +9 -0
- package/types/Options/Interfaces/Particles/IParticlesOptions.d.ts +2 -2
- package/types/Options/Interfaces/Particles/IStroke.d.ts +2 -2
- package/types/Options/Interfaces/Particles/Move/IMove.d.ts +0 -2
- package/types/Options/Interfaces/Particles/Shape/IShape.d.ts +0 -1
- package/types/Types/EngineInitializers.d.ts +6 -3
- package/types/Utils/CanvasUtils.d.ts +6 -12
- package/types/Utils/ColorUtils.d.ts +3 -2
- package/types/Utils/MathUtils.d.ts +2 -0
- package/types/Utils/Utils.d.ts +8 -1
- package/types/export-types.d.ts +3 -5
- package/types/exports.d.ts +1 -2
- package/umd/Core/Canvas.js +237 -136
- package/umd/Core/Container.js +80 -74
- package/umd/Core/Engine.js +42 -63
- package/umd/Core/Particle.js +183 -170
- package/umd/Core/Particles.js +187 -138
- package/umd/Core/Retina.js +5 -0
- package/umd/Core/Utils/Constants.js +3 -3
- package/umd/Core/Utils/EventListeners.js +67 -63
- package/umd/Core/Utils/Ranges.js +28 -9
- package/umd/Core/Utils/SpatialHashGrid.js +116 -0
- package/umd/Core/Utils/Vectors.js +17 -18
- package/umd/Options/Classes/AnimatableColor.js +1 -0
- package/umd/Options/Classes/AnimationOptions.js +8 -0
- package/umd/Options/Classes/Background/Background.js +6 -0
- package/umd/Options/Classes/ColorAnimation.js +12 -1
- package/umd/Options/Classes/FullScreen/FullScreen.js +2 -0
- package/umd/Options/Classes/HslAnimation.js +5 -6
- package/umd/Options/Classes/Options.js +63 -4
- package/umd/Options/Classes/OptionsColor.js +1 -0
- package/umd/Options/Classes/Particles/Bounce/ParticlesBounce.js +2 -0
- package/umd/Options/Classes/Particles/Effect/Effect.js +3 -4
- package/umd/Options/Classes/Particles/Fill.js +42 -0
- package/umd/Options/Classes/Particles/Move/Move.js +18 -4
- package/umd/Options/Classes/Particles/Move/MoveAngle.js +2 -0
- package/umd/Options/Classes/Particles/Move/MoveCenter.js +4 -0
- package/umd/Options/Classes/Particles/Move/MoveGravity.js +4 -0
- package/umd/Options/Classes/Particles/Move/OutModes.js +5 -0
- package/umd/Options/Classes/Particles/Move/Path/MovePath.js +5 -0
- package/umd/Options/Classes/Particles/Move/Spin.js +3 -0
- package/umd/Options/Classes/Particles/Number/ParticlesDensity.js +3 -0
- package/umd/Options/Classes/Particles/Number/ParticlesNumber.js +3 -0
- package/umd/Options/Classes/Particles/Number/ParticlesNumberLimit.js +2 -0
- package/umd/Options/Classes/Particles/Opacity/Opacity.js +1 -0
- package/umd/Options/Classes/Particles/Opacity/OpacityAnimation.js +1 -0
- package/umd/Options/Classes/Particles/ParticlesOptions.js +26 -6
- package/umd/Options/Classes/Particles/Shape/Shape.js +3 -4
- package/umd/Options/Classes/Particles/Size/Size.js +1 -0
- package/umd/Options/Classes/Particles/Size/SizeAnimation.js +1 -0
- package/umd/Options/Classes/Particles/Stroke.js +3 -0
- package/umd/Options/Classes/Particles/ZIndex/ZIndex.js +3 -0
- package/umd/Options/Classes/ResizeEvent.js +2 -0
- package/umd/Options/Classes/ValueWithRandom.js +3 -4
- package/umd/Utils/CanvasUtils.js +44 -53
- package/umd/Utils/ColorUtils.js +30 -18
- package/umd/Utils/EventDispatcher.js +1 -0
- package/umd/Utils/MathUtils.js +14 -7
- package/umd/Utils/Utils.js +111 -32
- package/umd/exports.js +2 -3
- package/794.min.js +0 -2
- package/794.min.js.LICENSE.txt +0 -1
- package/browser/Core/Utils/Point.js +0 -6
- package/browser/Core/Utils/QuadTree.js +0 -59
- package/browser/Options/Classes/Particles/Move/MoveAttract.js +0 -33
- package/cjs/Core/Utils/Point.js +0 -6
- package/cjs/Core/Utils/QuadTree.js +0 -59
- package/cjs/Options/Classes/Particles/Move/MoveAttract.js +0 -33
- package/esm/Core/Interfaces/IMovePathGenerator.js +0 -1
- package/esm/Core/Interfaces/IParticleMover.js +0 -1
- package/esm/Core/Utils/Point.js +0 -6
- package/esm/Core/Utils/QuadTree.js +0 -59
- package/esm/Options/Classes/Particles/Move/MoveAttract.js +0 -33
- package/esm/Options/Interfaces/Particles/Move/IMoveAttract.js +0 -1
- package/tsparticles.engine.min.js.LICENSE.txt +0 -1
- package/types/Core/Interfaces/IMovePathGenerator.d.ts +0 -10
- package/types/Core/Interfaces/IParticleMover.d.ts +0 -7
- package/types/Core/Utils/Point.d.ts +0 -7
- package/types/Core/Utils/QuadTree.d.ts +0 -18
- package/types/Options/Classes/Particles/Move/MoveAttract.d.ts +0 -12
- package/types/Options/Interfaces/Particles/Move/IMoveAttract.d.ts +0 -7
- package/umd/Core/Utils/Point.js +0 -20
- package/umd/Core/Utils/QuadTree.js +0 -73
- package/umd/Options/Classes/Particles/Move/MoveAttract.js +0 -47
- package/umd/Options/Interfaces/Particles/Move/IMoveAttract.js +0 -12
- /package/browser/Core/Interfaces/{IMovePathGenerator.js → IPalette.js} +0 -0
- /package/browser/{Core/Interfaces/IParticleMover.js → Options/Interfaces/Particles/IFill.js} +0 -0
- /package/{browser/Options/Interfaces/Particles/Move/IMoveAttract.js → cjs/Core/Interfaces/IPalette.js} +0 -0
- /package/cjs/{Core/Interfaces/IMovePathGenerator.js → Options/Interfaces/Particles/IFill.js} +0 -0
- /package/{cjs/Core/Interfaces/IParticleMover.js → esm/Core/Interfaces/IPalette.js} +0 -0
- /package/{cjs/Options/Interfaces/Particles/Move/IMoveAttract.js → esm/Options/Interfaces/Particles/IFill.js} +0 -0
- /package/umd/Core/Interfaces/{IMovePathGenerator.js → IPalette.js} +0 -0
- /package/umd/{Core/Interfaces/IParticleMover.js → Options/Interfaces/Particles/IFill.js} +0 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { Circle, Rectangle } from "./Ranges.js";
|
|
2
|
+
export class SpatialHashGrid {
|
|
3
|
+
_cellSize;
|
|
4
|
+
_cells = new Map();
|
|
5
|
+
_circlePool = [];
|
|
6
|
+
_circlePoolIdx;
|
|
7
|
+
_pendingCellSize;
|
|
8
|
+
_rectanglePool = [];
|
|
9
|
+
_rectanglePoolIdx;
|
|
10
|
+
constructor(cellSize) {
|
|
11
|
+
this._cellSize = cellSize;
|
|
12
|
+
this._circlePoolIdx = 0;
|
|
13
|
+
this._rectanglePoolIdx = 0;
|
|
14
|
+
}
|
|
15
|
+
clear() {
|
|
16
|
+
this._cells.clear();
|
|
17
|
+
const pendingCellSize = this._pendingCellSize;
|
|
18
|
+
if (pendingCellSize) {
|
|
19
|
+
this._cellSize = pendingCellSize;
|
|
20
|
+
}
|
|
21
|
+
this._pendingCellSize = undefined;
|
|
22
|
+
}
|
|
23
|
+
insert(particle) {
|
|
24
|
+
const { x, y } = particle.getPosition(), key = this._cellKeyFromCoords(x, y);
|
|
25
|
+
if (!this._cells.has(key)) {
|
|
26
|
+
this._cells.set(key, []);
|
|
27
|
+
}
|
|
28
|
+
this._cells.get(key)?.push(particle);
|
|
29
|
+
}
|
|
30
|
+
query(range, check, out = []) {
|
|
31
|
+
const bounds = this._getRangeBounds(range);
|
|
32
|
+
if (!bounds) {
|
|
33
|
+
return out;
|
|
34
|
+
}
|
|
35
|
+
const minCellX = Math.floor(bounds.minX / this._cellSize), maxCellX = Math.floor(bounds.maxX / this._cellSize), minCellY = Math.floor(bounds.minY / this._cellSize), maxCellY = Math.floor(bounds.maxY / this._cellSize);
|
|
36
|
+
for (let cx = minCellX; cx <= maxCellX; cx++) {
|
|
37
|
+
for (let cy = minCellY; cy <= maxCellY; cy++) {
|
|
38
|
+
const key = `${cx}_${cy}`, cellParticles = this._cells.get(key);
|
|
39
|
+
if (!cellParticles) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
for (const p of cellParticles) {
|
|
43
|
+
if (check && !check(p)) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (range.contains(p.getPosition())) {
|
|
47
|
+
out.push(p);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return out;
|
|
53
|
+
}
|
|
54
|
+
queryCircle(position, radius, check, out = []) {
|
|
55
|
+
const circle = this._acquireCircle(position.x, position.y, radius), result = this.query(circle, check, out);
|
|
56
|
+
this._releaseShapes();
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
59
|
+
queryRectangle(position, size, check, out = []) {
|
|
60
|
+
const rect = this._acquireRectangle(position.x, position.y, size.width, size.height), result = this.query(rect, check, out);
|
|
61
|
+
this._releaseShapes();
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
setCellSize(cellSize) {
|
|
65
|
+
this._pendingCellSize = cellSize;
|
|
66
|
+
}
|
|
67
|
+
_acquireCircle(x, y, r) {
|
|
68
|
+
return (this._circlePool[this._circlePoolIdx++] ??= new Circle(x, y, r)).reset(x, y, r);
|
|
69
|
+
}
|
|
70
|
+
_acquireRectangle(x, y, w, h) {
|
|
71
|
+
return (this._rectanglePool[this._rectanglePoolIdx++] ??= new Rectangle(x, y, w, h)).reset(x, y, w, h);
|
|
72
|
+
}
|
|
73
|
+
_cellKeyFromCoords(x, y) {
|
|
74
|
+
const cellX = Math.floor(x / this._cellSize), cellY = Math.floor(y / this._cellSize);
|
|
75
|
+
return `${cellX}_${cellY}`;
|
|
76
|
+
}
|
|
77
|
+
_getRangeBounds(range) {
|
|
78
|
+
if (range instanceof Circle) {
|
|
79
|
+
const r = range.radius, { x, y } = range.position;
|
|
80
|
+
return {
|
|
81
|
+
minX: x - r,
|
|
82
|
+
maxX: x + r,
|
|
83
|
+
minY: y - r,
|
|
84
|
+
maxY: y + r,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
if (range instanceof Rectangle) {
|
|
88
|
+
const { x, y } = range.position, { width, height } = range.size;
|
|
89
|
+
return {
|
|
90
|
+
minX: x,
|
|
91
|
+
maxX: x + width,
|
|
92
|
+
minY: y,
|
|
93
|
+
maxY: y + height,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
_releaseShapes() {
|
|
99
|
+
this._circlePoolIdx = 0;
|
|
100
|
+
this._rectanglePoolIdx = 0;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { inverseFactorNumerator, none, originPoint, squareExp } from "./Constants.js";
|
|
2
|
+
function getZ(source) {
|
|
3
|
+
return "z" in source ? source.z : originPoint.z;
|
|
4
|
+
}
|
|
2
5
|
export class Vector3d {
|
|
6
|
+
x;
|
|
7
|
+
y;
|
|
8
|
+
z;
|
|
3
9
|
constructor(x = originPoint.x, y = originPoint.y, z = originPoint.z) {
|
|
4
|
-
this._updateFromAngle = (angle, length) => {
|
|
5
|
-
this.x = Math.cos(angle) * length;
|
|
6
|
-
this.y = Math.sin(angle) * length;
|
|
7
|
-
};
|
|
8
10
|
this.x = x;
|
|
9
11
|
this.y = y;
|
|
10
12
|
this.z = z;
|
|
@@ -25,31 +27,25 @@ export class Vector3d {
|
|
|
25
27
|
this._updateFromAngle(this.angle, length);
|
|
26
28
|
}
|
|
27
29
|
static clone(source) {
|
|
28
|
-
return Vector3d.create(source.x, source.y, source
|
|
30
|
+
return Vector3d.create(source.x, source.y, getZ(source));
|
|
29
31
|
}
|
|
30
32
|
static create(x, y, z) {
|
|
31
33
|
if (typeof x === "number") {
|
|
32
34
|
return new Vector3d(x, y ?? originPoint.y, z ?? originPoint.z);
|
|
33
35
|
}
|
|
34
|
-
return new Vector3d(x.x, x.y,
|
|
36
|
+
return new Vector3d(x.x, x.y, getZ(x));
|
|
35
37
|
}
|
|
36
38
|
add(v) {
|
|
37
|
-
return Vector3d.create(this.x + v.x, this.y + v.y, this.z + v
|
|
39
|
+
return Vector3d.create(this.x + v.x, this.y + v.y, this.z + getZ(v));
|
|
38
40
|
}
|
|
39
41
|
addTo(v) {
|
|
40
42
|
this.x += v.x;
|
|
41
43
|
this.y += v.y;
|
|
42
|
-
this.z += v
|
|
44
|
+
this.z += getZ(v);
|
|
43
45
|
}
|
|
44
46
|
copy() {
|
|
45
47
|
return Vector3d.clone(this);
|
|
46
48
|
}
|
|
47
|
-
distanceTo(v) {
|
|
48
|
-
return this.sub(v).length;
|
|
49
|
-
}
|
|
50
|
-
distanceToSq(v) {
|
|
51
|
-
return this.sub(v).getLengthSq();
|
|
52
|
-
}
|
|
53
49
|
div(n) {
|
|
54
50
|
return Vector3d.create(this.x / n, this.y / n, this.z / n);
|
|
55
51
|
}
|
|
@@ -81,16 +77,19 @@ export class Vector3d {
|
|
|
81
77
|
setTo(c) {
|
|
82
78
|
this.x = c.x;
|
|
83
79
|
this.y = c.y;
|
|
84
|
-
|
|
85
|
-
this.z = v3d.z ? v3d.z : originPoint.z;
|
|
80
|
+
this.z = getZ(c);
|
|
86
81
|
}
|
|
87
82
|
sub(v) {
|
|
88
|
-
return Vector3d.create(this.x - v.x, this.y - v.y, this.z - v
|
|
83
|
+
return Vector3d.create(this.x - v.x, this.y - v.y, this.z - getZ(v));
|
|
89
84
|
}
|
|
90
85
|
subFrom(v) {
|
|
91
86
|
this.x -= v.x;
|
|
92
87
|
this.y -= v.y;
|
|
93
|
-
this.z -= v
|
|
88
|
+
this.z -= getZ(v);
|
|
89
|
+
}
|
|
90
|
+
_updateFromAngle(angle, length) {
|
|
91
|
+
this.x = Math.cos(angle) * length;
|
|
92
|
+
this.y = Math.sin(angle) * length;
|
|
94
93
|
}
|
|
95
94
|
}
|
|
96
95
|
export class Vector extends Vector3d {
|
|
@@ -2,6 +2,7 @@ import { isArray, isNull, isString } from "../../Utils/TypeUtils.js";
|
|
|
2
2
|
import { HslAnimation } from "./HslAnimation.js";
|
|
3
3
|
import { OptionsColor } from "./OptionsColor.js";
|
|
4
4
|
export class AnimatableColor extends OptionsColor {
|
|
5
|
+
animation;
|
|
5
6
|
constructor() {
|
|
6
7
|
super();
|
|
7
8
|
this.animation = new HslAnimation();
|
|
@@ -3,6 +3,12 @@ import { StartValueType } from "../../Enums/Types/StartValueType.js";
|
|
|
3
3
|
import { isNull } from "../../Utils/TypeUtils.js";
|
|
4
4
|
import { setRangeValue } from "../../Utils/MathUtils.js";
|
|
5
5
|
export class AnimationOptions {
|
|
6
|
+
count;
|
|
7
|
+
decay;
|
|
8
|
+
delay;
|
|
9
|
+
enable;
|
|
10
|
+
speed;
|
|
11
|
+
sync;
|
|
6
12
|
constructor() {
|
|
7
13
|
this.count = 0;
|
|
8
14
|
this.enable = false;
|
|
@@ -36,6 +42,8 @@ export class AnimationOptions {
|
|
|
36
42
|
}
|
|
37
43
|
}
|
|
38
44
|
export class RangedAnimationOptions extends AnimationOptions {
|
|
45
|
+
mode;
|
|
46
|
+
startValue;
|
|
39
47
|
constructor() {
|
|
40
48
|
super();
|
|
41
49
|
this.mode = AnimationMode.auto;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { OptionsColor } from "../OptionsColor.js";
|
|
2
2
|
import { isNull } from "../../../Utils/TypeUtils.js";
|
|
3
3
|
export class Background {
|
|
4
|
+
color;
|
|
5
|
+
image;
|
|
6
|
+
opacity;
|
|
7
|
+
position;
|
|
8
|
+
repeat;
|
|
9
|
+
size;
|
|
4
10
|
constructor() {
|
|
5
11
|
this.color = new OptionsColor();
|
|
6
12
|
this.color.value = "";
|
|
@@ -2,8 +2,13 @@ import { AnimationOptions } from "./AnimationOptions.js";
|
|
|
2
2
|
import { isNull } from "../../Utils/TypeUtils.js";
|
|
3
3
|
import { setRangeValue } from "../../Utils/MathUtils.js";
|
|
4
4
|
export class ColorAnimation extends AnimationOptions {
|
|
5
|
-
|
|
5
|
+
max;
|
|
6
|
+
min;
|
|
7
|
+
offset;
|
|
8
|
+
constructor(min, max) {
|
|
6
9
|
super();
|
|
10
|
+
this.min = min;
|
|
11
|
+
this.max = max;
|
|
7
12
|
this.offset = 0;
|
|
8
13
|
this.sync = true;
|
|
9
14
|
}
|
|
@@ -12,6 +17,12 @@ export class ColorAnimation extends AnimationOptions {
|
|
|
12
17
|
if (isNull(data)) {
|
|
13
18
|
return;
|
|
14
19
|
}
|
|
20
|
+
if (data.max !== undefined) {
|
|
21
|
+
this.max = data.max;
|
|
22
|
+
}
|
|
23
|
+
if (data.min !== undefined) {
|
|
24
|
+
this.min = data.min;
|
|
25
|
+
}
|
|
15
26
|
if (data.offset !== undefined) {
|
|
16
27
|
this.offset = setRangeValue(data.offset);
|
|
17
28
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
import { hMax, hMin, lMax, lMin, sMax, sMin } from "../../Core/Utils/Constants.js";
|
|
1
2
|
import { ColorAnimation } from "./ColorAnimation.js";
|
|
2
3
|
import { isNull } from "../../Utils/TypeUtils.js";
|
|
3
4
|
export class HslAnimation {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
this.l = new ColorAnimation();
|
|
8
|
-
}
|
|
5
|
+
h = new ColorAnimation(hMin, hMax);
|
|
6
|
+
l = new ColorAnimation(lMin, lMax);
|
|
7
|
+
s = new ColorAnimation(sMin, sMax);
|
|
9
8
|
load(data) {
|
|
10
9
|
if (isNull(data)) {
|
|
11
10
|
return;
|
|
@@ -6,10 +6,30 @@ import { ResizeEvent } from "./ResizeEvent.js";
|
|
|
6
6
|
import { loadParticlesOptions } from "../../Utils/OptionsUtils.js";
|
|
7
7
|
import { setRangeValue } from "../../Utils/MathUtils.js";
|
|
8
8
|
export class Options {
|
|
9
|
+
autoPlay;
|
|
10
|
+
background;
|
|
11
|
+
clear;
|
|
12
|
+
defaultThemes;
|
|
13
|
+
delay;
|
|
14
|
+
detectRetina;
|
|
15
|
+
duration;
|
|
16
|
+
fpsLimit;
|
|
17
|
+
fullScreen;
|
|
18
|
+
hdr;
|
|
19
|
+
key;
|
|
20
|
+
name;
|
|
21
|
+
palette;
|
|
22
|
+
particles;
|
|
23
|
+
pauseOnBlur;
|
|
24
|
+
pauseOnOutsideViewport;
|
|
25
|
+
preset;
|
|
26
|
+
resize;
|
|
27
|
+
smooth;
|
|
28
|
+
style;
|
|
29
|
+
zLayers;
|
|
30
|
+
_container;
|
|
31
|
+
_engine;
|
|
9
32
|
constructor(engine, container) {
|
|
10
|
-
this._importPreset = preset => {
|
|
11
|
-
this.load(this._engine.getPreset(preset));
|
|
12
|
-
};
|
|
13
33
|
this._engine = engine;
|
|
14
34
|
this._container = container;
|
|
15
35
|
this.autoPlay = true;
|
|
@@ -35,10 +55,15 @@ export class Options {
|
|
|
35
55
|
return;
|
|
36
56
|
}
|
|
37
57
|
if (data.preset !== undefined) {
|
|
38
|
-
|
|
58
|
+
this.preset = data.preset;
|
|
59
|
+
executeOnSingleOrMultiple(this.preset, preset => {
|
|
39
60
|
this._importPreset(preset);
|
|
40
61
|
});
|
|
41
62
|
}
|
|
63
|
+
if (data.palette !== undefined) {
|
|
64
|
+
this.palette = data.palette;
|
|
65
|
+
this._importPalette(this.palette);
|
|
66
|
+
}
|
|
42
67
|
if (data.autoPlay !== undefined) {
|
|
43
68
|
this.autoPlay = data.autoPlay;
|
|
44
69
|
}
|
|
@@ -95,4 +120,38 @@ export class Options {
|
|
|
95
120
|
plugin.loadOptions(this._container, this, data);
|
|
96
121
|
});
|
|
97
122
|
}
|
|
123
|
+
_importPalette = palette => {
|
|
124
|
+
const paletteData = this._engine.getPalette(palette);
|
|
125
|
+
if (!paletteData) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
this.load({
|
|
129
|
+
background: {
|
|
130
|
+
color: paletteData.background,
|
|
131
|
+
},
|
|
132
|
+
blend: {
|
|
133
|
+
enable: true,
|
|
134
|
+
mode: paletteData.blendMode,
|
|
135
|
+
},
|
|
136
|
+
particles: {
|
|
137
|
+
fill: {
|
|
138
|
+
color: paletteData.fill
|
|
139
|
+
? {
|
|
140
|
+
value: paletteData.colors,
|
|
141
|
+
}
|
|
142
|
+
: undefined,
|
|
143
|
+
enable: paletteData.fill,
|
|
144
|
+
},
|
|
145
|
+
stroke: !paletteData.fill
|
|
146
|
+
? paletteData.colors.map(color => ({
|
|
147
|
+
color: { value: color },
|
|
148
|
+
width: 1,
|
|
149
|
+
}))
|
|
150
|
+
: undefined,
|
|
151
|
+
},
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
_importPreset = preset => {
|
|
155
|
+
this.load(this._engine.getPreset(preset));
|
|
156
|
+
};
|
|
98
157
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ParticlesBounceFactor } from "./ParticlesBounceFactor.js";
|
|
2
2
|
import { isNull } from "../../../../Utils/TypeUtils.js";
|
|
3
3
|
export class ParticlesBounce {
|
|
4
|
+
horizontal;
|
|
5
|
+
vertical;
|
|
4
6
|
constructor() {
|
|
5
7
|
this.horizontal = new ParticlesBounceFactor();
|
|
6
8
|
this.vertical = new ParticlesBounceFactor();
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { deepExtend } from "../../../../Utils/Utils.js";
|
|
2
2
|
import { isNull } from "../../../../Utils/TypeUtils.js";
|
|
3
3
|
export class Effect {
|
|
4
|
+
close;
|
|
5
|
+
options;
|
|
6
|
+
type;
|
|
4
7
|
constructor() {
|
|
5
8
|
this.close = true;
|
|
6
|
-
this.fill = true;
|
|
7
9
|
this.options = {};
|
|
8
10
|
this.type = [];
|
|
9
11
|
}
|
|
@@ -23,9 +25,6 @@ export class Effect {
|
|
|
23
25
|
if (data.close !== undefined) {
|
|
24
26
|
this.close = data.close;
|
|
25
27
|
}
|
|
26
|
-
if (data.fill !== undefined) {
|
|
27
|
-
this.fill = data.fill;
|
|
28
|
-
}
|
|
29
28
|
if (data.type !== undefined) {
|
|
30
29
|
this.type = data.type;
|
|
31
30
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AnimatableColor } from "../AnimatableColor.js";
|
|
2
|
+
import { isNull } from "../../../Utils/TypeUtils.js";
|
|
3
|
+
import { setRangeValue } from "../../../Utils/MathUtils.js";
|
|
4
|
+
export class Fill {
|
|
5
|
+
color;
|
|
6
|
+
enable;
|
|
7
|
+
opacity;
|
|
8
|
+
constructor() {
|
|
9
|
+
this.enable = true;
|
|
10
|
+
this.color = new AnimatableColor();
|
|
11
|
+
this.color.value = "#fff";
|
|
12
|
+
this.opacity = 1;
|
|
13
|
+
}
|
|
14
|
+
load(data) {
|
|
15
|
+
if (isNull(data)) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (data.color !== undefined) {
|
|
19
|
+
this.color = AnimatableColor.create(this.color, data.color);
|
|
20
|
+
}
|
|
21
|
+
if (data.enable !== undefined) {
|
|
22
|
+
this.enable = data.enable;
|
|
23
|
+
}
|
|
24
|
+
if (data.opacity !== undefined) {
|
|
25
|
+
this.opacity = setRangeValue(data.opacity);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { MoveDirection } from "../../../../Enums/Directions/MoveDirection.js";
|
|
2
2
|
import { isNull, isNumber, isObject } from "../../../../Utils/TypeUtils.js";
|
|
3
3
|
import { MoveAngle } from "./MoveAngle.js";
|
|
4
|
-
import { MoveAttract } from "./MoveAttract.js";
|
|
5
4
|
import { MoveCenter } from "./MoveCenter.js";
|
|
6
5
|
import { MoveGravity } from "./MoveGravity.js";
|
|
7
6
|
import { MovePath } from "./Path/MovePath.js";
|
|
@@ -9,9 +8,25 @@ import { OutModes } from "./OutModes.js";
|
|
|
9
8
|
import { Spin } from "./Spin.js";
|
|
10
9
|
import { setRangeValue } from "../../../../Utils/MathUtils.js";
|
|
11
10
|
export class Move {
|
|
11
|
+
angle;
|
|
12
|
+
center;
|
|
13
|
+
decay;
|
|
14
|
+
direction;
|
|
15
|
+
distance;
|
|
16
|
+
drift;
|
|
17
|
+
enable;
|
|
18
|
+
gravity;
|
|
19
|
+
outModes;
|
|
20
|
+
path;
|
|
21
|
+
random;
|
|
22
|
+
size;
|
|
23
|
+
speed;
|
|
24
|
+
spin;
|
|
25
|
+
straight;
|
|
26
|
+
vibrate;
|
|
27
|
+
warp;
|
|
12
28
|
constructor() {
|
|
13
29
|
this.angle = new MoveAngle();
|
|
14
|
-
this.attract = new MoveAttract();
|
|
15
30
|
this.center = new MoveCenter();
|
|
16
31
|
this.decay = 0;
|
|
17
32
|
this.distance = {};
|
|
@@ -34,7 +49,6 @@ export class Move {
|
|
|
34
49
|
return;
|
|
35
50
|
}
|
|
36
51
|
this.angle.load(isNumber(data.angle) ? { value: data.angle } : data.angle);
|
|
37
|
-
this.attract.load(data.attract);
|
|
38
52
|
this.center.load(data.center);
|
|
39
53
|
if (data.decay !== undefined) {
|
|
40
54
|
this.decay = setRangeValue(data.decay);
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { isNull } from "../../../../Utils/TypeUtils.js";
|
|
2
2
|
import { setRangeValue } from "../../../../Utils/MathUtils.js";
|
|
3
3
|
export class MoveGravity {
|
|
4
|
+
acceleration;
|
|
5
|
+
enable;
|
|
6
|
+
inverse;
|
|
7
|
+
maxSpeed;
|
|
4
8
|
constructor() {
|
|
5
9
|
this.acceleration = 9.81;
|
|
6
10
|
this.enable = false;
|
|
@@ -2,6 +2,11 @@ import { ValueWithRandom } from "../../../ValueWithRandom.js";
|
|
|
2
2
|
import { deepExtend } from "../../../../../Utils/Utils.js";
|
|
3
3
|
import { isNull } from "../../../../../Utils/TypeUtils.js";
|
|
4
4
|
export class MovePath {
|
|
5
|
+
clamp;
|
|
6
|
+
delay;
|
|
7
|
+
enable;
|
|
8
|
+
generator;
|
|
9
|
+
options;
|
|
5
10
|
constructor() {
|
|
6
11
|
this.clamp = true;
|
|
7
12
|
this.delay = new ValueWithRandom();
|
|
@@ -2,6 +2,9 @@ import { deepExtend } from "../../../../Utils/Utils.js";
|
|
|
2
2
|
import { isNull } from "../../../../Utils/TypeUtils.js";
|
|
3
3
|
import { setRangeValue } from "../../../../Utils/MathUtils.js";
|
|
4
4
|
export class Spin {
|
|
5
|
+
acceleration;
|
|
6
|
+
enable;
|
|
7
|
+
position;
|
|
5
8
|
constructor() {
|
|
6
9
|
this.acceleration = 0;
|
|
7
10
|
this.enable = false;
|
|
@@ -2,6 +2,9 @@ import { ParticlesDensity } from "./ParticlesDensity.js";
|
|
|
2
2
|
import { ParticlesNumberLimit } from "./ParticlesNumberLimit.js";
|
|
3
3
|
import { isNull } from "../../../../Utils/TypeUtils.js";
|
|
4
4
|
export class ParticlesNumber {
|
|
5
|
+
density;
|
|
6
|
+
limit;
|
|
7
|
+
value;
|
|
5
8
|
constructor() {
|
|
6
9
|
this.density = new ParticlesDensity();
|
|
7
10
|
this.limit = new ParticlesNumberLimit();
|
|
@@ -2,6 +2,7 @@ import { OpacityAnimation } from "./OpacityAnimation.js";
|
|
|
2
2
|
import { RangedAnimationValueWithRandom } from "../../ValueWithRandom.js";
|
|
3
3
|
import { isNull } from "../../../../Utils/TypeUtils.js";
|
|
4
4
|
export class Opacity extends RangedAnimationValueWithRandom {
|
|
5
|
+
animation;
|
|
5
6
|
constructor() {
|
|
6
7
|
super();
|
|
7
8
|
this.animation = new OpacityAnimation();
|
|
@@ -2,6 +2,7 @@ import { DestroyType } from "../../../../Enums/Types/DestroyType.js";
|
|
|
2
2
|
import { RangedAnimationOptions } from "../../AnimationOptions.js";
|
|
3
3
|
import { isNull } from "../../../../Utils/TypeUtils.js";
|
|
4
4
|
export class OpacityAnimation extends RangedAnimationOptions {
|
|
5
|
+
destroy;
|
|
5
6
|
constructor() {
|
|
6
7
|
super();
|
|
7
8
|
this.destroy = DestroyType.none;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { deepExtend, executeOnSingleOrMultiple } from "../../../Utils/Utils.js";
|
|
2
|
-
import { AnimatableColor } from "../AnimatableColor.js";
|
|
3
2
|
import { Effect } from "./Effect/Effect.js";
|
|
3
|
+
import { Fill } from "./Fill.js";
|
|
4
4
|
import { Move } from "./Move/Move.js";
|
|
5
5
|
import { Opacity } from "./Opacity/Opacity.js";
|
|
6
6
|
import { ParticlesBounce } from "./Bounce/ParticlesBounce.js";
|
|
@@ -11,13 +11,26 @@ import { Stroke } from "./Stroke.js";
|
|
|
11
11
|
import { ZIndex } from "./ZIndex/ZIndex.js";
|
|
12
12
|
import { isNull } from "../../../Utils/TypeUtils.js";
|
|
13
13
|
export class ParticlesOptions {
|
|
14
|
+
bounce;
|
|
15
|
+
effect;
|
|
16
|
+
fill;
|
|
17
|
+
groups;
|
|
18
|
+
move;
|
|
19
|
+
number;
|
|
20
|
+
opacity;
|
|
21
|
+
reduceDuplicates;
|
|
22
|
+
shape;
|
|
23
|
+
size;
|
|
24
|
+
stroke;
|
|
25
|
+
zIndex;
|
|
26
|
+
_container;
|
|
27
|
+
_engine;
|
|
14
28
|
constructor(engine, container) {
|
|
15
29
|
this._engine = engine;
|
|
16
30
|
this._container = container;
|
|
17
31
|
this.bounce = new ParticlesBounce();
|
|
18
|
-
this.color = new AnimatableColor();
|
|
19
|
-
this.color.value = "#fff";
|
|
20
32
|
this.effect = new Effect();
|
|
33
|
+
this.fill = new Fill();
|
|
21
34
|
this.groups = {};
|
|
22
35
|
this.move = new Move();
|
|
23
36
|
this.number = new ParticlesNumber();
|
|
@@ -34,7 +47,7 @@ export class ParticlesOptions {
|
|
|
34
47
|
}
|
|
35
48
|
if (data.groups !== undefined) {
|
|
36
49
|
for (const group of Object.keys(data.groups)) {
|
|
37
|
-
if (!
|
|
50
|
+
if (!(group in data.groups)) {
|
|
38
51
|
continue;
|
|
39
52
|
}
|
|
40
53
|
const item = data.groups[group];
|
|
@@ -47,7 +60,6 @@ export class ParticlesOptions {
|
|
|
47
60
|
this.reduceDuplicates = data.reduceDuplicates;
|
|
48
61
|
}
|
|
49
62
|
this.bounce.load(data.bounce);
|
|
50
|
-
this.color.load(AnimatableColor.create(this.color, data.color));
|
|
51
63
|
this.effect.load(data.effect);
|
|
52
64
|
this.move.load(data.move);
|
|
53
65
|
this.number.load(data.number);
|
|
@@ -55,6 +67,14 @@ export class ParticlesOptions {
|
|
|
55
67
|
this.shape.load(data.shape);
|
|
56
68
|
this.size.load(data.size);
|
|
57
69
|
this.zIndex.load(data.zIndex);
|
|
70
|
+
const fillToLoad = data.fill;
|
|
71
|
+
if (fillToLoad) {
|
|
72
|
+
this.fill = executeOnSingleOrMultiple(fillToLoad, t => {
|
|
73
|
+
const tmp = new Fill();
|
|
74
|
+
tmp.load(t);
|
|
75
|
+
return tmp;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
58
78
|
const strokeToLoad = data.stroke;
|
|
59
79
|
if (strokeToLoad) {
|
|
60
80
|
this.stroke = executeOnSingleOrMultiple(strokeToLoad, t => {
|