particle-flux 1.0.0 → 2.0.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/lib/constants.d.ts +0 -1
- package/lib/constants.js.map +1 -1
- package/lib/core/ConfigManager.d.ts +47 -31
- package/lib/core/ConfigManager.js +189 -81
- package/lib/core/ConfigManager.js.map +1 -1
- package/lib/core/FrameCapacity.d.ts +11 -0
- package/lib/core/FrameCapacity.js +57 -0
- package/lib/core/FrameCapacity.js.map +1 -0
- package/lib/core/ParticleContainer.d.ts +18 -4
- package/lib/core/ParticleContainer.js +141 -41
- package/lib/core/ParticleContainer.js.map +1 -1
- package/lib/core/ParticleEmitter.d.ts +22 -9
- package/lib/core/ParticleEmitter.js +227 -89
- package/lib/core/ParticleEmitter.js.map +1 -1
- package/lib/core/ParticleSpawner.d.ts +12 -3
- package/lib/core/ParticleSpawner.js +37 -32
- package/lib/core/ParticleSpawner.js.map +1 -1
- package/lib/core/PreparedParticleConfig.d.ts +38 -0
- package/lib/core/PreparedParticleConfig.js +67 -0
- package/lib/core/PreparedParticleConfig.js.map +1 -0
- package/lib/core/behaviors/direction/direction.typeguards.d.ts +0 -1
- package/lib/core/behaviors/direction/direction.typeguards.js.map +1 -1
- package/lib/core/behaviors/direction/direction.types.d.ts +0 -1
- package/lib/core/behaviors/direction/direction.types.js.map +1 -1
- package/lib/core/behaviors/direction/getDirection.d.ts +2 -2
- package/lib/core/behaviors/direction/getDirection.js +2 -2
- package/lib/core/behaviors/direction/getDirection.js.map +1 -1
- package/lib/core/behaviors/life-time-behavior/life-time-behavior.d.ts +2 -2
- package/lib/core/behaviors/life-time-behavior/life-time-behavior.js +3 -3
- package/lib/core/behaviors/life-time-behavior/life-time-behavior.js.map +1 -1
- package/lib/core/behaviors/life-time-behavior/life-time-behavior.typeguards.d.ts +0 -1
- package/lib/core/behaviors/life-time-behavior/life-time-behavior.typeguards.js.map +1 -1
- package/lib/core/behaviors/life-time-behavior/life-time-behavior.types.d.ts +0 -1
- package/lib/core/behaviors/life-time-behavior/life-time-behavior.types.js.map +1 -1
- package/lib/core/behaviors/particle-value/getBehaviorValue.d.ts +0 -1
- package/lib/core/behaviors/particle-value/getBehaviorValue.js.map +1 -1
- package/lib/core/behaviors/particle-value/getColorTimelapsesBehavior.d.ts +0 -1
- package/lib/core/behaviors/particle-value/getColorTimelapsesBehavior.js +7 -27
- package/lib/core/behaviors/particle-value/getColorTimelapsesBehavior.js.map +1 -1
- package/lib/core/behaviors/particle-value/getNumberTimelapsesBehavior.d.ts +2 -2
- package/lib/core/behaviors/particle-value/getNumberTimelapsesBehavior.js +10 -29
- package/lib/core/behaviors/particle-value/getNumberTimelapsesBehavior.js.map +1 -1
- package/lib/core/behaviors/particle-value/getTimelapsesValue.d.ts +0 -1
- package/lib/core/behaviors/particle-value/getTimelapsesValue.js +22 -12
- package/lib/core/behaviors/particle-value/getTimelapsesValue.js.map +1 -1
- package/lib/core/behaviors/particle-value/prepareTimelapses.d.ts +5 -0
- package/lib/core/behaviors/particle-value/prepareTimelapses.js +28 -0
- package/lib/core/behaviors/particle-value/prepareTimelapses.js.map +1 -0
- package/lib/core/behaviors/particle-value/timelapses.constants.d.ts +0 -1
- package/lib/core/behaviors/particle-value/timelapses.constants.js.map +1 -1
- package/lib/core/behaviors/particle-value/timelapses.types.d.ts +1 -1
- package/lib/core/behaviors/particle-value/timelapses.types.js.map +1 -1
- package/lib/core/behaviors/path/path.types.d.ts +0 -1
- package/lib/core/behaviors/path/path.types.js.map +1 -1
- package/lib/core/particle/ParticleClock.d.ts +11 -0
- package/lib/core/particle/ParticleClock.js +43 -0
- package/lib/core/particle/ParticleClock.js.map +1 -0
- package/lib/core/particle/createUnusedParticle.d.ts +0 -1
- package/lib/core/particle/createUnusedParticle.js +5 -4
- package/lib/core/particle/createUnusedParticle.js.map +1 -1
- package/lib/core/particle/createView.d.ts +2 -2
- package/lib/core/particle/createView.js +2 -2
- package/lib/core/particle/createView.js.map +1 -1
- package/lib/core/particle/getInitialParticleState.d.ts +0 -1
- package/lib/core/particle/getInitialParticleState.js +1 -0
- package/lib/core/particle/getInitialParticleState.js.map +1 -1
- package/lib/core/particle/getNextParticleAge.d.ts +2 -0
- package/lib/core/particle/getNextParticleAge.js +8 -0
- package/lib/core/particle/getNextParticleAge.js.map +1 -0
- package/lib/core/particle/isNeedRemoveParticle.d.ts +0 -1
- package/lib/core/particle/isNeedRemoveParticle.js.map +1 -1
- package/lib/core/particle/isParticleDead.d.ts +0 -1
- package/lib/core/particle/isParticleDead.js.map +1 -1
- package/lib/core/particle/isParticleInUse.d.ts +0 -1
- package/lib/core/particle/isParticleInUse.js.map +1 -1
- package/lib/core/particle/isParticleRemoved.d.ts +0 -1
- package/lib/core/particle/isParticleRemoved.js.map +1 -1
- package/lib/core/particle/noUseParticle.d.ts +0 -1
- package/lib/core/particle/noUseParticle.js.map +1 -1
- package/lib/core/particle/removeParticle.d.ts +0 -1
- package/lib/core/particle/removeParticle.js.map +1 -1
- package/lib/core/particle/shouldRemoveParticle.d.ts +0 -1
- package/lib/core/particle/shouldRemoveParticle.js.map +1 -1
- package/lib/core/particle/updateParticle.d.ts +1 -2
- package/lib/core/particle/updateParticle.js +17 -5
- package/lib/core/particle/updateParticle.js.map +1 -1
- package/lib/core/particle/useParticle.d.ts +2 -2
- package/lib/core/particle/useParticle.js +24 -47
- package/lib/core/particle/useParticle.js.map +1 -1
- package/lib/core/particle/wasParticleRemoved.d.ts +0 -1
- package/lib/core/particle/wasParticleRemoved.js.map +1 -1
- package/lib/core/spawn-position/spawn-position.types.d.ts +0 -1
- package/lib/core/spawn-position/spawn-position.types.js.map +1 -1
- package/lib/core/spawn-shapes/ShapePointGenerator.d.ts +4 -3
- package/lib/core/spawn-shapes/ShapePointGenerator.js +24 -12
- package/lib/core/spawn-shapes/ShapePointGenerator.js.map +1 -1
- package/lib/core/spawn-shapes/spawn-shapes.constants.d.ts +0 -1
- package/lib/core/spawn-shapes/spawn-shapes.constants.js.map +1 -1
- package/lib/core/spawn-shapes/spawn-shapes.typeguards.d.ts +0 -1
- package/lib/core/spawn-shapes/spawn-shapes.typeguards.js.map +1 -1
- package/lib/core/spawn-shapes/spawn-shapes.types.d.ts +0 -1
- package/lib/core/spawn-shapes/spawn-shapes.types.js.map +1 -1
- package/lib/core/validateConfig.d.ts +6 -0
- package/lib/core/validateConfig.js +136 -0
- package/lib/core/validateConfig.js.map +1 -0
- package/lib/globalWindow.d.ts +0 -1
- package/lib/globalWindow.js.map +1 -1
- package/lib/index.d.ts +6 -4
- package/lib/index.js +11 -1
- package/lib/index.js.map +1 -1
- package/lib/types.d.ts +6 -1
- package/lib/types.js.map +1 -1
- package/lib/utils/EventEmitter.d.ts +0 -1
- package/lib/utils/EventEmitter.js.map +1 -1
- package/lib/utils/Ticker.d.ts +1 -1
- package/lib/utils/Ticker.js +6 -2
- package/lib/utils/Ticker.js.map +1 -1
- package/lib/utils/array/cloneArray.d.ts +0 -1
- package/lib/utils/array/cloneArray.js.map +1 -1
- package/lib/utils/array/range.d.ts +0 -1
- package/lib/utils/array/range.js +2 -0
- package/lib/utils/array/range.js.map +1 -1
- package/lib/utils/cloneDeep.d.ts +0 -1
- package/lib/utils/cloneDeep.js +1 -1
- package/lib/utils/cloneDeep.js.map +1 -1
- package/lib/utils/color/hexToRgb.d.ts +0 -1
- package/lib/utils/color/hexToRgb.js.map +1 -1
- package/lib/utils/color/lerpColor.d.ts +0 -1
- package/lib/utils/color/lerpColor.js.map +1 -1
- package/lib/utils/color/rgbToHex.d.ts +0 -1
- package/lib/utils/color/rgbToHex.js +4 -1
- package/lib/utils/color/rgbToHex.js.map +1 -1
- package/lib/utils/easing/easing-functions.d.ts +1 -3
- package/lib/utils/easing/easing-functions.js +2 -125
- package/lib/utils/easing/easing-functions.js.map +1 -1
- package/lib/utils/easing/easing.constants.d.ts +0 -1
- package/lib/utils/easing/easing.constants.js.map +1 -1
- package/lib/utils/easing/easing.functions.d.ts +0 -1
- package/lib/utils/easing/easing.functions.js.map +1 -1
- package/lib/utils/easing/easing.types.d.ts +0 -1
- package/lib/utils/easing/easing.types.js.map +1 -1
- package/lib/utils/getOrderedMinMax.d.ts +0 -1
- package/lib/utils/getOrderedMinMax.js.map +1 -1
- package/lib/utils/getRandomValue.d.ts +2 -2
- package/lib/utils/getRandomValue.js +2 -2
- package/lib/utils/getRandomValue.js.map +1 -1
- package/lib/utils/lerp.d.ts +0 -1
- package/lib/utils/lerp.js.map +1 -1
- package/lib/utils/observeConfig.d.ts +1 -0
- package/lib/utils/observeConfig.js +121 -0
- package/lib/utils/observeConfig.js.map +1 -0
- package/lib/utils/parsePath.d.ts +2 -2
- package/lib/utils/parsePath.js +4 -3
- package/lib/utils/parsePath.js.map +1 -1
- package/lib/utils/random/Random.d.ts +8 -18
- package/lib/utils/random/Random.js +41 -58
- package/lib/utils/random/Random.js.map +1 -1
- package/lib/utils/random/createRandomStreams.d.ts +7 -0
- package/lib/utils/random/createRandomStreams.js +28 -0
- package/lib/utils/random/createRandomStreams.js.map +1 -0
- package/lib/utils/random/createSeededRandom.d.ts +2 -0
- package/lib/utils/random/createSeededRandom.js +42 -0
- package/lib/utils/random/createSeededRandom.js.map +1 -0
- package/lib/utils/random/random.types.d.ts +11 -0
- package/lib/utils/random/random.types.js +3 -0
- package/lib/utils/random/random.types.js.map +1 -0
- package/lib/utils/rotation/degreesToRadians.d.ts +0 -1
- package/lib/utils/rotation/degreesToRadians.js.map +1 -1
- package/lib/utils/rotation/normalizeDegrees.d.ts +0 -1
- package/lib/utils/rotation/normalizeDegrees.js.map +1 -1
- package/lib/utils/rotation/radiansToDegrees.d.ts +0 -1
- package/lib/utils/rotation/radiansToDegrees.js.map +1 -1
- package/lib/utils/roundWith2Precision.d.ts +0 -1
- package/lib/utils/roundWith2Precision.js.map +1 -1
- package/lib/utils/time.d.ts +4 -0
- package/lib/utils/time.js +24 -0
- package/lib/utils/time.js.map +1 -0
- package/lib/utils/validateDelta.d.ts +2 -0
- package/lib/utils/validateDelta.js +16 -0
- package/lib/utils/validateDelta.js.map +1 -0
- package/lib/utils/validateDenseArray.d.ts +1 -0
- package/lib/utils/validateDenseArray.js +12 -0
- package/lib/utils/validateDenseArray.js.map +1 -0
- package/lib/utils/vector2d/angleInDegreesToPoint.d.ts +0 -1
- package/lib/utils/vector2d/angleInDegreesToPoint.js.map +1 -1
- package/lib/utils/vector2d/angleInRadToPoint.d.ts +0 -1
- package/lib/utils/vector2d/angleInRadToPoint.js.map +1 -1
- package/lib/utils/vector2d/pointToAngleInDegrees.d.ts +0 -1
- package/lib/utils/vector2d/pointToAngleInDegrees.js.map +1 -1
- package/lib/utils/vector2d/rotate.d.ts +0 -1
- package/lib/utils/vector2d/rotate.js.map +1 -1
- package/package.json +22 -16
- package/readme.md +281 -422
- package/lib/constants.d.ts.map +0 -1
- package/lib/core/ConfigManager.d.ts.map +0 -1
- package/lib/core/ParticleContainer.d.ts.map +0 -1
- package/lib/core/ParticleEmitter.d.ts.map +0 -1
- package/lib/core/ParticleSpawner.d.ts.map +0 -1
- package/lib/core/behaviors/direction/direction.typeguards.d.ts.map +0 -1
- package/lib/core/behaviors/direction/direction.types.d.ts.map +0 -1
- package/lib/core/behaviors/direction/getDirection.d.ts.map +0 -1
- package/lib/core/behaviors/life-time-behavior/life-time-behavior.d.ts.map +0 -1
- package/lib/core/behaviors/life-time-behavior/life-time-behavior.typeguards.d.ts.map +0 -1
- package/lib/core/behaviors/life-time-behavior/life-time-behavior.types.d.ts.map +0 -1
- package/lib/core/behaviors/particle-value/getBehaviorValue.d.ts.map +0 -1
- package/lib/core/behaviors/particle-value/getColorTimelapsesBehavior.d.ts.map +0 -1
- package/lib/core/behaviors/particle-value/getNumberTimelapsesBehavior.d.ts.map +0 -1
- package/lib/core/behaviors/particle-value/getTimelapsesValue.d.ts.map +0 -1
- package/lib/core/behaviors/particle-value/timelapses.constants.d.ts.map +0 -1
- package/lib/core/behaviors/particle-value/timelapses.types.d.ts.map +0 -1
- package/lib/core/behaviors/path/path.types.d.ts.map +0 -1
- package/lib/core/particle/createUnusedParticle.d.ts.map +0 -1
- package/lib/core/particle/createView.d.ts.map +0 -1
- package/lib/core/particle/getInitialParticleState.d.ts.map +0 -1
- package/lib/core/particle/isNeedRemoveParticle.d.ts.map +0 -1
- package/lib/core/particle/isParticleDead.d.ts.map +0 -1
- package/lib/core/particle/isParticleInUse.d.ts.map +0 -1
- package/lib/core/particle/isParticleRemoved.d.ts.map +0 -1
- package/lib/core/particle/noUseParticle.d.ts.map +0 -1
- package/lib/core/particle/removeParticle.d.ts.map +0 -1
- package/lib/core/particle/shouldRemoveParticle.d.ts.map +0 -1
- package/lib/core/particle/updateParticle.d.ts.map +0 -1
- package/lib/core/particle/useParticle.d.ts.map +0 -1
- package/lib/core/particle/wasParticleRemoved.d.ts.map +0 -1
- package/lib/core/spawn-position/spawn-position.types.d.ts.map +0 -1
- package/lib/core/spawn-shapes/ShapePointGenerator.d.ts.map +0 -1
- package/lib/core/spawn-shapes/spawn-shapes.constants.d.ts.map +0 -1
- package/lib/core/spawn-shapes/spawn-shapes.typeguards.d.ts.map +0 -1
- package/lib/core/spawn-shapes/spawn-shapes.types.d.ts.map +0 -1
- package/lib/globalWindow.d.ts.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/scripts/measure-performance.d.ts +0 -2
- package/lib/scripts/measure-performance.d.ts.map +0 -1
- package/lib/scripts/measure-performance.js +0 -54
- package/lib/scripts/measure-performance.js.map +0 -1
- package/lib/scripts/measureFuncExecuteTime.d.ts +0 -9
- package/lib/scripts/measureFuncExecuteTime.d.ts.map +0 -1
- package/lib/scripts/measureFuncExecuteTime.js +0 -32
- package/lib/scripts/measureFuncExecuteTime.js.map +0 -1
- package/lib/types.d.ts.map +0 -1
- package/lib/utils/EventEmitter.d.ts.map +0 -1
- package/lib/utils/Ticker.d.ts.map +0 -1
- package/lib/utils/array/cloneArray.d.ts.map +0 -1
- package/lib/utils/array/range.d.ts.map +0 -1
- package/lib/utils/cloneDeep.d.ts.map +0 -1
- package/lib/utils/color/hexToRgb.d.ts.map +0 -1
- package/lib/utils/color/lerpColor.d.ts.map +0 -1
- package/lib/utils/color/rgbToHex.d.ts.map +0 -1
- package/lib/utils/easing/easing-functions.d.ts.map +0 -1
- package/lib/utils/easing/easing.constants.d.ts.map +0 -1
- package/lib/utils/easing/easing.functions.d.ts.map +0 -1
- package/lib/utils/easing/easing.types.d.ts.map +0 -1
- package/lib/utils/getOrderedMinMax.d.ts.map +0 -1
- package/lib/utils/getRandomValue.d.ts.map +0 -1
- package/lib/utils/lerp.d.ts.map +0 -1
- package/lib/utils/parsePath.d.ts.map +0 -1
- package/lib/utils/random/Random.d.ts.map +0 -1
- package/lib/utils/random/generators/PseudoRandomGenerator.d.ts +0 -17
- package/lib/utils/random/generators/PseudoRandomGenerator.d.ts.map +0 -1
- package/lib/utils/random/generators/PseudoRandomGenerator.js +0 -53
- package/lib/utils/random/generators/PseudoRandomGenerator.js.map +0 -1
- package/lib/utils/random/generators/RealRandomGenerator.d.ts +0 -7
- package/lib/utils/random/generators/RealRandomGenerator.d.ts.map +0 -1
- package/lib/utils/random/generators/RealRandomGenerator.js +0 -17
- package/lib/utils/random/generators/RealRandomGenerator.js.map +0 -1
- package/lib/utils/rotation/degreesToRadians.d.ts.map +0 -1
- package/lib/utils/rotation/normalizeDegrees.d.ts.map +0 -1
- package/lib/utils/rotation/radiansToDegrees.d.ts.map +0 -1
- package/lib/utils/roundWith2Precision.d.ts.map +0 -1
- package/lib/utils/vector2d/angleInDegreesToPoint.d.ts.map +0 -1
- package/lib/utils/vector2d/angleInRadToPoint.d.ts.map +0 -1
- package/lib/utils/vector2d/pointToAngleInDegrees.d.ts.map +0 -1
- package/lib/utils/vector2d/rotate.d.ts.map +0 -1
package/lib/constants.d.ts
CHANGED
package/lib/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAIa,QAAA,wBAAwB,GAAiC,EAAC,KAAK,EAAE,MAAM,CAAC,iBAAiB,EAAC,CAAC;AAC3F,QAAA,wBAAwB,GAAoB,EAAC,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAC,CAAC;AACzE,QAAA,sBAAsB,GAAY,EAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAC,CAAC;AAE/C,QAAA,0BAA0B,GAAG,GAAG,CAAC;AAEjC,QAAA,gBAAgB,GAAG,CAAC,CAAC;AACrB,QAAA,gBAAgB,GAAG,GAAG,CAAC;AAEvB,QAAA,YAAY,GAAG,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAIa,QAAA,wBAAwB,GAAiC,EAAC,KAAK,EAAE,MAAM,CAAC,iBAAiB,EAAC,CAAC;AAC3F,QAAA,wBAAwB,GAAoB,EAAC,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAC,CAAC;AACzE,QAAA,sBAAsB,GAAY,EAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAC,CAAC;AAE/C,QAAA,0BAA0B,GAAG,GAAG,CAAC;AAEjC,QAAA,gBAAgB,GAAG,CAAC,CAAC;AACrB,QAAA,gBAAgB,GAAG,GAAG,CAAC;AAEvB,QAAA,YAAY,GAAG,CAAC,CAAC","sourcesContent":["import {LifeTimeStaticBehaviorConfig} from './core/behaviors/life-time-behavior/life-time-behavior.types';\nimport {DirectionConfig} from './core/behaviors/direction/direction.types';\nimport {Point2d} from './types';\n\nexport const DEFAULT_LIFE_TIME_CONFIG: LifeTimeStaticBehaviorConfig = {value: Number.POSITIVE_INFINITY};\nexport const DEFAULT_DIRECTION_CONFIG: DirectionConfig = {minAngle: 0, maxAngle: 360};\nexport const DEFAULT_SPAWN_POSITION: Point2d = {x: 0, y: 0};\n\nexport const GRAVITY_DEFAULT_MULTIPLIER = 100;\n\nexport const MIN_SPAWN_CHANCE = 0;\nexport const MAX_SPAWN_CHANCE = 100;\n\nexport const DEFAULT_SEED = 1;\n"]}
|
|
@@ -1,47 +1,64 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RandomSource } from '../utils/random/random.types';
|
|
2
|
+
import { PreparedParticleConfig } from './PreparedParticleConfig';
|
|
3
|
+
import { EmitterConfig, RandomRange, ParticleConfig, ParticleEmitterConfig, ViewFactory, ViewParticle } from '../types';
|
|
2
4
|
import { LifeTimeBehaviorConfig } from './behaviors/life-time-behavior/life-time-behavior.types';
|
|
3
5
|
import { DirectionConfig } from './behaviors/direction/direction.types';
|
|
4
6
|
import { SpawnPositionConfig } from './spawn-position/spawn-position.types';
|
|
5
7
|
import { SpawnShapeBehavior } from './spawn-shapes/spawn-shapes.types';
|
|
6
|
-
import { PathConfig } from './behaviors/path/path.types';
|
|
8
|
+
import { PathConfig, PathFunction } from './behaviors/path/path.types';
|
|
7
9
|
import { ColorTimelapsesConfig, NumberTimelapsesConfig } from './behaviors/particle-value/timelapses.types';
|
|
8
10
|
export declare class ConfigManager<View extends ViewParticle> {
|
|
9
|
-
private
|
|
11
|
+
private readonly pathRandom;
|
|
10
12
|
private config;
|
|
11
|
-
private
|
|
12
|
-
|
|
13
|
+
private viewFactory;
|
|
14
|
+
private compiledPath;
|
|
15
|
+
private prepared?;
|
|
16
|
+
private particleViews;
|
|
17
|
+
private emitterViews;
|
|
18
|
+
private viewObserved?;
|
|
19
|
+
private viewListeners;
|
|
20
|
+
private scheduleListeners;
|
|
21
|
+
constructor(initialConfig: ParticleEmitterConfig, viewFactory: ViewFactory<View>, pathRandom?: RandomSource);
|
|
13
22
|
set fullConfig(config: ParticleEmitterConfig);
|
|
14
23
|
get fullConfig(): ParticleEmitterConfig;
|
|
15
24
|
set emitterConfig(config: EmitterConfig);
|
|
16
25
|
get emitterConfig(): EmitterConfig;
|
|
17
26
|
set particleConfig(config: ParticleConfig);
|
|
18
27
|
get particleConfig(): ParticleConfig;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
28
|
+
getPreparedParticleConfig(): PreparedParticleConfig;
|
|
29
|
+
get pathFunction(): PathFunction | null;
|
|
30
|
+
get view(): ViewFactory<View>;
|
|
31
|
+
set view(factory: ViewFactory<View>);
|
|
32
|
+
private setEmitter;
|
|
33
|
+
private setParticle;
|
|
34
|
+
private getParticle;
|
|
35
|
+
private getEmitter;
|
|
36
|
+
set spawnInterval(value: number | RandomRange | undefined);
|
|
22
37
|
get spawnInterval(): number | RandomRange | undefined;
|
|
23
|
-
set spawnTime(
|
|
38
|
+
set spawnTime(value: number | undefined);
|
|
24
39
|
get spawnTime(): number | undefined;
|
|
25
|
-
set spawnTimeout(
|
|
40
|
+
set spawnTimeout(value: number | undefined);
|
|
26
41
|
get spawnTimeout(): number | undefined;
|
|
27
|
-
set spawnParticlesPerWave(
|
|
42
|
+
set spawnParticlesPerWave(value: number | undefined);
|
|
28
43
|
get spawnParticlesPerWave(): number | undefined;
|
|
29
|
-
set maxParticles(
|
|
44
|
+
set maxParticles(value: number | undefined);
|
|
30
45
|
get maxParticles(): number | undefined;
|
|
31
|
-
set spawnChance(
|
|
46
|
+
set spawnChance(value: number | undefined);
|
|
32
47
|
get spawnChance(): number | undefined;
|
|
33
48
|
get autoStart(): boolean | undefined;
|
|
34
|
-
set lifeTime(
|
|
49
|
+
set lifeTime(value: LifeTimeBehaviorConfig | undefined);
|
|
35
50
|
get lifeTime(): LifeTimeBehaviorConfig;
|
|
36
|
-
set
|
|
37
|
-
get speed(): NumberTimelapsesConfig | undefined;
|
|
38
|
-
set direction(config: DirectionConfig | undefined);
|
|
51
|
+
set direction(value: DirectionConfig | undefined);
|
|
39
52
|
get direction(): DirectionConfig;
|
|
40
|
-
set
|
|
41
|
-
get
|
|
42
|
-
set
|
|
53
|
+
set spawnPosition(value: SpawnPositionConfig | undefined);
|
|
54
|
+
get spawnPosition(): SpawnPositionConfig;
|
|
55
|
+
set speed(value: NumberTimelapsesConfig | undefined);
|
|
56
|
+
get speed(): NumberTimelapsesConfig | undefined;
|
|
57
|
+
set alpha(value: NumberTimelapsesConfig | undefined);
|
|
43
58
|
get alpha(): NumberTimelapsesConfig | undefined;
|
|
44
|
-
set
|
|
59
|
+
set rotation(value: NumberTimelapsesConfig | undefined);
|
|
60
|
+
get rotation(): NumberTimelapsesConfig | undefined;
|
|
61
|
+
set scale(value: NumberTimelapsesConfig | {
|
|
45
62
|
x: NumberTimelapsesConfig;
|
|
46
63
|
y: NumberTimelapsesConfig;
|
|
47
64
|
} | undefined);
|
|
@@ -49,16 +66,15 @@ export declare class ConfigManager<View extends ViewParticle> {
|
|
|
49
66
|
x: NumberTimelapsesConfig;
|
|
50
67
|
y: NumberTimelapsesConfig;
|
|
51
68
|
} | undefined;
|
|
52
|
-
set gravity(
|
|
69
|
+
set gravity(value: NumberTimelapsesConfig | undefined);
|
|
53
70
|
get gravity(): NumberTimelapsesConfig | undefined;
|
|
54
|
-
set
|
|
55
|
-
get rotation(): NumberTimelapsesConfig | undefined;
|
|
56
|
-
set spawnPosition(config: SpawnPositionConfig | undefined);
|
|
57
|
-
get spawnPosition(): SpawnPositionConfig;
|
|
58
|
-
set spawnShape(config: SpawnShapeBehavior | undefined);
|
|
59
|
-
get spawnShape(): SpawnShapeBehavior | undefined;
|
|
60
|
-
set color(config: ColorTimelapsesConfig | undefined);
|
|
71
|
+
set color(value: ColorTimelapsesConfig | undefined);
|
|
61
72
|
get color(): ColorTimelapsesConfig | undefined;
|
|
62
|
-
|
|
73
|
+
set spawnShape(value: SpawnShapeBehavior | undefined);
|
|
74
|
+
get spawnShape(): SpawnShapeBehavior | undefined;
|
|
75
|
+
set path(value: PathConfig | undefined);
|
|
76
|
+
get path(): PathConfig | undefined;
|
|
77
|
+
subscribeToViewChange(callback: () => void): () => void;
|
|
78
|
+
subscribeToScheduleChange(callback: () => void): () => void;
|
|
79
|
+
private notifyScheduleChange;
|
|
63
80
|
}
|
|
64
|
-
//# sourceMappingURL=ConfigManager.d.ts.map
|
|
@@ -1,160 +1,268 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ConfigManager = void 0;
|
|
4
|
+
const observeConfig_1 = require("../utils/observeConfig");
|
|
5
|
+
const PreparedParticleConfig_1 = require("./PreparedParticleConfig");
|
|
4
6
|
const cloneDeep_1 = require("../utils/cloneDeep");
|
|
5
7
|
const constants_1 = require("../constants");
|
|
6
|
-
const
|
|
8
|
+
const validateConfig_1 = require("./validateConfig");
|
|
7
9
|
class ConfigManager {
|
|
8
|
-
|
|
10
|
+
pathRandom;
|
|
9
11
|
config;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
viewFactory;
|
|
13
|
+
compiledPath;
|
|
14
|
+
prepared;
|
|
15
|
+
particleViews = new Map();
|
|
16
|
+
emitterViews = new Map();
|
|
17
|
+
viewObserved;
|
|
18
|
+
viewListeners = new Set();
|
|
19
|
+
scheduleListeners = new Set();
|
|
20
|
+
constructor(initialConfig, viewFactory, pathRandom = Math.random) {
|
|
21
|
+
this.pathRandom = pathRandom;
|
|
22
|
+
(0, validateConfig_1.validateEmitterConfig)(initialConfig.emitterConfig);
|
|
23
|
+
this.compiledPath = (0, validateConfig_1.validateParticleConfig)(initialConfig.particleConfig, this.pathRandom);
|
|
24
|
+
(0, validateConfig_1.validateViewFactory)(viewFactory);
|
|
13
25
|
this.config = (0, cloneDeep_1.cloneDeep)(initialConfig);
|
|
14
|
-
this.
|
|
26
|
+
this.prepared = undefined;
|
|
27
|
+
this.viewFactory = Array.isArray(viewFactory) ? [...viewFactory] : viewFactory;
|
|
15
28
|
}
|
|
16
29
|
set fullConfig(config) {
|
|
30
|
+
(0, validateConfig_1.validateEmitterConfig)(config.emitterConfig);
|
|
31
|
+
const path = (0, validateConfig_1.validateParticleConfig)(config.particleConfig, this.pathRandom);
|
|
17
32
|
this.config = (0, cloneDeep_1.cloneDeep)(config);
|
|
33
|
+
this.particleViews.clear();
|
|
34
|
+
this.emitterViews.clear();
|
|
35
|
+
this.prepared = undefined;
|
|
36
|
+
this.compiledPath = path;
|
|
37
|
+
this.notifyScheduleChange();
|
|
18
38
|
}
|
|
19
39
|
get fullConfig() {
|
|
20
40
|
return (0, cloneDeep_1.cloneDeep)(this.config);
|
|
21
41
|
}
|
|
22
42
|
set emitterConfig(config) {
|
|
43
|
+
(0, validateConfig_1.validateEmitterConfig)(config);
|
|
44
|
+
const previous = this.config.emitterConfig.spawnInterval;
|
|
23
45
|
this.config.emitterConfig = (0, cloneDeep_1.cloneDeep)(config);
|
|
46
|
+
this.emitterViews.clear();
|
|
47
|
+
if (JSON.stringify(previous) !== JSON.stringify(config.spawnInterval))
|
|
48
|
+
this.notifyScheduleChange();
|
|
24
49
|
}
|
|
25
50
|
get emitterConfig() {
|
|
26
51
|
return (0, cloneDeep_1.cloneDeep)(this.config.emitterConfig);
|
|
27
52
|
}
|
|
28
53
|
set particleConfig(config) {
|
|
54
|
+
const path = (0, validateConfig_1.validateParticleConfig)(config, this.pathRandom);
|
|
29
55
|
this.config.particleConfig = (0, cloneDeep_1.cloneDeep)(config);
|
|
56
|
+
this.particleViews.clear();
|
|
57
|
+
this.prepared = undefined;
|
|
58
|
+
this.compiledPath = path;
|
|
30
59
|
}
|
|
31
60
|
get particleConfig() {
|
|
32
61
|
return (0, cloneDeep_1.cloneDeep)(this.config.particleConfig);
|
|
33
62
|
}
|
|
34
|
-
|
|
35
|
-
return this.
|
|
63
|
+
getPreparedParticleConfig() {
|
|
64
|
+
return this.prepared ?? (this.prepared = (0, PreparedParticleConfig_1.prepareParticleConfig)(this.config.particleConfig));
|
|
36
65
|
}
|
|
37
|
-
|
|
38
|
-
this.
|
|
39
|
-
this.eventEmitter.emit('viewChanged', viewFactory);
|
|
66
|
+
get pathFunction() {
|
|
67
|
+
return this.compiledPath;
|
|
40
68
|
}
|
|
41
|
-
|
|
42
|
-
this.
|
|
69
|
+
get view() {
|
|
70
|
+
if (!Array.isArray(this.viewFactory))
|
|
71
|
+
return this.viewFactory;
|
|
72
|
+
const source = this.viewFactory;
|
|
73
|
+
if (this.viewObserved?.source === source)
|
|
74
|
+
return this.viewObserved.value;
|
|
75
|
+
const tracked = { owner: source, source, value: source };
|
|
76
|
+
tracked.value = (0, observeConfig_1.observeConfig)(source, () => {
|
|
77
|
+
(0, validateConfig_1.validateViewFactory)(source);
|
|
78
|
+
this.viewListeners.forEach((listener) => listener());
|
|
79
|
+
}, () => this.viewFactory === source && this.viewObserved === tracked);
|
|
80
|
+
this.viewObserved = tracked;
|
|
81
|
+
return tracked.value;
|
|
82
|
+
}
|
|
83
|
+
set view(factory) {
|
|
84
|
+
(0, validateConfig_1.validateViewFactory)(factory);
|
|
85
|
+
this.viewFactory = Array.isArray(factory) ? [...factory] : factory;
|
|
86
|
+
this.viewObserved = undefined;
|
|
87
|
+
this.viewListeners.forEach((listener) => listener());
|
|
88
|
+
}
|
|
89
|
+
setEmitter(key, value) {
|
|
90
|
+
const next = (0, cloneDeep_1.cloneDeep)(value);
|
|
91
|
+
const candidate = { ...this.config.emitterConfig, [key]: next };
|
|
92
|
+
(0, validateConfig_1.validateEmitterConfig)(candidate);
|
|
93
|
+
const changed = key === 'spawnInterval' && JSON.stringify(this.config.emitterConfig[key]) !== JSON.stringify(next);
|
|
94
|
+
this.config.emitterConfig[key] = next;
|
|
95
|
+
this.emitterViews.delete(key);
|
|
96
|
+
if (changed)
|
|
97
|
+
this.notifyScheduleChange();
|
|
98
|
+
}
|
|
99
|
+
setParticle(key, value) {
|
|
100
|
+
const next = (0, cloneDeep_1.cloneDeep)(value);
|
|
101
|
+
const candidate = { ...this.config.particleConfig, [key]: next };
|
|
102
|
+
const path = (0, validateConfig_1.validateParticleConfig)(candidate, this.pathRandom);
|
|
103
|
+
this.config.particleConfig[key] = next;
|
|
104
|
+
this.particleViews.delete(key);
|
|
105
|
+
this.compiledPath = path;
|
|
106
|
+
this.prepared = undefined;
|
|
107
|
+
}
|
|
108
|
+
getParticle(key, fallback) {
|
|
109
|
+
const owner = this.config.particleConfig;
|
|
110
|
+
const current = owner[key];
|
|
111
|
+
let record = this.particleViews.get(key);
|
|
112
|
+
if (record && record.owner === owner && (record.source === current || current === undefined))
|
|
113
|
+
return record.value;
|
|
114
|
+
const source = current ?? (0, cloneDeep_1.cloneDeep)(fallback);
|
|
115
|
+
if (!source || typeof source !== 'object')
|
|
116
|
+
return source;
|
|
117
|
+
const raw = source;
|
|
118
|
+
record = { owner, source: raw, value: raw };
|
|
119
|
+
const tracked = record;
|
|
120
|
+
tracked.value = (0, observeConfig_1.observeConfig)(raw, () => {
|
|
121
|
+
const candidate = { ...owner, [key]: raw };
|
|
122
|
+
const path = (0, validateConfig_1.validateParticleConfig)(candidate, this.pathRandom);
|
|
123
|
+
owner[key] = raw;
|
|
124
|
+
this.compiledPath = path;
|
|
125
|
+
this.prepared = undefined;
|
|
126
|
+
}, () => this.config.particleConfig === owner && this.particleViews.get(key) === tracked);
|
|
127
|
+
this.particleViews.set(key, tracked);
|
|
128
|
+
return tracked.value;
|
|
129
|
+
}
|
|
130
|
+
getEmitter(key) {
|
|
131
|
+
const owner = this.config.emitterConfig;
|
|
132
|
+
const source = owner[key];
|
|
133
|
+
if (!source || typeof source !== 'object')
|
|
134
|
+
return source;
|
|
135
|
+
const cached = this.emitterViews.get(key);
|
|
136
|
+
if (cached && cached.owner === owner && cached.source === source)
|
|
137
|
+
return cached.value;
|
|
138
|
+
const tracked = { owner, source, value: source };
|
|
139
|
+
tracked.value = (0, observeConfig_1.observeConfig)(source, () => {
|
|
140
|
+
(0, validateConfig_1.validateEmitterConfig)(owner);
|
|
141
|
+
if (key === 'spawnInterval')
|
|
142
|
+
this.notifyScheduleChange();
|
|
143
|
+
}, () => this.config.emitterConfig === owner && this.emitterViews.get(key) === tracked);
|
|
144
|
+
this.emitterViews.set(key, tracked);
|
|
145
|
+
return tracked.value;
|
|
146
|
+
}
|
|
147
|
+
set spawnInterval(value) {
|
|
148
|
+
this.setEmitter('spawnInterval', value);
|
|
43
149
|
}
|
|
44
150
|
get spawnInterval() {
|
|
45
|
-
return this.
|
|
151
|
+
return this.getEmitter('spawnInterval');
|
|
46
152
|
}
|
|
47
|
-
set spawnTime(
|
|
48
|
-
this.
|
|
153
|
+
set spawnTime(value) {
|
|
154
|
+
this.setEmitter('spawnTime', value);
|
|
49
155
|
}
|
|
50
156
|
get spawnTime() {
|
|
51
|
-
return this.
|
|
157
|
+
return this.getEmitter('spawnTime');
|
|
52
158
|
}
|
|
53
|
-
set spawnTimeout(
|
|
54
|
-
this.
|
|
159
|
+
set spawnTimeout(value) {
|
|
160
|
+
this.setEmitter('spawnTimeout', value);
|
|
55
161
|
}
|
|
56
162
|
get spawnTimeout() {
|
|
57
|
-
return this.
|
|
163
|
+
return this.getEmitter('spawnTimeout');
|
|
58
164
|
}
|
|
59
|
-
set spawnParticlesPerWave(
|
|
60
|
-
this.
|
|
165
|
+
set spawnParticlesPerWave(value) {
|
|
166
|
+
this.setEmitter('spawnParticlesPerWave', value);
|
|
61
167
|
}
|
|
62
168
|
get spawnParticlesPerWave() {
|
|
63
|
-
return this.
|
|
169
|
+
return this.getEmitter('spawnParticlesPerWave');
|
|
64
170
|
}
|
|
65
|
-
set maxParticles(
|
|
66
|
-
this.
|
|
171
|
+
set maxParticles(value) {
|
|
172
|
+
this.setEmitter('maxParticles', value);
|
|
67
173
|
}
|
|
68
174
|
get maxParticles() {
|
|
69
|
-
return this.
|
|
175
|
+
return this.getEmitter('maxParticles');
|
|
70
176
|
}
|
|
71
|
-
set spawnChance(
|
|
72
|
-
this.
|
|
177
|
+
set spawnChance(value) {
|
|
178
|
+
this.setEmitter('spawnChance', value);
|
|
73
179
|
}
|
|
74
180
|
get spawnChance() {
|
|
75
|
-
return this.
|
|
181
|
+
return this.getEmitter('spawnChance');
|
|
76
182
|
}
|
|
77
183
|
get autoStart() {
|
|
78
184
|
return this.config.emitterConfig.autoStart;
|
|
79
185
|
}
|
|
80
|
-
set lifeTime(
|
|
81
|
-
|
|
82
|
-
this.config.particleConfig.lifeTime = (0, cloneDeep_1.cloneDeep)(config);
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
this.config.particleConfig.lifeTime = constants_1.DEFAULT_LIFE_TIME_CONFIG;
|
|
86
|
-
}
|
|
186
|
+
set lifeTime(value) {
|
|
187
|
+
this.setParticle('lifeTime', value);
|
|
87
188
|
}
|
|
88
189
|
get lifeTime() {
|
|
89
|
-
|
|
90
|
-
return this.config.particleConfig.lifeTime;
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
return constants_1.DEFAULT_LIFE_TIME_CONFIG;
|
|
94
|
-
}
|
|
190
|
+
return this.getParticle('lifeTime', constants_1.DEFAULT_LIFE_TIME_CONFIG);
|
|
95
191
|
}
|
|
96
|
-
set
|
|
97
|
-
this.
|
|
192
|
+
set direction(value) {
|
|
193
|
+
this.setParticle('direction', value);
|
|
98
194
|
}
|
|
99
|
-
get
|
|
100
|
-
return this.
|
|
195
|
+
get direction() {
|
|
196
|
+
return this.getParticle('direction', constants_1.DEFAULT_DIRECTION_CONFIG);
|
|
101
197
|
}
|
|
102
|
-
set
|
|
103
|
-
this.
|
|
198
|
+
set spawnPosition(value) {
|
|
199
|
+
this.setParticle('spawnPosition', value);
|
|
104
200
|
}
|
|
105
|
-
get
|
|
106
|
-
return this.
|
|
201
|
+
get spawnPosition() {
|
|
202
|
+
return this.getParticle('spawnPosition', constants_1.DEFAULT_SPAWN_POSITION);
|
|
107
203
|
}
|
|
108
|
-
set
|
|
109
|
-
this.
|
|
204
|
+
set speed(value) {
|
|
205
|
+
this.setParticle('speed', value);
|
|
110
206
|
}
|
|
111
|
-
get
|
|
112
|
-
return this.
|
|
207
|
+
get speed() {
|
|
208
|
+
return this.getParticle('speed');
|
|
113
209
|
}
|
|
114
|
-
set alpha(
|
|
115
|
-
this.
|
|
210
|
+
set alpha(value) {
|
|
211
|
+
this.setParticle('alpha', value);
|
|
116
212
|
}
|
|
117
213
|
get alpha() {
|
|
118
|
-
return this.
|
|
214
|
+
return this.getParticle('alpha');
|
|
119
215
|
}
|
|
120
|
-
set
|
|
121
|
-
this.
|
|
216
|
+
set rotation(value) {
|
|
217
|
+
this.setParticle('rotation', value);
|
|
122
218
|
}
|
|
123
|
-
get
|
|
124
|
-
return this.
|
|
219
|
+
get rotation() {
|
|
220
|
+
return this.getParticle('rotation');
|
|
125
221
|
}
|
|
126
|
-
set
|
|
127
|
-
this.
|
|
222
|
+
set scale(value) {
|
|
223
|
+
this.setParticle('scale', value);
|
|
128
224
|
}
|
|
129
|
-
get
|
|
130
|
-
return this.
|
|
225
|
+
get scale() {
|
|
226
|
+
return this.getParticle('scale');
|
|
131
227
|
}
|
|
132
|
-
set
|
|
133
|
-
this.
|
|
228
|
+
set gravity(value) {
|
|
229
|
+
this.setParticle('gravity', value);
|
|
134
230
|
}
|
|
135
|
-
get
|
|
136
|
-
return this.
|
|
231
|
+
get gravity() {
|
|
232
|
+
return this.getParticle('gravity');
|
|
137
233
|
}
|
|
138
|
-
set
|
|
139
|
-
this.
|
|
234
|
+
set color(value) {
|
|
235
|
+
this.setParticle('color', value);
|
|
140
236
|
}
|
|
141
|
-
get
|
|
142
|
-
return this.
|
|
237
|
+
get color() {
|
|
238
|
+
return this.getParticle('color');
|
|
143
239
|
}
|
|
144
|
-
set spawnShape(
|
|
145
|
-
this.
|
|
240
|
+
set spawnShape(value) {
|
|
241
|
+
this.setParticle('spawnShape', value);
|
|
146
242
|
}
|
|
147
243
|
get spawnShape() {
|
|
148
|
-
return this.
|
|
244
|
+
return this.getParticle('spawnShape');
|
|
149
245
|
}
|
|
150
|
-
set
|
|
151
|
-
this.
|
|
246
|
+
set path(value) {
|
|
247
|
+
this.setParticle('path', value);
|
|
152
248
|
}
|
|
153
|
-
get
|
|
154
|
-
return this.
|
|
249
|
+
get path() {
|
|
250
|
+
return this.getParticle('path');
|
|
155
251
|
}
|
|
156
252
|
subscribeToViewChange(callback) {
|
|
157
|
-
this.
|
|
253
|
+
this.viewListeners.add(callback);
|
|
254
|
+
return () => {
|
|
255
|
+
this.viewListeners.delete(callback);
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
subscribeToScheduleChange(callback) {
|
|
259
|
+
this.scheduleListeners.add(callback);
|
|
260
|
+
return () => {
|
|
261
|
+
this.scheduleListeners.delete(callback);
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
notifyScheduleChange() {
|
|
265
|
+
this.scheduleListeners.forEach((listener) => listener());
|
|
158
266
|
}
|
|
159
267
|
}
|
|
160
268
|
exports.ConfigManager = ConfigManager;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigManager.js","sourceRoot":"","sources":["../../src/core/ConfigManager.ts"],"names":[],"mappings":";;;AAaA,kDAA6C;AAC7C,4CAAwG;AAExG,wDAAmD;AAGnD,MAAa,aAAa;IAIkC;IAHlD,MAAM,CAAwB;IAC9B,YAAY,CAAe;IAEnC,YAAY,aAAoC,EAAU,WAA8B;QAA9B,gBAAW,GAAX,WAAW,CAAmB;QACtF,IAAI,CAAC,MAAM,GAAG,IAAA,qBAAS,EAAC,aAAa,CAAC,CAAC;QACvC,IAAI,CAAC,YAAY,GAAG,IAAI,2BAAY,EAAE,CAAC;IACzC,CAAC;IAED,IAAI,UAAU,CAAC,MAA6B;QAC1C,IAAI,CAAC,MAAM,GAAG,IAAA,qBAAS,EAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAA,qBAAS,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IAED,IAAI,aAAa,CAAC,MAAqB;QACrC,IAAI,CAAC,MAAM,CAAC,aAAa,GAAG,IAAA,qBAAS,EAAC,MAAM,CAAC,CAAC;IAChD,CAAC;IAED,IAAI,aAAa;QACf,OAAO,IAAA,qBAAS,EAAC,IAAI,CAAC,MAAM,CAAC,a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C,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC3D,CAAC;CACF;AAhSD,sCAgSC","sourcesContent":["import {observeConfig} from '../utils/observeConfig';\nimport {RandomSource} from '../utils/random/random.types';\nimport {prepareParticleConfig, PreparedParticleConfig} from './PreparedParticleConfig';\nimport {EmitterConfig, RandomRange, ParticleConfig, ParticleEmitterConfig, ViewFactory, ViewParticle} from '../types';\nimport {LifeTimeBehaviorConfig} from './behaviors/life-time-behavior/life-time-behavior.types';\nimport {DirectionConfig} from './behaviors/direction/direction.types';\nimport {SpawnPositionConfig} from './spawn-position/spawn-position.types';\nimport {SpawnShapeBehavior} from './spawn-shapes/spawn-shapes.types';\nimport {cloneDeep} from '../utils/cloneDeep';\nimport {DEFAULT_LIFE_TIME_CONFIG, DEFAULT_DIRECTION_CONFIG, DEFAULT_SPAWN_POSITION} from '../constants';\nimport {PathConfig, PathFunction} from './behaviors/path/path.types';\nimport {ColorTimelapsesConfig, NumberTimelapsesConfig} from './behaviors/particle-value/timelapses.types';\nimport {validateEmitterConfig, validateParticleConfig, validateViewFactory} from './validateConfig';\n\ninterface ObservedConfig {\n owner: object;\n source: object;\n value: object;\n}\n\nexport class ConfigManager<View extends ViewParticle> {\n private config: ParticleEmitterConfig;\n private viewFactory: ViewFactory<View>;\n private compiledPath: PathFunction | null;\n private prepared?: PreparedParticleConfig;\n private particleViews = new Map<keyof ParticleConfig, ObservedConfig>();\n private emitterViews = new Map<keyof EmitterConfig, ObservedConfig>();\n private viewObserved?: ObservedConfig;\n private viewListeners = new Set<() => void>();\n private scheduleListeners = new Set<() => void>();\n\n constructor(\n initialConfig: ParticleEmitterConfig,\n viewFactory: ViewFactory<View>,\n private readonly pathRandom: RandomSource = Math.random,\n ) {\n validateEmitterConfig(initialConfig.emitterConfig);\n this.compiledPath = validateParticleConfig(initialConfig.particleConfig, this.pathRandom);\n validateViewFactory(viewFactory);\n this.config = cloneDeep(initialConfig);\n this.prepared = undefined;\n this.viewFactory = Array.isArray(viewFactory) ? [...viewFactory] : viewFactory;\n }\n\n set fullConfig(config: ParticleEmitterConfig) {\n validateEmitterConfig(config.emitterConfig);\n const path = validateParticleConfig(config.particleConfig, this.pathRandom);\n this.config = cloneDeep(config);\n this.particleViews.clear();\n this.emitterViews.clear();\n this.prepared = undefined;\n this.compiledPath = path;\n this.notifyScheduleChange();\n }\n get fullConfig(): ParticleEmitterConfig {\n return cloneDeep(this.config);\n }\n set emitterConfig(config: EmitterConfig) {\n validateEmitterConfig(config);\n const previous = this.config.emitterConfig.spawnInterval;\n this.config.emitterConfig = cloneDeep(config);\n this.emitterViews.clear();\n if (JSON.stringify(previous) !== JSON.stringify(config.spawnInterval)) this.notifyScheduleChange();\n }\n get emitterConfig(): EmitterConfig {\n return cloneDeep(this.config.emitterConfig);\n }\n set particleConfig(config: ParticleConfig) {\n const path = validateParticleConfig(config, this.pathRandom);\n this.config.particleConfig = cloneDeep(config);\n this.particleViews.clear();\n this.prepared = undefined;\n this.compiledPath = path;\n }\n get particleConfig(): ParticleConfig {\n return cloneDeep(this.config.particleConfig);\n }\n /** @internal Immutable template for initialization; public snapshots remain independent. */\n public getPreparedParticleConfig(): PreparedParticleConfig {\n return this.prepared ?? (this.prepared = prepareParticleConfig(this.config.particleConfig));\n }\n\n get pathFunction(): PathFunction | null {\n return this.compiledPath;\n }\n\n get view(): ViewFactory<View> {\n if (!Array.isArray(this.viewFactory)) return this.viewFactory;\n const source = this.viewFactory;\n if (this.viewObserved?.source === source) return this.viewObserved.value as ViewFactory<View>;\n const tracked: ObservedConfig = {owner: source, source, value: source};\n tracked.value = observeConfig(\n source,\n () => {\n validateViewFactory(source);\n this.viewListeners.forEach((listener) => listener());\n },\n () => this.viewFactory === source && this.viewObserved === tracked,\n );\n this.viewObserved = tracked;\n return tracked.value as ViewFactory<View>;\n }\n set view(factory: ViewFactory<View>) {\n validateViewFactory(factory);\n this.viewFactory = Array.isArray(factory) ? [...factory] : factory;\n this.viewObserved = undefined;\n this.viewListeners.forEach((listener) => listener());\n }\n\n private setEmitter<K extends keyof EmitterConfig>(key: K, value: EmitterConfig[K]): void {\n const next = cloneDeep(value);\n const candidate = {...this.config.emitterConfig, [key]: next};\n validateEmitterConfig(candidate);\n const changed = key === 'spawnInterval' && JSON.stringify(this.config.emitterConfig[key]) !== JSON.stringify(next);\n this.config.emitterConfig[key] = next;\n this.emitterViews.delete(key);\n if (changed) this.notifyScheduleChange();\n }\n private setParticle<K extends keyof ParticleConfig>(key: K, value: ParticleConfig[K]): void {\n const next = cloneDeep(value);\n const candidate = {...this.config.particleConfig, [key]: next};\n const path = validateParticleConfig(candidate, this.pathRandom);\n this.config.particleConfig[key] = next;\n this.particleViews.delete(key);\n this.compiledPath = path;\n this.prepared = undefined;\n }\n private getParticle<K extends keyof ParticleConfig>(key: K, fallback?: ParticleConfig[K]): ParticleConfig[K] {\n const owner = this.config.particleConfig;\n const current = owner[key];\n let record = this.particleViews.get(key);\n if (record && record.owner === owner && (record.source === current || current === undefined))\n return record.value as ParticleConfig[K];\n const source = current ?? cloneDeep(fallback);\n if (!source || typeof source !== 'object') return source;\n const raw = source;\n record = {owner, source: raw, value: raw};\n const tracked = record;\n tracked.value = observeConfig(\n raw,\n () => {\n const candidate = {...owner, [key]: raw};\n const path = validateParticleConfig(candidate, this.pathRandom);\n owner[key] = raw;\n this.compiledPath = path;\n this.prepared = undefined;\n },\n () => this.config.particleConfig === owner && this.particleViews.get(key) === tracked,\n );\n this.particleViews.set(key, tracked);\n return tracked.value as ParticleConfig[K];\n }\n private getEmitter<K extends keyof EmitterConfig>(key: K): EmitterConfig[K] {\n const owner = this.config.emitterConfig;\n const source = owner[key];\n if (!source || typeof source !== 'object') return source;\n const cached = this.emitterViews.get(key);\n if (cached && cached.owner === owner && cached.source === source) return cached.value as EmitterConfig[K];\n const tracked: ObservedConfig = {owner, source, value: source};\n tracked.value = observeConfig(\n source,\n () => {\n validateEmitterConfig(owner);\n if (key === 'spawnInterval') this.notifyScheduleChange();\n },\n () => this.config.emitterConfig === owner && this.emitterViews.get(key) === tracked,\n );\n this.emitterViews.set(key, tracked);\n return tracked.value as EmitterConfig[K];\n }\n\n set spawnInterval(value: number | RandomRange | undefined) {\n this.setEmitter('spawnInterval', value);\n }\n get spawnInterval(): number | RandomRange | undefined {\n return this.getEmitter('spawnInterval');\n }\n\n set spawnTime(value: number | undefined) {\n this.setEmitter('spawnTime', value);\n }\n get spawnTime(): number | undefined {\n return this.getEmitter('spawnTime');\n }\n\n set spawnTimeout(value: number | undefined) {\n this.setEmitter('spawnTimeout', value);\n }\n get spawnTimeout(): number | undefined {\n return this.getEmitter('spawnTimeout');\n }\n\n set spawnParticlesPerWave(value: number | undefined) {\n this.setEmitter('spawnParticlesPerWave', value);\n }\n get spawnParticlesPerWave(): number | undefined {\n return this.getEmitter('spawnParticlesPerWave');\n }\n\n set maxParticles(value: number | undefined) {\n this.setEmitter('maxParticles', value);\n }\n get maxParticles(): number | undefined {\n return this.getEmitter('maxParticles');\n }\n\n set spawnChance(value: number | undefined) {\n this.setEmitter('spawnChance', value);\n }\n get spawnChance(): number | undefined {\n return this.getEmitter('spawnChance');\n }\n get autoStart(): boolean | undefined {\n return this.config.emitterConfig.autoStart;\n }\n\n set lifeTime(value: LifeTimeBehaviorConfig | undefined) {\n this.setParticle('lifeTime', value);\n }\n get lifeTime(): LifeTimeBehaviorConfig {\n return this.getParticle('lifeTime', DEFAULT_LIFE_TIME_CONFIG)!;\n }\n\n set direction(value: DirectionConfig | undefined) {\n this.setParticle('direction', value);\n }\n get direction(): DirectionConfig {\n return this.getParticle('direction', DEFAULT_DIRECTION_CONFIG)!;\n }\n\n set spawnPosition(value: SpawnPositionConfig | undefined) {\n this.setParticle('spawnPosition', value);\n }\n get spawnPosition(): SpawnPositionConfig {\n return this.getParticle('spawnPosition', DEFAULT_SPAWN_POSITION)!;\n }\n\n set speed(value: NumberTimelapsesConfig | undefined) {\n this.setParticle('speed', value);\n }\n get speed(): NumberTimelapsesConfig | undefined {\n return this.getParticle('speed');\n }\n\n set alpha(value: NumberTimelapsesConfig | undefined) {\n this.setParticle('alpha', value);\n }\n get alpha(): NumberTimelapsesConfig | undefined {\n return this.getParticle('alpha');\n }\n\n set rotation(value: NumberTimelapsesConfig | undefined) {\n this.setParticle('rotation', value);\n }\n get rotation(): NumberTimelapsesConfig | undefined {\n return this.getParticle('rotation');\n }\n\n set scale(value: NumberTimelapsesConfig | {x: NumberTimelapsesConfig; y: NumberTimelapsesConfig} | undefined) {\n this.setParticle('scale', value);\n }\n get scale(): NumberTimelapsesConfig | {x: NumberTimelapsesConfig; y: NumberTimelapsesConfig} | undefined {\n return this.getParticle('scale');\n }\n\n set gravity(value: NumberTimelapsesConfig | undefined) {\n this.setParticle('gravity', value);\n }\n get gravity(): NumberTimelapsesConfig | undefined {\n return this.getParticle('gravity');\n }\n\n set color(value: ColorTimelapsesConfig | undefined) {\n this.setParticle('color', value);\n }\n get color(): ColorTimelapsesConfig | undefined {\n return this.getParticle('color');\n }\n\n set spawnShape(value: SpawnShapeBehavior | undefined) {\n this.setParticle('spawnShape', value);\n }\n get spawnShape(): SpawnShapeBehavior | undefined {\n return this.getParticle('spawnShape');\n }\n\n set path(value: PathConfig | undefined) {\n this.setParticle('path', value);\n }\n get path(): PathConfig | undefined {\n return this.getParticle('path');\n }\n\n public subscribeToViewChange(callback: () => void): () => void {\n this.viewListeners.add(callback);\n return () => {\n this.viewListeners.delete(callback);\n };\n }\n public subscribeToScheduleChange(callback: () => void): () => void {\n this.scheduleListeners.add(callback);\n return () => {\n this.scheduleListeners.delete(callback);\n };\n }\n private notifyScheduleChange(): void {\n this.scheduleListeners.forEach((listener) => listener());\n }\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare class FrameCapacity {
|
|
2
|
+
private readonly limit;
|
|
3
|
+
private frameEnd;
|
|
4
|
+
private occupied;
|
|
5
|
+
private readonly deaths;
|
|
6
|
+
constructor(limit: number, frameEnd?: number);
|
|
7
|
+
beginFrame(end: number): void;
|
|
8
|
+
addImmortal(): void;
|
|
9
|
+
add(death: number): void;
|
|
10
|
+
availableAt(time: number): number;
|
|
11
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FrameCapacity = void 0;
|
|
4
|
+
const time_1 = require("../utils/time");
|
|
5
|
+
class FrameCapacity {
|
|
6
|
+
limit;
|
|
7
|
+
frameEnd;
|
|
8
|
+
occupied = 0;
|
|
9
|
+
deaths = [];
|
|
10
|
+
constructor(limit, frameEnd = Infinity) {
|
|
11
|
+
this.limit = limit;
|
|
12
|
+
this.frameEnd = frameEnd;
|
|
13
|
+
}
|
|
14
|
+
beginFrame(end) {
|
|
15
|
+
this.frameEnd = end;
|
|
16
|
+
}
|
|
17
|
+
addImmortal() {
|
|
18
|
+
this.occupied++;
|
|
19
|
+
}
|
|
20
|
+
add(death) {
|
|
21
|
+
this.occupied++;
|
|
22
|
+
if (!(0, time_1.atOrBefore)(death, this.frameEnd))
|
|
23
|
+
return;
|
|
24
|
+
let index = this.deaths.length;
|
|
25
|
+
this.deaths.push(death);
|
|
26
|
+
while (index > 0) {
|
|
27
|
+
const parent = (index - 1) >>> 1;
|
|
28
|
+
if (this.deaths[parent] <= death)
|
|
29
|
+
break;
|
|
30
|
+
this.deaths[index] = this.deaths[parent];
|
|
31
|
+
index = parent;
|
|
32
|
+
}
|
|
33
|
+
this.deaths[index] = death;
|
|
34
|
+
}
|
|
35
|
+
availableAt(time) {
|
|
36
|
+
while (this.deaths.length > 0 && (0, time_1.atOrBefore)(this.deaths[0], time)) {
|
|
37
|
+
this.occupied--;
|
|
38
|
+
const tail = this.deaths.pop();
|
|
39
|
+
if (this.deaths.length === 0)
|
|
40
|
+
break;
|
|
41
|
+
let index = 0;
|
|
42
|
+
while (index * 2 + 1 < this.deaths.length) {
|
|
43
|
+
let child = index * 2 + 1;
|
|
44
|
+
if (child + 1 < this.deaths.length && this.deaths[child + 1] < this.deaths[child])
|
|
45
|
+
child++;
|
|
46
|
+
if (this.deaths[child] >= tail)
|
|
47
|
+
break;
|
|
48
|
+
this.deaths[index] = this.deaths[child];
|
|
49
|
+
index = child;
|
|
50
|
+
}
|
|
51
|
+
this.deaths[index] = tail;
|
|
52
|
+
}
|
|
53
|
+
return Math.max(0, this.limit - this.occupied);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.FrameCapacity = FrameCapacity;
|
|
57
|
+
//# sourceMappingURL=FrameCapacity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FrameCapacity.js","sourceRoot":"","sources":["../../src/core/FrameCapacity.ts"],"names":[],"mappings":";;;AAAA,wCAAyC;AAGzC,MAAa,aAAa;IAGK;IAAuB;IAF5C,QAAQ,GAAG,CAAC,CAAC;IACJ,MAAM,GAAa,EAAE,CAAC;IACvC,YAA6B,KAAa,EAAU,WAAW,QAAQ;QAA1C,UAAK,GAAL,KAAK,CAAQ;QAAU,aAAQ,GAAR,QAAQ,CAAW;IAAG,CAAC;IAEpE,UAAU,CAAC,GAAW;QAC3B,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC;IACtB,CAAC;IAEM,WAAW;QAChB,IAAI,CAAC,QAAQ,EAAE,CAAC;IAClB,CAAC;IAEM,GAAG,CAAC,KAAa;QACtB,IAAI,CAAC,QAAQ,EAAE,CAAC;QAChB,IAAI,CAAC,IAAA,iBAAU,EAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC;YAAE,OAAO;QAC9C,IAAI,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QAC/B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACxB,OAAO,KAAK,GAAG,CAAC,EAAE;YAChB,MAAM,MAAM,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC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AI,CAAC;SAC3B;QACD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC;CACF;AA5CD,sCA4CC","sourcesContent":["import {atOrBefore} from '../utils/time';\n\n/** Occupancy at birth timestamps, independent of end-of-frame rendering state. */\nexport class FrameCapacity {\n private occupied = 0;\n private readonly deaths: number[] = [];\n constructor(private readonly limit: number, private frameEnd = Infinity) {}\n\n public beginFrame(end: number): void {\n this.frameEnd = end;\n }\n\n public addImmortal(): void {\n this.occupied++;\n }\n\n public add(death: number): void {\n this.occupied++;\n if (!atOrBefore(death, this.frameEnd)) return;\n let index = this.deaths.length;\n this.deaths.push(death);\n while (index > 0) {\n const parent = (index - 1) >>> 1;\n if (this.deaths[parent] <= death) break;\n this.deaths[index] = this.deaths[parent];\n index = parent;\n }\n this.deaths[index] = death;\n }\n\n public availableAt(time: number): number {\n while (this.deaths.length > 0 && atOrBefore(this.deaths[0], time)) {\n this.occupied--;\n const tail = this.deaths.pop()!;\n if (this.deaths.length === 0) break;\n let index = 0;\n while (index * 2 + 1 < this.deaths.length) {\n let child = index * 2 + 1;\n if (child + 1 < this.deaths.length && this.deaths[child + 1] < this.deaths[child]) child++;\n if (this.deaths[child] >= tail) break;\n this.deaths[index] = this.deaths[child];\n index = child;\n }\n this.deaths[index] = tail;\n }\n return Math.max(0, this.limit - this.occupied);\n }\n}\n"]}
|