custom-pixi-particles 7.1.1 → 7.2.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/dist/index.d.ts +15 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/Model.d.ts +32 -0
- package/dist/lib/Model.js +44 -0
- package/dist/lib/Model.js.map +1 -0
- package/dist/lib/Particle.d.ts +234 -0
- package/dist/lib/Particle.js +201 -0
- package/dist/lib/Particle.js.map +1 -0
- package/dist/lib/ParticlePool.d.ts +37 -0
- package/dist/lib/ParticlePool.js +56 -0
- package/dist/lib/ParticlePool.js.map +1 -0
- package/dist/lib/behaviour/AngularVelocityBehaviour.d.ts +61 -0
- package/dist/lib/behaviour/AngularVelocityBehaviour.js +118 -0
- package/dist/lib/behaviour/AngularVelocityBehaviour.js.map +1 -0
- package/dist/lib/behaviour/AttractionRepulsionBehaviour.d.ts +42 -0
- package/dist/lib/behaviour/AttractionRepulsionBehaviour.js +78 -0
- package/dist/lib/behaviour/AttractionRepulsionBehaviour.js.map +1 -0
- package/dist/lib/behaviour/Behaviour.d.ts +33 -0
- package/dist/lib/behaviour/Behaviour.js +45 -0
- package/dist/lib/behaviour/Behaviour.js.map +1 -0
- package/dist/lib/behaviour/BehaviourNames.d.ts +22 -0
- package/dist/lib/behaviour/BehaviourNames.js +23 -0
- package/dist/lib/behaviour/BehaviourNames.js.map +1 -0
- package/dist/lib/behaviour/CollisionBehaviour.d.ts +81 -0
- package/dist/lib/behaviour/CollisionBehaviour.js +136 -0
- package/dist/lib/behaviour/CollisionBehaviour.js.map +1 -0
- package/dist/lib/behaviour/ColorBehaviour.d.ts +67 -0
- package/dist/lib/behaviour/ColorBehaviour.js +209 -0
- package/dist/lib/behaviour/ColorBehaviour.js.map +1 -0
- package/dist/lib/behaviour/EmitDirectionBehaviour.d.ts +52 -0
- package/dist/lib/behaviour/EmitDirectionBehaviour.js +105 -0
- package/dist/lib/behaviour/EmitDirectionBehaviour.js.map +1 -0
- package/dist/lib/behaviour/EmitterBehaviours.d.ts +69 -0
- package/dist/lib/behaviour/EmitterBehaviours.js +116 -0
- package/dist/lib/behaviour/EmitterBehaviours.js.map +1 -0
- package/dist/lib/behaviour/ForceFieldsBehaviour.d.ts +53 -0
- package/dist/lib/behaviour/ForceFieldsBehaviour.js +80 -0
- package/dist/lib/behaviour/ForceFieldsBehaviour.js.map +1 -0
- package/dist/lib/behaviour/GroupingBehaviour.d.ts +57 -0
- package/dist/lib/behaviour/GroupingBehaviour.js +143 -0
- package/dist/lib/behaviour/GroupingBehaviour.js.map +1 -0
- package/dist/lib/behaviour/LifeBehaviour.d.ts +47 -0
- package/dist/lib/behaviour/LifeBehaviour.js +65 -0
- package/dist/lib/behaviour/LifeBehaviour.js.map +1 -0
- package/dist/lib/behaviour/LightEffectBehaviour.d.ts +59 -0
- package/dist/lib/behaviour/LightEffectBehaviour.js +94 -0
- package/dist/lib/behaviour/LightEffectBehaviour.js.map +1 -0
- package/dist/lib/behaviour/NoiseBasedMotionBehaviour.d.ts +28 -0
- package/dist/lib/behaviour/NoiseBasedMotionBehaviour.js +50 -0
- package/dist/lib/behaviour/NoiseBasedMotionBehaviour.js.map +1 -0
- package/dist/lib/behaviour/PositionBehaviour.d.ts +164 -0
- package/dist/lib/behaviour/PositionBehaviour.js +484 -0
- package/dist/lib/behaviour/PositionBehaviour.js.map +1 -0
- package/dist/lib/behaviour/RotationBehaviour.d.ts +59 -0
- package/dist/lib/behaviour/RotationBehaviour.js +100 -0
- package/dist/lib/behaviour/RotationBehaviour.js.map +1 -0
- package/dist/lib/behaviour/SizeBehaviour.d.ts +61 -0
- package/dist/lib/behaviour/SizeBehaviour.js +156 -0
- package/dist/lib/behaviour/SizeBehaviour.js.map +1 -0
- package/dist/lib/behaviour/SoundReactiveBehaviour.d.ts +58 -0
- package/dist/lib/behaviour/SoundReactiveBehaviour.js +132 -0
- package/dist/lib/behaviour/SoundReactiveBehaviour.js.map +1 -0
- package/dist/lib/behaviour/SpawnBehaviour.d.ts +89 -0
- package/dist/lib/behaviour/SpawnBehaviour.js +705 -0
- package/dist/lib/behaviour/SpawnBehaviour.js.map +1 -0
- package/dist/lib/behaviour/StretchBehaviour.d.ts +30 -0
- package/dist/lib/behaviour/StretchBehaviour.js +59 -0
- package/dist/lib/behaviour/StretchBehaviour.js.map +1 -0
- package/dist/lib/behaviour/TemperatureBehaviour.d.ts +47 -0
- package/dist/lib/behaviour/TemperatureBehaviour.js +64 -0
- package/dist/lib/behaviour/TemperatureBehaviour.js.map +1 -0
- package/dist/lib/behaviour/TimelineBehaviour.d.ts +73 -0
- package/dist/lib/behaviour/TimelineBehaviour.js +100 -0
- package/dist/lib/behaviour/TimelineBehaviour.js.map +1 -0
- package/dist/lib/behaviour/TurbulenceBehaviour.d.ts +73 -0
- package/dist/lib/behaviour/TurbulenceBehaviour.js +133 -0
- package/dist/lib/behaviour/TurbulenceBehaviour.js.map +1 -0
- package/dist/lib/behaviour/index.d.ts +23 -0
- package/dist/lib/behaviour/index.js +24 -0
- package/dist/lib/behaviour/index.js.map +1 -0
- package/dist/lib/customPixiParticlesSettingsInterface.d.ts +19 -0
- package/dist/lib/customPixiParticlesSettingsInterface.js +2 -0
- package/dist/lib/customPixiParticlesSettingsInterface.js.map +1 -0
- package/dist/lib/emission/AbstractEmission.d.ts +30 -0
- package/dist/lib/emission/AbstractEmission.js +39 -0
- package/dist/lib/emission/AbstractEmission.js.map +1 -0
- package/dist/lib/emission/EmissionTypes.d.ts +6 -0
- package/dist/lib/emission/EmissionTypes.js +6 -0
- package/dist/lib/emission/EmissionTypes.js.map +1 -0
- package/dist/lib/emission/RandomEmission.d.ts +44 -0
- package/dist/lib/emission/RandomEmission.js +66 -0
- package/dist/lib/emission/RandomEmission.js.map +1 -0
- package/dist/lib/emission/StandardEmission.d.ts +62 -0
- package/dist/lib/emission/StandardEmission.js +87 -0
- package/dist/lib/emission/StandardEmission.js.map +1 -0
- package/dist/lib/emission/UniformEmission.d.ts +56 -0
- package/dist/lib/emission/UniformEmission.js +83 -0
- package/dist/lib/emission/UniformEmission.js.map +1 -0
- package/dist/lib/emission/index.d.ts +6 -0
- package/dist/lib/emission/index.js +7 -0
- package/dist/lib/emission/index.js.map +1 -0
- package/dist/lib/emitter/Duration.d.ts +27 -0
- package/dist/lib/emitter/Duration.js +41 -0
- package/dist/lib/emitter/Duration.js.map +1 -0
- package/dist/lib/emitter/Emitter.d.ts +116 -0
- package/dist/lib/emitter/Emitter.js +240 -0
- package/dist/lib/emitter/Emitter.js.map +1 -0
- package/dist/lib/emitter/index.d.ts +3 -0
- package/dist/lib/emitter/index.js +4 -0
- package/dist/lib/emitter/index.js.map +1 -0
- package/dist/lib/index.d.ts +20 -0
- package/dist/lib/index.js +21 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/parser/BehaviourParser.d.ts +21 -0
- package/dist/lib/parser/BehaviourParser.js +72 -0
- package/dist/lib/parser/BehaviourParser.js.map +1 -0
- package/dist/lib/parser/CompatibilityHelper.d.ts +12 -0
- package/dist/lib/parser/CompatibilityHelper.js +19 -0
- package/dist/lib/parser/CompatibilityHelper.js.map +1 -0
- package/dist/lib/parser/EmitControllerParser.d.ts +27 -0
- package/dist/lib/parser/EmitControllerParser.js +39 -0
- package/dist/lib/parser/EmitControllerParser.js.map +1 -0
- package/dist/lib/parser/EmitterParser.d.ts +67 -0
- package/dist/lib/parser/EmitterParser.js +168 -0
- package/dist/lib/parser/EmitterParser.js.map +1 -0
- package/dist/lib/parser/index.d.ts +5 -0
- package/dist/lib/parser/index.js +6 -0
- package/dist/lib/parser/index.js.map +1 -0
- package/dist/lib/pixi/Renderer.d.ts +125 -0
- package/dist/lib/pixi/Renderer.js +566 -0
- package/dist/lib/pixi/Renderer.js.map +1 -0
- package/dist/lib/pixi/TestRenderer.d.ts +125 -0
- package/dist/lib/pixi/TestRenderer.js +560 -0
- package/dist/lib/pixi/TestRenderer.js.map +1 -0
- package/dist/lib/util/Color.d.ts +133 -0
- package/dist/lib/util/Color.js +173 -0
- package/dist/lib/util/Color.js.map +1 -0
- package/dist/lib/util/List.d.ts +49 -0
- package/dist/lib/util/List.js +87 -0
- package/dist/lib/util/List.js.map +1 -0
- package/dist/lib/util/MinMax.d.ts +34 -0
- package/dist/lib/util/MinMax.js +46 -0
- package/dist/lib/util/MinMax.js.map +1 -0
- package/dist/lib/util/Point.d.ts +34 -0
- package/dist/lib/util/Point.js +46 -0
- package/dist/lib/util/Point.js.map +1 -0
- package/dist/lib/util/Random.d.ts +24 -0
- package/dist/lib/util/Random.js +30 -0
- package/dist/lib/util/Random.js.map +1 -0
- package/dist/lib/util/ThereBack.d.ts +14 -0
- package/dist/lib/util/ThereBack.js +23 -0
- package/dist/lib/util/ThereBack.js.map +1 -0
- package/dist/lib/util/index.d.ts +5 -0
- package/dist/lib/util/index.js +6 -0
- package/dist/lib/util/index.js.map +1 -0
- package/dist/lib/util/maths.d.ts +10 -0
- package/dist/lib/util/maths.js +13 -0
- package/dist/lib/util/maths.js.map +1 -0
- package/dist/lib/util/turbulencePool.d.ts +4 -0
- package/dist/lib/util/turbulencePool.js +7 -0
- package/dist/lib/util/turbulencePool.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { AbstractEmission, EmissionTypes } from './index';
|
|
2
|
+
/**
|
|
3
|
+
* UniformEmission class is the implementation of the abstract class AbstractEmission.
|
|
4
|
+
* It implements the method howMany and has other methods to set and get the related data.
|
|
5
|
+
*
|
|
6
|
+
* @class UniformEmission
|
|
7
|
+
* @extends AbstractEmission
|
|
8
|
+
*/
|
|
9
|
+
export default class UniformEmission extends AbstractEmission {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this._maxParticles = 0;
|
|
13
|
+
this._maxLife = 1;
|
|
14
|
+
this._emitPerSecond = 0;
|
|
15
|
+
this._frames = 0;
|
|
16
|
+
/**
|
|
17
|
+
* Returns EmissionTypes.DEFAULT.
|
|
18
|
+
*
|
|
19
|
+
* @returns {string} EmissionTypes.DEFAULT.
|
|
20
|
+
*/
|
|
21
|
+
this.getName = () => {
|
|
22
|
+
return EmissionTypes.DEFAULT;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Calculates the number of particles to emit.
|
|
27
|
+
*
|
|
28
|
+
* @param {number} deltaTime - The elapsed time between frames.
|
|
29
|
+
* @param {number} particlesCount - The current number of particles on the screen.
|
|
30
|
+
* @returns {number} The number of particles to emit in the current frame.
|
|
31
|
+
*/
|
|
32
|
+
howMany(deltaTime, particlesCount) {
|
|
33
|
+
const ratio = this._emitPerSecond * deltaTime;
|
|
34
|
+
this._frames += ratio;
|
|
35
|
+
let numberToEmit = 0;
|
|
36
|
+
if (this._frames >= 1.0) {
|
|
37
|
+
numberToEmit = Math.round(this._frames);
|
|
38
|
+
this._frames = 0;
|
|
39
|
+
}
|
|
40
|
+
return numberToEmit;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Recalculates the emitPerSecond value based on the maxParticles and maxLife values.
|
|
44
|
+
*/
|
|
45
|
+
refresh() {
|
|
46
|
+
this.emitPerSecond = this._maxParticles / this._maxLife;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Sets the maxLife value and calls refresh() to recalculate the emitPerSecond.
|
|
50
|
+
*
|
|
51
|
+
* @param {number} value - The new maxLife value.
|
|
52
|
+
*/
|
|
53
|
+
set maxLife(value) {
|
|
54
|
+
this._maxLife = Math.max(value, 1);
|
|
55
|
+
this.refresh();
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Sets the maxParticles value and calls refresh() to recalculate the emitPerSecond.
|
|
59
|
+
*
|
|
60
|
+
* @param {number} value - The new maxParticles value.
|
|
61
|
+
*/
|
|
62
|
+
set maxParticles(value) {
|
|
63
|
+
this._maxParticles = Math.max(value, 0);
|
|
64
|
+
this.refresh();
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Returns the emitPerSecond value.
|
|
68
|
+
*
|
|
69
|
+
* @returns {number} The emitPerSecond value.
|
|
70
|
+
*/
|
|
71
|
+
get emitPerSecond() {
|
|
72
|
+
return this._emitPerSecond;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Sets the emitPerSecond value.
|
|
76
|
+
*
|
|
77
|
+
* @param {number} value - The new emitPerSecond value.
|
|
78
|
+
*/
|
|
79
|
+
set emitPerSecond(value) {
|
|
80
|
+
this._emitPerSecond = Math.max(value, 0);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=UniformEmission.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UniformEmission.js","sourceRoot":"","sources":["../../../src/lib/emission/UniformEmission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEzD;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,gBAAgB;IAA7D;;QACE,kBAAa,GAAG,CAAC,CAAA;QACjB,aAAQ,GAAG,CAAC,CAAA;QACZ,mBAAc,GAAG,CAAC,CAAA;QAClB,YAAO,GAAG,CAAC,CAAA;QAmEX;;;;WAIG;QACH,YAAO,GAAG,GAAG,EAAE;YACb,OAAO,aAAa,CAAC,OAAO,CAAA;QAC9B,CAAC,CAAA;IACH,CAAC;IAzEC;;;;;;OAMG;IACH,OAAO,CAAC,SAAiB,EAAE,cAAsB;QAC/C,MAAM,KAAK,GAAG,IAAI,CAAC,cAAc,GAAG,SAAS,CAAA;QAC7C,IAAI,CAAC,OAAO,IAAI,KAAK,CAAA;QAErB,IAAI,YAAY,GAAG,CAAC,CAAA;QACpB,IAAI,IAAI,CAAC,OAAO,IAAI,GAAG,EAAE,CAAC;YACxB,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YACvC,IAAI,CAAC,OAAO,GAAG,CAAC,CAAA;QAClB,CAAC;QAED,OAAO,YAAY,CAAA;IACrB,CAAC;IAED;;OAEG;IACH,OAAO;QACL,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,QAAQ,CAAA;IACzD,CAAC;IAED;;;;OAIG;IACH,IAAI,OAAO,CAAC,KAAa;QACvB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;QAClC,IAAI,CAAC,OAAO,EAAE,CAAA;IAChB,CAAC;IAED;;;;OAIG;IACH,IAAI,YAAY,CAAC,KAAa;QAC5B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;QACvC,IAAI,CAAC,OAAO,EAAE,CAAA;IAChB,CAAC;IAED;;;;OAIG;IACH,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,cAAc,CAAA;IAC5B,CAAC;IAED;;;;OAIG;IACH,IAAI,aAAa,CAAC,KAAa;QAC7B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;IAC1C,CAAC;CAUF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import EmissionTypes from './EmissionTypes';
|
|
2
|
+
import AbstractEmission from './AbstractEmission';
|
|
3
|
+
import UniformEmission from './UniformEmission';
|
|
4
|
+
import RandomEmission from './RandomEmission';
|
|
5
|
+
import StandardEmission from './StandardEmission';
|
|
6
|
+
export { EmissionTypes, AbstractEmission, UniformEmission, RandomEmission, StandardEmission };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import EmissionTypes from './EmissionTypes';
|
|
2
|
+
import AbstractEmission from './AbstractEmission';
|
|
3
|
+
import UniformEmission from './UniformEmission';
|
|
4
|
+
import RandomEmission from './RandomEmission';
|
|
5
|
+
import StandardEmission from './StandardEmission';
|
|
6
|
+
export { EmissionTypes, AbstractEmission, UniformEmission, RandomEmission, StandardEmission };
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/emission/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAC3C,OAAO,gBAAgB,MAAM,oBAAoB,CAAA;AACjD,OAAO,eAAe,MAAM,mBAAmB,CAAA;AAC/C,OAAO,cAAc,MAAM,kBAAkB,CAAA;AAC7C,OAAO,gBAAgB,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export default class Duration {
|
|
2
|
+
maxTime: number;
|
|
3
|
+
private _stop;
|
|
4
|
+
private _elapsedTime;
|
|
5
|
+
/**
|
|
6
|
+
* Checks if the time has elapsed.
|
|
7
|
+
* @returns {boolean} Returns true if the time is elapsed, false otherwise.
|
|
8
|
+
*/
|
|
9
|
+
isTimeElapsed: () => boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Updates the elapsed time.
|
|
12
|
+
* @param {number} deltaTime - The amount of time that has passed since the last update.
|
|
13
|
+
*/
|
|
14
|
+
update: (deltaTime: number) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Resets the elapsed time.
|
|
17
|
+
*/
|
|
18
|
+
reset: () => void;
|
|
19
|
+
/**
|
|
20
|
+
* Stops the elapsed time.
|
|
21
|
+
*/
|
|
22
|
+
stop: () => void;
|
|
23
|
+
/**
|
|
24
|
+
* Starts the elapsed time.
|
|
25
|
+
*/
|
|
26
|
+
start: () => void;
|
|
27
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export default class Duration {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.maxTime = -1;
|
|
4
|
+
this._stop = false;
|
|
5
|
+
this._elapsedTime = 0;
|
|
6
|
+
/**
|
|
7
|
+
* Checks if the time has elapsed.
|
|
8
|
+
* @returns {boolean} Returns true if the time is elapsed, false otherwise.
|
|
9
|
+
*/
|
|
10
|
+
this.isTimeElapsed = () => {
|
|
11
|
+
return this._stop || (this.maxTime > 0 && this._elapsedTime >= this.maxTime);
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Updates the elapsed time.
|
|
15
|
+
* @param {number} deltaTime - The amount of time that has passed since the last update.
|
|
16
|
+
*/
|
|
17
|
+
this.update = (deltaTime) => {
|
|
18
|
+
this._elapsedTime += deltaTime;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Resets the elapsed time.
|
|
22
|
+
*/
|
|
23
|
+
this.reset = () => {
|
|
24
|
+
this._stop = false;
|
|
25
|
+
this._elapsedTime = 0;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Stops the elapsed time.
|
|
29
|
+
*/
|
|
30
|
+
this.stop = () => {
|
|
31
|
+
this._stop = true;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Starts the elapsed time.
|
|
35
|
+
*/
|
|
36
|
+
this.start = () => {
|
|
37
|
+
this._stop = false;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=Duration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Duration.js","sourceRoot":"","sources":["../../../src/lib/emitter/Duration.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,OAAO,QAAQ;IAA7B;QACE,YAAO,GAAW,CAAC,CAAC,CAAA;QACZ,UAAK,GAAY,KAAK,CAAA;QACtB,iBAAY,GAAW,CAAC,CAAA;QAEhC;;;WAGG;QACH,kBAAa,GAAG,GAAG,EAAE;YACnB,OAAO,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,OAAO,CAAC,CAAA;QAC9E,CAAC,CAAA;QAED;;;WAGG;QACH,WAAM,GAAG,CAAC,SAAiB,EAAE,EAAE;YAC7B,IAAI,CAAC,YAAY,IAAI,SAAS,CAAA;QAChC,CAAC,CAAA;QAED;;WAEG;QACH,UAAK,GAAG,GAAG,EAAE;YACX,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;YAClB,IAAI,CAAC,YAAY,GAAG,CAAC,CAAA;QACvB,CAAC,CAAA;QAED;;WAEG;QACH,SAAI,GAAG,GAAG,EAAE;YACV,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QACnB,CAAC,CAAA;QAED;;WAEG;QACH,UAAK,GAAG,GAAG,EAAE;YACX,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QACpB,CAAC,CAAA;IACH,CAAC;CAAA"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import Duration from './Duration';
|
|
2
|
+
import { EmitterBehaviours } from '../behaviour';
|
|
3
|
+
import eventemitter3 from 'eventemitter3';
|
|
4
|
+
import { EmitterParser } from '../parser';
|
|
5
|
+
import List from '../util/List';
|
|
6
|
+
import Particle from '../Particle';
|
|
7
|
+
import { BLEND_MODES } from 'pixi.js';
|
|
8
|
+
import Model from '../Model';
|
|
9
|
+
import TurbulencePool from '../util/turbulencePool';
|
|
10
|
+
export default class Emitter extends eventemitter3 {
|
|
11
|
+
static STOP: string;
|
|
12
|
+
static RESET: string;
|
|
13
|
+
static CREATE: string;
|
|
14
|
+
static UPDATE: string;
|
|
15
|
+
static REMOVE: string;
|
|
16
|
+
static FINISHING: string;
|
|
17
|
+
static COMPLETE: string;
|
|
18
|
+
list: List;
|
|
19
|
+
duration: Duration;
|
|
20
|
+
animatedSprite: {
|
|
21
|
+
loop: boolean;
|
|
22
|
+
frameRate: number;
|
|
23
|
+
randomFrameStart: number;
|
|
24
|
+
};
|
|
25
|
+
alpha: number;
|
|
26
|
+
anchor: {
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
};
|
|
30
|
+
blendMode: BLEND_MODES;
|
|
31
|
+
behaviours: EmitterBehaviours;
|
|
32
|
+
emitController: any;
|
|
33
|
+
turbulencePool: TurbulencePool;
|
|
34
|
+
private _play;
|
|
35
|
+
private _model;
|
|
36
|
+
constructor(model: Model);
|
|
37
|
+
/**
|
|
38
|
+
* Updates the emitter, emits particles and updates the particles.
|
|
39
|
+
* Triggers the COMPLETE event when the duration is elapsed and the list is empty.
|
|
40
|
+
* @param {number} deltaTime - Time elapsed since the last update
|
|
41
|
+
*/
|
|
42
|
+
update(deltaTime: number): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Emits particles if the duration is not elapsed.
|
|
45
|
+
* @param {number} deltaTime - Time elapsed since the last update
|
|
46
|
+
*/
|
|
47
|
+
emitParticles(deltaTime: number): void;
|
|
48
|
+
/**
|
|
49
|
+
* Creates the particles to be emitted.
|
|
50
|
+
* Triggers the CREATE event when a particle is created.
|
|
51
|
+
* @param {number} deltaTime - Time elapsed since the last update
|
|
52
|
+
*/
|
|
53
|
+
createParticles(deltaTime: number): void;
|
|
54
|
+
/**
|
|
55
|
+
* Updates the list of particles
|
|
56
|
+
* @param {number} deltaTime - The amount of time that has passed since the last update
|
|
57
|
+
*/
|
|
58
|
+
updateParticles(deltaTime: number): void;
|
|
59
|
+
/**
|
|
60
|
+
* Updates a single particle
|
|
61
|
+
* @param {Particle} particle - The particle to update
|
|
62
|
+
* @param {number} deltaTime - The amount of time that has passed since the last update
|
|
63
|
+
*/
|
|
64
|
+
updateParticle(particle: Particle, deltaTime: number): void;
|
|
65
|
+
/**
|
|
66
|
+
* Removes a particle from the list and reset it
|
|
67
|
+
* @param {Particle} particle - The particle to remove
|
|
68
|
+
*/
|
|
69
|
+
removeParticle(particle: Particle): void;
|
|
70
|
+
/**
|
|
71
|
+
* Gets a parser to parse the emitter and it's particles
|
|
72
|
+
* @returns {EmitterParser} - The parser for this emitter
|
|
73
|
+
*/
|
|
74
|
+
getParser(): EmitterParser;
|
|
75
|
+
/**
|
|
76
|
+
* Creates props for a behaviour
|
|
77
|
+
* @param {string} name - The name of the behaviour
|
|
78
|
+
* @returns {Object} - The props for the behaviour
|
|
79
|
+
*/
|
|
80
|
+
createBehaviourProps(name: string): any;
|
|
81
|
+
/**
|
|
82
|
+
* Starts the emitter playing
|
|
83
|
+
*/
|
|
84
|
+
play(): void;
|
|
85
|
+
/**
|
|
86
|
+
* Resets the emitter and starts playing
|
|
87
|
+
*/
|
|
88
|
+
resetAndPlay(): void;
|
|
89
|
+
/**
|
|
90
|
+
* Resets the emitter without removing the particles and starts playing
|
|
91
|
+
*/
|
|
92
|
+
resetWithoutRemovingAndPlay(): void;
|
|
93
|
+
/**
|
|
94
|
+
* Resets the emitter and removes all the particles
|
|
95
|
+
*/
|
|
96
|
+
reset(): void;
|
|
97
|
+
/**
|
|
98
|
+
* Resets the emitter without removing the particles
|
|
99
|
+
*/
|
|
100
|
+
resetWithoutRemoving(): void;
|
|
101
|
+
/**
|
|
102
|
+
* Stops the emitter and removes all the particles
|
|
103
|
+
*/
|
|
104
|
+
stop(): void;
|
|
105
|
+
/**
|
|
106
|
+
* Stops the emitter without killing the particles
|
|
107
|
+
*/
|
|
108
|
+
stopWithoutKilling(): void;
|
|
109
|
+
/**
|
|
110
|
+
* Removes all the particles from the list
|
|
111
|
+
*/
|
|
112
|
+
removeParticles(): void;
|
|
113
|
+
pause(): void;
|
|
114
|
+
resume(): void;
|
|
115
|
+
destroy(): void;
|
|
116
|
+
}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import Duration from './Duration';
|
|
11
|
+
import { EmitterBehaviours } from '../behaviour';
|
|
12
|
+
import eventemitter3 from 'eventemitter3';
|
|
13
|
+
import ParticlePool from '../ParticlePool';
|
|
14
|
+
import { EmitterParser } from '../parser';
|
|
15
|
+
import List from '../util/List';
|
|
16
|
+
import * as emission from '../emission';
|
|
17
|
+
import { AnimatedSprite, BLEND_MODES } from 'pixi.js';
|
|
18
|
+
import TurbulencePool from '../util/turbulencePool';
|
|
19
|
+
class Emitter extends eventemitter3 {
|
|
20
|
+
constructor(model) {
|
|
21
|
+
super();
|
|
22
|
+
this.list = new List();
|
|
23
|
+
this.duration = new Duration();
|
|
24
|
+
this.alpha = 1;
|
|
25
|
+
this.anchor = { x: 0.5, y: 0.5 };
|
|
26
|
+
this.blendMode = BLEND_MODES.NORMAL;
|
|
27
|
+
this.behaviours = new EmitterBehaviours();
|
|
28
|
+
this.turbulencePool = new TurbulencePool();
|
|
29
|
+
this._model = model;
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
this.emitController = new emission[emission.EmissionTypes.DEFAULT]();
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Updates the emitter, emits particles and updates the particles.
|
|
35
|
+
* Triggers the COMPLETE event when the duration is elapsed and the list is empty.
|
|
36
|
+
* @param {number} deltaTime - Time elapsed since the last update
|
|
37
|
+
*/
|
|
38
|
+
update(deltaTime) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
if (!this._play)
|
|
41
|
+
return;
|
|
42
|
+
this.behaviours.update(deltaTime);
|
|
43
|
+
this.emitParticles(deltaTime);
|
|
44
|
+
this.updateParticles(deltaTime);
|
|
45
|
+
this.duration.update(deltaTime);
|
|
46
|
+
if (this.duration.isTimeElapsed() && this.list.isEmpty()) {
|
|
47
|
+
this.stop();
|
|
48
|
+
setTimeout(() => {
|
|
49
|
+
this.emit(Emitter.COMPLETE);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Emits particles if the duration is not elapsed.
|
|
56
|
+
* @param {number} deltaTime - Time elapsed since the last update
|
|
57
|
+
*/
|
|
58
|
+
emitParticles(deltaTime) {
|
|
59
|
+
if (!this.duration.isTimeElapsed()) {
|
|
60
|
+
this.createParticles(deltaTime);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Creates the particles to be emitted.
|
|
65
|
+
* Triggers the CREATE event when a particle is created.
|
|
66
|
+
* @param {number} deltaTime - Time elapsed since the last update
|
|
67
|
+
*/
|
|
68
|
+
createParticles(deltaTime) {
|
|
69
|
+
const particlesToEmit = this.emitController.howMany(deltaTime, this.list.length);
|
|
70
|
+
for (let i = 0; i < particlesToEmit; ++i) {
|
|
71
|
+
const particle = this.list.add(ParticlePool.global.pop());
|
|
72
|
+
this.behaviours.init(particle, this._model, this.turbulencePool);
|
|
73
|
+
this.emit(Emitter.CREATE, particle);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Updates the list of particles
|
|
78
|
+
* @param {number} deltaTime - The amount of time that has passed since the last update
|
|
79
|
+
*/
|
|
80
|
+
updateParticles(deltaTime) {
|
|
81
|
+
this.list.forEach((particle) => {
|
|
82
|
+
this.updateParticle(particle, deltaTime);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Updates a single particle
|
|
87
|
+
* @param {Particle} particle - The particle to update
|
|
88
|
+
* @param {number} deltaTime - The amount of time that has passed since the last update
|
|
89
|
+
*/
|
|
90
|
+
updateParticle(particle, deltaTime) {
|
|
91
|
+
if (particle.isDead()) {
|
|
92
|
+
this.removeParticle(particle);
|
|
93
|
+
}
|
|
94
|
+
else if (particle.isAlmostDead()) {
|
|
95
|
+
this.behaviours.apply(particle, deltaTime, this._model);
|
|
96
|
+
this.emit(Emitter.FINISHING, particle);
|
|
97
|
+
this.emit(Emitter.UPDATE, particle);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
this.behaviours.apply(particle, deltaTime, this._model);
|
|
101
|
+
this.emit(Emitter.UPDATE, particle);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Removes a particle from the list and reset it
|
|
106
|
+
* @param {Particle} particle - The particle to remove
|
|
107
|
+
*/
|
|
108
|
+
removeParticle(particle) {
|
|
109
|
+
this.emit(Emitter.REMOVE, particle);
|
|
110
|
+
this.list.remove(particle);
|
|
111
|
+
particle.reset();
|
|
112
|
+
ParticlePool.global.push(particle);
|
|
113
|
+
this.turbulencePool.list.remove(particle);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Gets a parser to parse the emitter and it's particles
|
|
117
|
+
* @returns {EmitterParser} - The parser for this emitter
|
|
118
|
+
*/
|
|
119
|
+
getParser() {
|
|
120
|
+
return new EmitterParser(this);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Creates props for a behaviour
|
|
124
|
+
* @param {string} name - The name of the behaviour
|
|
125
|
+
* @returns {Object} - The props for the behaviour
|
|
126
|
+
*/
|
|
127
|
+
createBehaviourProps(name) {
|
|
128
|
+
return this.getParser().createBehaviourProps(name);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Starts the emitter playing
|
|
132
|
+
*/
|
|
133
|
+
play() {
|
|
134
|
+
this.duration.start();
|
|
135
|
+
this._play = true;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Resets the emitter and starts playing
|
|
139
|
+
*/
|
|
140
|
+
resetAndPlay() {
|
|
141
|
+
this.reset();
|
|
142
|
+
this.play();
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Resets the emitter without removing the particles and starts playing
|
|
146
|
+
*/
|
|
147
|
+
resetWithoutRemovingAndPlay() {
|
|
148
|
+
this.resetWithoutRemoving();
|
|
149
|
+
this.play();
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Resets the emitter and removes all the particles
|
|
153
|
+
*/
|
|
154
|
+
reset() {
|
|
155
|
+
this.emitController.reset();
|
|
156
|
+
this.duration.reset();
|
|
157
|
+
this.removeParticles();
|
|
158
|
+
this.emit(Emitter.RESET);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Resets the emitter without removing the particles
|
|
162
|
+
*/
|
|
163
|
+
resetWithoutRemoving() {
|
|
164
|
+
this.emitController.reset();
|
|
165
|
+
this.duration.reset();
|
|
166
|
+
this.emit(Emitter.RESET);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Stops the emitter and removes all the particles
|
|
170
|
+
*/
|
|
171
|
+
stop() {
|
|
172
|
+
this._play = false;
|
|
173
|
+
this.removeParticles();
|
|
174
|
+
this.emit(Emitter.STOP);
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Stops the emitter without killing the particles
|
|
178
|
+
*/
|
|
179
|
+
stopWithoutKilling() {
|
|
180
|
+
this.duration.stop();
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Removes all the particles from the list
|
|
184
|
+
*/
|
|
185
|
+
removeParticles() {
|
|
186
|
+
this.list.forEach((particle) => {
|
|
187
|
+
this.removeParticle(particle);
|
|
188
|
+
});
|
|
189
|
+
this.turbulencePool.list.forEach((particle) => {
|
|
190
|
+
this.removeParticle(particle);
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
pause() {
|
|
194
|
+
this.list.forEach((particle) => {
|
|
195
|
+
if (particle.sprite instanceof AnimatedSprite) {
|
|
196
|
+
particle.sprite.stop();
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
resume() {
|
|
201
|
+
this.list.forEach((particle) => {
|
|
202
|
+
if (particle.sprite instanceof AnimatedSprite) {
|
|
203
|
+
particle.sprite.play();
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
destroy() {
|
|
208
|
+
var _a;
|
|
209
|
+
this.list.reset();
|
|
210
|
+
// @ts-ignore
|
|
211
|
+
this.list = undefined;
|
|
212
|
+
this.turbulencePool.list.reset();
|
|
213
|
+
// @ts-ignore
|
|
214
|
+
this.turbulencePool.list = undefined;
|
|
215
|
+
// @ts-ignore
|
|
216
|
+
this.turbulencePool = undefined;
|
|
217
|
+
// @ts-ignore
|
|
218
|
+
this.duration = undefined;
|
|
219
|
+
// @ts-ignore
|
|
220
|
+
this.animatedSprite = undefined;
|
|
221
|
+
(_a = this.behaviours) === null || _a === void 0 ? void 0 : _a.clear();
|
|
222
|
+
// @ts-ignore
|
|
223
|
+
this.behaviours = undefined;
|
|
224
|
+
if (this.emitController && this.emitController.reset) {
|
|
225
|
+
this.emitController.reset();
|
|
226
|
+
}
|
|
227
|
+
this.emitController = undefined;
|
|
228
|
+
// @ts-ignore
|
|
229
|
+
this._model = undefined;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
Emitter.STOP = 'emitter/stop';
|
|
233
|
+
Emitter.RESET = 'emitter/reset';
|
|
234
|
+
Emitter.CREATE = 'emitter/create';
|
|
235
|
+
Emitter.UPDATE = 'emitter/update';
|
|
236
|
+
Emitter.REMOVE = 'emitter/remove';
|
|
237
|
+
Emitter.FINISHING = 'emitter/finishing';
|
|
238
|
+
Emitter.COMPLETE = 'emitter/complete';
|
|
239
|
+
export default Emitter;
|
|
240
|
+
//# sourceMappingURL=Emitter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Emitter.js","sourceRoot":"","sources":["../../../src/lib/emitter/Emitter.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,QAAQ,MAAM,YAAY,CAAA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K,EAAE,CAAA;QAC7B,CAAC;QACD,IAAI,CAAC,cAAc,GAAG,SAAS,CAAA;QAC/B,aAAa;QACb,IAAI,CAAC,MAAM,GAAG,SAAS,CAAA;IACzB,CAAC;;AA9OM,YAAI,GAAG,cAAc,AAAjB,CAAiB;AACrB,aAAK,GAAG,eAAe,AAAlB,CAAkB;AACvB,cAAM,GAAG,gBAAgB,AAAnB,CAAmB;AACzB,cAAM,GAAG,gBAAgB,AAAnB,CAAmB;AACzB,cAAM,GAAG,gBAAgB,AAAnB,CAAmB;AACzB,iBAAS,GAAG,mBAAmB,AAAtB,CAAsB;AAC/B,gBAAQ,GAAG,kBAAkB,AAArB,CAAqB;eAPjB,OAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/emitter/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,WAAW,CAAA;AAC/B,OAAO,QAAQ,MAAM,YAAY,CAAA;AAEjC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as controller from './emission';
|
|
2
|
+
import * as behaviour from './behaviour';
|
|
3
|
+
import * as parser from './parser';
|
|
4
|
+
import Particle from './Particle';
|
|
5
|
+
import ParticlePool from './ParticlePool';
|
|
6
|
+
import { Duration, Emitter } from './emitter';
|
|
7
|
+
import { Color, Point, Random } from './util';
|
|
8
|
+
declare const cpp: {
|
|
9
|
+
Particle: typeof Particle;
|
|
10
|
+
ParticlePool: typeof ParticlePool;
|
|
11
|
+
parser: typeof parser;
|
|
12
|
+
controller: typeof controller;
|
|
13
|
+
behaviour: typeof behaviour;
|
|
14
|
+
Color: typeof Color;
|
|
15
|
+
Point: typeof Point;
|
|
16
|
+
Random: typeof Random;
|
|
17
|
+
Duration: typeof Duration;
|
|
18
|
+
Emitter: typeof Emitter;
|
|
19
|
+
};
|
|
20
|
+
export default cpp;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as controller from './emission';
|
|
2
|
+
import * as behaviour from './behaviour';
|
|
3
|
+
import * as parser from './parser';
|
|
4
|
+
import Particle from './Particle';
|
|
5
|
+
import ParticlePool from './ParticlePool';
|
|
6
|
+
import { Duration, Emitter } from './emitter';
|
|
7
|
+
import { Color, Point, Random } from './util';
|
|
8
|
+
const cpp = {
|
|
9
|
+
Particle,
|
|
10
|
+
ParticlePool,
|
|
11
|
+
parser,
|
|
12
|
+
controller,
|
|
13
|
+
behaviour,
|
|
14
|
+
Color,
|
|
15
|
+
Point,
|
|
16
|
+
Random,
|
|
17
|
+
Duration,
|
|
18
|
+
Emitter,
|
|
19
|
+
};
|
|
20
|
+
export default cpp;
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAA;AACxC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAA;AAClC,OAAO,QAAQ,MAAM,YAAY,CAAA;AACjC,OAAO,YAAY,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE7C,MAAM,GAAG,GAAG;IACV,QAAQ;IACR,YAAY;IACZ,MAAM;IACN,UAAU;IACV,SAAS;IACT,KAAK;IACL,KAAK;IACL,MAAM;IACN,QAAQ;IACR,OAAO;CACR,CAAA;AAED,eAAe,GAAG,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Class used to parse a behaviour object into a JSON config object and vice versa
|
|
3
|
+
*/
|
|
4
|
+
export default class BehaviourParser {
|
|
5
|
+
private readonly _behaviour;
|
|
6
|
+
/**
|
|
7
|
+
* Constructs a BehaviourParser object.
|
|
8
|
+
* @param {any} behaviour The behaviour to be parsed.
|
|
9
|
+
*/
|
|
10
|
+
constructor(behaviour: any);
|
|
11
|
+
/**
|
|
12
|
+
* Writes the behaviour to a config object.
|
|
13
|
+
* @returns {object} The config object.
|
|
14
|
+
*/
|
|
15
|
+
write: () => any;
|
|
16
|
+
/**
|
|
17
|
+
* Reads a config object and sets the behaviour appropriately.
|
|
18
|
+
* @param {object} config The config object to be read.
|
|
19
|
+
*/
|
|
20
|
+
read: (config: any) => void;
|
|
21
|
+
}
|