custom-pixi-particles 4.0.21 → 4.0.23
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/README.md +10 -2
- package/dist/index.d.ts +5 -0
- package/dist/index.js +21 -4
- package/dist/index.js.map +1 -1
- package/dist/lib/Model.d.ts +23 -0
- package/dist/lib/Model.js +23 -0
- package/dist/lib/Model.js.map +1 -1
- package/dist/lib/Particle.d.ts +146 -0
- package/dist/lib/Particle.js +61 -0
- package/dist/lib/Particle.js.map +1 -1
- package/dist/lib/ParticlePool.d.ts +28 -0
- package/dist/lib/ParticlePool.js +28 -0
- package/dist/lib/ParticlePool.js.map +1 -1
- package/dist/lib/behaviour/AngularVelocityBehaviour.d.ts +31 -0
- package/dist/lib/behaviour/AngularVelocityBehaviour.js +45 -12
- package/dist/lib/behaviour/AngularVelocityBehaviour.js.map +1 -1
- package/dist/lib/behaviour/Behaviour.d.ts +26 -0
- package/dist/lib/behaviour/Behaviour.js +26 -0
- package/dist/lib/behaviour/Behaviour.js.map +1 -1
- package/dist/lib/behaviour/ColorBehaviour.d.ts +1 -1
- package/dist/lib/behaviour/ColorBehaviour.js +8 -11
- package/dist/lib/behaviour/ColorBehaviour.js.map +1 -1
- package/dist/lib/behaviour/EmitDirectionBehaviour.d.ts +29 -5
- package/dist/lib/behaviour/EmitDirectionBehaviour.js +32 -20
- package/dist/lib/behaviour/EmitDirectionBehaviour.js.map +1 -1
- package/dist/lib/behaviour/EmitterBehaviours.d.ts +44 -2
- package/dist/lib/behaviour/EmitterBehaviours.js +43 -3
- package/dist/lib/behaviour/EmitterBehaviours.js.map +1 -1
- package/dist/lib/behaviour/LifeBehaviour.d.ts +49 -0
- package/dist/lib/behaviour/LifeBehaviour.js +55 -5
- package/dist/lib/behaviour/LifeBehaviour.js.map +1 -1
- package/dist/lib/behaviour/PositionBehaviour.d.ts +32 -1
- package/dist/lib/behaviour/PositionBehaviour.js +60 -26
- package/dist/lib/behaviour/PositionBehaviour.js.map +1 -1
- package/dist/lib/behaviour/RotationBehaviour.d.ts +33 -4
- package/dist/lib/behaviour/RotationBehaviour.js +33 -17
- package/dist/lib/behaviour/RotationBehaviour.js.map +1 -1
- package/dist/lib/behaviour/SizeBehaviour.d.ts +1 -1
- package/dist/lib/behaviour/SizeBehaviour.js +25 -18
- package/dist/lib/behaviour/SizeBehaviour.js.map +1 -1
- package/dist/lib/behaviour/TurbulenceBehaviour.d.ts +1 -1
- package/dist/lib/behaviour/TurbulenceBehaviour.js +1 -5
- package/dist/lib/behaviour/TurbulenceBehaviour.js.map +1 -1
- package/dist/lib/emission/AbstractEmission.d.ts +23 -0
- package/dist/lib/emission/AbstractEmission.js +23 -0
- package/dist/lib/emission/AbstractEmission.js.map +1 -1
- package/dist/lib/emission/RandomEmission.d.ts +33 -0
- package/dist/lib/emission/RandomEmission.js +33 -0
- package/dist/lib/emission/RandomEmission.js.map +1 -1
- package/dist/lib/emission/StandardEmission.d.ts +49 -0
- package/dist/lib/emission/StandardEmission.js +49 -0
- package/dist/lib/emission/StandardEmission.js.map +1 -1
- package/dist/lib/emission/UniformEmission.d.ts +42 -0
- package/dist/lib/emission/UniformEmission.js +42 -0
- package/dist/lib/emission/UniformEmission.js.map +1 -1
- package/dist/lib/emitter/Duration.d.ts +17 -0
- package/dist/lib/emitter/Duration.js +17 -0
- package/dist/lib/emitter/Duration.js.map +1 -1
- package/dist/lib/emitter/Emitter.d.ts +61 -1
- package/dist/lib/emitter/Emitter.js +60 -0
- package/dist/lib/emitter/Emitter.js.map +1 -1
- package/dist/lib/parser/BehaviourParser.d.ts +15 -4
- package/dist/lib/parser/BehaviourParser.js +15 -23
- package/dist/lib/parser/BehaviourParser.js.map +1 -1
- package/dist/lib/parser/CompatibilityHelper.d.ts +9 -0
- package/dist/lib/parser/CompatibilityHelper.js +9 -0
- package/dist/lib/parser/CompatibilityHelper.js.map +1 -1
- package/dist/lib/parser/EmitControllerParser.d.ts +21 -0
- package/dist/lib/parser/EmitControllerParser.js +21 -0
- package/dist/lib/parser/EmitControllerParser.js.map +1 -1
- package/dist/lib/parser/EmitterParser.d.ts +54 -1
- package/dist/lib/parser/EmitterParser.js +73 -15
- package/dist/lib/parser/EmitterParser.js.map +1 -1
- package/dist/lib/pixi/Renderer.d.ts +55 -0
- package/dist/lib/pixi/Renderer.js +56 -1
- package/dist/lib/pixi/Renderer.js.map +1 -1
- package/dist/lib/pixi/TestRenderer.js +1 -1
- package/dist/lib/pixi/TestRenderer.js.map +1 -1
- package/dist/lib/util/Color.d.ts +101 -0
- package/dist/lib/util/Color.js +101 -0
- package/dist/lib/util/Color.js.map +1 -1
- package/dist/lib/util/List.d.ts +40 -0
- package/dist/lib/util/List.js +40 -0
- package/dist/lib/util/List.js.map +1 -1
- package/dist/lib/util/Point.d.ts +21 -0
- package/dist/lib/util/Point.js +21 -0
- package/dist/lib/util/Point.js.map +1 -1
- package/dist/lib/util/Random.d.ts +20 -0
- package/dist/lib/util/Random.js +20 -0
- package/dist/lib/util/Random.js.map +1 -1
- package/dist/lib/util/maths.d.ts +17 -0
- package/dist/lib/util/maths.js +17 -0
- package/dist/lib/util/maths.js.map +1 -1
- package/package.json +1 -1
|
@@ -29,6 +29,11 @@ export default class Emitter extends eventemitter3 {
|
|
|
29
29
|
// @ts-ignore
|
|
30
30
|
this.emitController = new emission[emission.EmissionTypes.DEFAULT]();
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Updates the emitter, emits particles and updates the particles.
|
|
34
|
+
* Triggers the COMPLETE event when the duration is elapsed and the list is empty.
|
|
35
|
+
* @param {number} deltaTime - Time elapsed since the last update
|
|
36
|
+
*/
|
|
32
37
|
update(deltaTime) {
|
|
33
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
34
39
|
if (!this._play)
|
|
@@ -44,11 +49,20 @@ export default class Emitter extends eventemitter3 {
|
|
|
44
49
|
}
|
|
45
50
|
});
|
|
46
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Emits particles if the duration is not elapsed.
|
|
54
|
+
* @param {number} deltaTime - Time elapsed since the last update
|
|
55
|
+
*/
|
|
47
56
|
emitParticles(deltaTime) {
|
|
48
57
|
if (!this.duration.isTimeElapsed()) {
|
|
49
58
|
this.createParticles(deltaTime);
|
|
50
59
|
}
|
|
51
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Creates the particles to be emitted.
|
|
63
|
+
* Triggers the CREATE event when a particle is created.
|
|
64
|
+
* @param {number} deltaTime - Time elapsed since the last update
|
|
65
|
+
*/
|
|
52
66
|
createParticles(deltaTime) {
|
|
53
67
|
const particlesToEmit = this.emitController.howMany(deltaTime, this.list.length);
|
|
54
68
|
for (let i = 0; i < particlesToEmit; ++i) {
|
|
@@ -57,11 +71,20 @@ export default class Emitter extends eventemitter3 {
|
|
|
57
71
|
this.emit(Emitter.CREATE, particle);
|
|
58
72
|
}
|
|
59
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Updates the list of particles
|
|
76
|
+
* @param {number} deltaTime - The amount of time that has passed since the last update
|
|
77
|
+
*/
|
|
60
78
|
updateParticles(deltaTime) {
|
|
61
79
|
this.list.forEach((particle) => {
|
|
62
80
|
this.updateParticle(particle, deltaTime);
|
|
63
81
|
});
|
|
64
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Updates a single particle
|
|
85
|
+
* @param {Particle} particle - The particle to update
|
|
86
|
+
* @param {number} deltaTime - The amount of time that has passed since the last update
|
|
87
|
+
*/
|
|
65
88
|
updateParticle(particle, deltaTime) {
|
|
66
89
|
if (particle.isDead()) {
|
|
67
90
|
this.removeParticle(particle);
|
|
@@ -76,6 +99,10 @@ export default class Emitter extends eventemitter3 {
|
|
|
76
99
|
this.emit(Emitter.UPDATE, particle);
|
|
77
100
|
}
|
|
78
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* Removes a particle from the list and reset it
|
|
104
|
+
* @param {Particle} particle - The particle to remove
|
|
105
|
+
*/
|
|
79
106
|
removeParticle(particle) {
|
|
80
107
|
this.emit(Emitter.REMOVE, particle);
|
|
81
108
|
this.list.remove(particle);
|
|
@@ -83,44 +110,77 @@ export default class Emitter extends eventemitter3 {
|
|
|
83
110
|
ParticlePool.global.push(particle);
|
|
84
111
|
turbulencePool.list.remove(particle);
|
|
85
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* Gets a parser to parse the emitter and it's particles
|
|
115
|
+
* @returns {EmitterParser} - The parser for this emitter
|
|
116
|
+
*/
|
|
86
117
|
getParser() {
|
|
87
118
|
return new EmitterParser(this);
|
|
88
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* Creates props for a behaviour
|
|
122
|
+
* @param {string} name - The name of the behaviour
|
|
123
|
+
* @returns {Object} - The props for the behaviour
|
|
124
|
+
*/
|
|
89
125
|
createBehaviourProps(name) {
|
|
90
126
|
return this.getParser().createBehaviourProps(name);
|
|
91
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* Starts the emitter playing
|
|
130
|
+
*/
|
|
92
131
|
play() {
|
|
93
132
|
this.duration.start();
|
|
94
133
|
this._play = true;
|
|
95
134
|
this.emit(Emitter.PLAY);
|
|
96
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* Resets the emitter and starts playing
|
|
138
|
+
*/
|
|
97
139
|
resetAndPlay() {
|
|
98
140
|
this.reset();
|
|
99
141
|
this.play();
|
|
100
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* Resets the emitter without removing the particles and starts playing
|
|
145
|
+
*/
|
|
101
146
|
resetWithoutRemovingAndPlay() {
|
|
102
147
|
this.resetWithoutRemoving();
|
|
103
148
|
this.play();
|
|
104
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* Resets the emitter and removes all the particles
|
|
152
|
+
*/
|
|
105
153
|
reset() {
|
|
106
154
|
this.emitController.reset();
|
|
107
155
|
this.duration.reset();
|
|
108
156
|
this.removeParticles();
|
|
109
157
|
this.emit(Emitter.RESET);
|
|
110
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* Resets the emitter without removing the particles
|
|
161
|
+
*/
|
|
111
162
|
resetWithoutRemoving() {
|
|
112
163
|
this.emitController.reset();
|
|
113
164
|
this.duration.reset();
|
|
114
165
|
this.emit(Emitter.RESET);
|
|
115
166
|
}
|
|
167
|
+
/**
|
|
168
|
+
* Stops the emitter and removes all the particles
|
|
169
|
+
*/
|
|
116
170
|
stop() {
|
|
117
171
|
this._play = false;
|
|
118
172
|
this.removeParticles();
|
|
119
173
|
this.emit(Emitter.STOP);
|
|
120
174
|
}
|
|
175
|
+
/**
|
|
176
|
+
* Stops the emitter without killing the particles
|
|
177
|
+
*/
|
|
121
178
|
stopWithoutKilling() {
|
|
122
179
|
this.duration.stop();
|
|
123
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* Removes all the particles from the list
|
|
183
|
+
*/
|
|
124
184
|
removeParticles() {
|
|
125
185
|
this.list.forEach((particle) => {
|
|
126
186
|
this.removeParticle(particle);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Emitter.js","sourceRoot":"","sources":["../../../src/lib/emitter/Emitter.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,QAAQ,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,aAAa,MAAM,eAAe,CAAA;AACzC,OAAO,YAAY,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,IAAI,MAAM,cAAc,CAAA;AAC/B,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAA;AAEvC,OAAO,cAAc,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAG5C,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,aAAa;IAoBhD,YAAY,KAAY;QACtB,KAAK,EAAE,CAAA;QAZT,SAAI,GAAS,IAAI,IAAI,EAAE,CAAA;QACvB,aAAQ,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CAAA;QAClB,IAAI,CAAC,eAAe,EAAE,CAAA;QACtB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACzB,CAAC;IAED;;OAEG;IACH,kBAAkB;QAChB,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAA;IACtB,CAAC;IAED;;OAEG;IACH,eAAe;QACb,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,QAAkB,EAAE,EAAE;YACvC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAA;QAC/B,CAAC,CAAC,CAAA;QACF,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,QAAkB,EAAE,EAAE;YACjD,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAA;QAC/B,CAAC,CAAC,CAAA;IACJ,CAAC;;AAtMM,YAAI,GAAG,cAAc,CAAA;AACrB,YAAI,GAAG,cAAc,CAAA;AACrB,aAAK,GAAG,eAAe,CAAA;AACvB,cAAM,GAAG,gBAAgB,CAAA;AACzB,cAAM,GAAG,gBAAgB,CAAA;AACzB,cAAM,GAAG,gBAAgB,CAAA;AACzB,iBAAS,GAAG,mBAAmB,CAAA;AAC/B,gBAAQ,GAAG,kBAAkB,CAAA"}
|
|
@@ -1,10 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Class used to parse a behaviour object into a JSON config object and vice versa
|
|
3
|
+
*/
|
|
1
4
|
export default class BehaviourParser {
|
|
2
5
|
private readonly _behaviour;
|
|
6
|
+
/**
|
|
7
|
+
* Constructs a BehaviourParser object.
|
|
8
|
+
* @param {any} behaviour The behaviour to be parsed.
|
|
9
|
+
*/
|
|
3
10
|
constructor(behaviour: any);
|
|
11
|
+
/**
|
|
12
|
+
* Writes the behaviour to a config object.
|
|
13
|
+
* @returns {object} The config object.
|
|
14
|
+
*/
|
|
4
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
|
+
*/
|
|
5
20
|
read: (config: any) => void;
|
|
6
|
-
private writePoint;
|
|
7
|
-
private readPoint;
|
|
8
|
-
private writeColor;
|
|
9
|
-
private readColor;
|
|
10
21
|
}
|
|
@@ -1,11 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Class used to parse a behaviour object into a JSON config object and vice versa
|
|
3
|
+
*/
|
|
2
4
|
export default class BehaviourParser {
|
|
5
|
+
/**
|
|
6
|
+
* Constructs a BehaviourParser object.
|
|
7
|
+
* @param {any} behaviour The behaviour to be parsed.
|
|
8
|
+
*/
|
|
3
9
|
constructor(behaviour) {
|
|
10
|
+
/**
|
|
11
|
+
* Writes the behaviour to a config object.
|
|
12
|
+
* @returns {object} The config object.
|
|
13
|
+
*/
|
|
4
14
|
this.write = () => {
|
|
5
15
|
const config = JSON.parse(JSON.stringify(this._behaviour));
|
|
6
16
|
config.name = this._behaviour.getName();
|
|
7
17
|
return config;
|
|
8
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* Reads a config object and sets the behaviour appropriately.
|
|
21
|
+
* @param {object} config The config object to be read.
|
|
22
|
+
*/
|
|
9
23
|
this.read = (config) => {
|
|
10
24
|
for (const key in config) {
|
|
11
25
|
if (this._behaviour[key] instanceof Object) {
|
|
@@ -16,28 +30,6 @@ export default class BehaviourParser {
|
|
|
16
30
|
}
|
|
17
31
|
}
|
|
18
32
|
};
|
|
19
|
-
this.writePoint = (point) => {
|
|
20
|
-
return { x: point.x, y: point.y };
|
|
21
|
-
};
|
|
22
|
-
this.readPoint = (rawData) => {
|
|
23
|
-
const point = new Point();
|
|
24
|
-
if (rawData) {
|
|
25
|
-
point.x = rawData.x || 0;
|
|
26
|
-
point.y = rawData.y || 0;
|
|
27
|
-
}
|
|
28
|
-
return point;
|
|
29
|
-
};
|
|
30
|
-
this.writeColor = (color) => {
|
|
31
|
-
return { hex: color.hex, alpha: color.alpha };
|
|
32
|
-
};
|
|
33
|
-
this.readColor = (rawData) => {
|
|
34
|
-
const color = new Color();
|
|
35
|
-
if (rawData) {
|
|
36
|
-
color.hex = rawData.hex || 0;
|
|
37
|
-
color.alpha = rawData.alpha || 0;
|
|
38
|
-
}
|
|
39
|
-
return color;
|
|
40
|
-
};
|
|
41
33
|
this._behaviour = behaviour;
|
|
42
34
|
}
|
|
43
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BehaviourParser.js","sourceRoot":"","sources":["../../../src/lib/parser/BehaviourParser.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"BehaviourParser.js","sourceRoot":"","sources":["../../../src/lib/parser/BehaviourParser.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,eAAe;IAGlC;;;OAGG;IACH,YAAY,SAAc;QAI1B;;;WAGG;QACH,UAAK,GAAG,GAAG,EAAE;YACX,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAA;YAC1D,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAA;YACvC,OAAO,MAAM,CAAA;QACf,CAAC,CAAA;QAED;;;WAGG;QACH,SAAI,GAAG,CAAC,MAAW,EAAE,EAAE;YACrB,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE;gBACxB,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,YAAY,MAAM,EAAE;oBAC1C,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAA;iBAClD;qBAAM;oBACL,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;iBACnC;aACF;QACH,CAAC,CAAA;QAzBC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAA;IAC7B,CAAC;CAyBF"}
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Class that provides helper methods for checking compatibility.
|
|
3
|
+
*/
|
|
1
4
|
export default class CompatibilityHelper {
|
|
5
|
+
/**
|
|
6
|
+
* Reads the duration from the given configuration.
|
|
7
|
+
*
|
|
8
|
+
* @param {Object} config - The configuration object.
|
|
9
|
+
* @return {Number} The duration from the given configuration, or -1 if not found.
|
|
10
|
+
*/
|
|
2
11
|
static readDuration: (config: any) => any;
|
|
3
12
|
}
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Class that provides helper methods for checking compatibility.
|
|
3
|
+
*/
|
|
1
4
|
export default class CompatibilityHelper {
|
|
2
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* Reads the duration from the given configuration.
|
|
8
|
+
*
|
|
9
|
+
* @param {Object} config - The configuration object.
|
|
10
|
+
* @return {Number} The duration from the given configuration, or -1 if not found.
|
|
11
|
+
*/
|
|
3
12
|
CompatibilityHelper.readDuration = (config) => {
|
|
4
13
|
if (config.duration) {
|
|
5
14
|
return config.duration;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompatibilityHelper.js","sourceRoot":"","sources":["../../../src/lib/parser/CompatibilityHelper.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,OAAO,mBAAmB;;
|
|
1
|
+
{"version":3,"file":"CompatibilityHelper.js","sourceRoot":"","sources":["../../../src/lib/parser/CompatibilityHelper.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,mBAAmB;;AACtC;;;;;GAKG;AACI,gCAAY,GAAG,CAAC,MAAW,EAAE,EAAE;IACpC,IAAI,MAAM,CAAC,QAAQ,EAAE;QACnB,OAAO,MAAM,CAAC,QAAQ,CAAA;KACvB;IAED,OAAO,CAAC,CAAC,CAAA;AACX,CAAC,CAAA"}
|
|
@@ -1,6 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EmitControllerParser is used to write and read configuration data.
|
|
3
|
+
*
|
|
4
|
+
* @class EmitControllerParser
|
|
5
|
+
*/
|
|
1
6
|
export default class EmitControllerParser {
|
|
2
7
|
private readonly _controller;
|
|
8
|
+
/**
|
|
9
|
+
* The constructor of the class.
|
|
10
|
+
*
|
|
11
|
+
* @constructor
|
|
12
|
+
* @param {any} controller The controller object.
|
|
13
|
+
*/
|
|
3
14
|
constructor(controller: any);
|
|
15
|
+
/**
|
|
16
|
+
* Writes the configuration data to a JSON format.
|
|
17
|
+
*
|
|
18
|
+
* @returns {object} The configuration object.
|
|
19
|
+
*/
|
|
4
20
|
write: () => any;
|
|
21
|
+
/**
|
|
22
|
+
* Reads the configuration data from a JSON format.
|
|
23
|
+
*
|
|
24
|
+
* @param {object} config The configuration object.
|
|
25
|
+
*/
|
|
5
26
|
read: (config: any) => void;
|
|
6
27
|
}
|
|
@@ -1,10 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EmitControllerParser is used to write and read configuration data.
|
|
3
|
+
*
|
|
4
|
+
* @class EmitControllerParser
|
|
5
|
+
*/
|
|
1
6
|
export default class EmitControllerParser {
|
|
7
|
+
/**
|
|
8
|
+
* The constructor of the class.
|
|
9
|
+
*
|
|
10
|
+
* @constructor
|
|
11
|
+
* @param {any} controller The controller object.
|
|
12
|
+
*/
|
|
2
13
|
constructor(controller) {
|
|
14
|
+
/**
|
|
15
|
+
* Writes the configuration data to a JSON format.
|
|
16
|
+
*
|
|
17
|
+
* @returns {object} The configuration object.
|
|
18
|
+
*/
|
|
3
19
|
this.write = () => {
|
|
4
20
|
const config = JSON.parse(JSON.stringify(this._controller));
|
|
5
21
|
config.name = this._controller.getName();
|
|
6
22
|
return config;
|
|
7
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* Reads the configuration data from a JSON format.
|
|
26
|
+
*
|
|
27
|
+
* @param {object} config The configuration object.
|
|
28
|
+
*/
|
|
8
29
|
this.read = (config) => {
|
|
9
30
|
for (const key in config) {
|
|
10
31
|
if (!(this._controller[key] instanceof Object)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmitControllerParser.js","sourceRoot":"","sources":["../../../src/lib/parser/EmitControllerParser.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,OAAO,oBAAoB;IAGvC,YAAY,UAAe;QAI3B,UAAK,GAAG,GAAG,EAAE;YACX,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAA;YAC3D,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAA;YACxC,OAAO,MAAM,CAAA;QACf,CAAC,CAAA;QAED,SAAI,GAAG,CAAC,MAAW,EAAE,EAAE;YACrB,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE;gBACxB,IAAI,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,YAAY,MAAM,CAAC,EAAE;oBAC9C,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;iBACpC;aACF;QACH,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"EmitControllerParser.js","sourceRoot":"","sources":["../../../src/lib/parser/EmitControllerParser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,oBAAoB;IAGvC;;;;;OAKG;IACH,YAAY,UAAe;QAI3B;;;;WAIG;QACH,UAAK,GAAG,GAAG,EAAE;YACX,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAA;YAC3D,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAA;YACxC,OAAO,MAAM,CAAA;QACf,CAAC,CAAA;QAED;;;;WAIG;QACH,SAAI,GAAG,CAAC,MAAW,EAAE,EAAE;YACrB,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE;gBACxB,IAAI,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,YAAY,MAAM,CAAC,EAAE;oBAC9C,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;iBACpC;aACF;QACH,CAAC,CAAA;QAzBC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAA;IAC/B,CAAC;CAyBF"}
|
|
@@ -1,13 +1,66 @@
|
|
|
1
1
|
import { Emitter } from '../emitter';
|
|
2
|
-
import Model from
|
|
2
|
+
import Model from '../Model';
|
|
3
|
+
/**
|
|
4
|
+
* @class EmitterParser
|
|
5
|
+
* @description This class parses an Emitter object
|
|
6
|
+
* @param {Emitter} emitter - the emitter object to be parsed
|
|
7
|
+
*/
|
|
3
8
|
export default class EmitterParser {
|
|
9
|
+
/**
|
|
10
|
+
* @memberof EmitterParser
|
|
11
|
+
* @property {Emitter} emitter - the emitter object to be parsed
|
|
12
|
+
*/
|
|
4
13
|
private readonly emitter;
|
|
14
|
+
/**
|
|
15
|
+
* @constructor
|
|
16
|
+
* @param {Emitter} emitter - the emitter object to be parsed
|
|
17
|
+
*/
|
|
5
18
|
constructor(emitter: any);
|
|
19
|
+
/**
|
|
20
|
+
* @function write
|
|
21
|
+
* @description Writes the emitter configuration to a json object
|
|
22
|
+
* @returns {Object} - the emitter configuration
|
|
23
|
+
*/
|
|
6
24
|
write: () => any;
|
|
25
|
+
/**
|
|
26
|
+
* @function read
|
|
27
|
+
* @description Reads the emitter configuration from a json object
|
|
28
|
+
* @param {Object} config - the emitter configuration
|
|
29
|
+
* @param {Model} model - the model to be updated
|
|
30
|
+
* @returns {Emitter} - the emitter
|
|
31
|
+
*/
|
|
7
32
|
read: (config: any, model: Model) => Emitter;
|
|
33
|
+
/**
|
|
34
|
+
* @function update
|
|
35
|
+
* @description Updates the emitter configuration from a json object
|
|
36
|
+
* @param {Object} config - the emitter configuration
|
|
37
|
+
* @param {Model} model - the model to be updated
|
|
38
|
+
* @returns {Emitter} - the emitter
|
|
39
|
+
*/
|
|
8
40
|
update: (config: any, model: Model) => Emitter;
|
|
41
|
+
/**
|
|
42
|
+
* Retrieves an existing behaviour or creates a new behaviour
|
|
43
|
+
* @param {string} name - The name of the behaviour to retreive or create
|
|
44
|
+
* @param {any[]} existingBehaviours - An array of existing behaviours
|
|
45
|
+
* @return {any} The existing behaviour or a new behaviour
|
|
46
|
+
*/
|
|
9
47
|
getExistingOrCreate: (name: string, existingBehaviours: any) => any;
|
|
48
|
+
/**
|
|
49
|
+
* Creates a new behaviour
|
|
50
|
+
* @param {string} name - The name of the behaviour to create
|
|
51
|
+
* @return {any} The new behaviour
|
|
52
|
+
*/
|
|
10
53
|
createBehaviour: (name: string) => any;
|
|
54
|
+
/**
|
|
55
|
+
* Creates a new behaviour properties
|
|
56
|
+
* @param {string} name - The name of the behaviour to create
|
|
57
|
+
* @return {any} The new behaviour properties
|
|
58
|
+
*/
|
|
11
59
|
createBehaviourProps: (name: string) => any;
|
|
60
|
+
/**
|
|
61
|
+
* Creates a new emission controller
|
|
62
|
+
* @param {string} name - The name of the emission controller to create
|
|
63
|
+
* @return {any} The new emission controller
|
|
64
|
+
*/
|
|
12
65
|
createEmitController: (name: string) => any;
|
|
13
66
|
}
|
|
@@ -2,16 +2,31 @@
|
|
|
2
2
|
import CompatibilityHelper from './CompatibilityHelper';
|
|
3
3
|
import * as emissions from '../emission';
|
|
4
4
|
import * as behaviours from '../behaviour';
|
|
5
|
+
/**
|
|
6
|
+
* @class EmitterParser
|
|
7
|
+
* @description This class parses an Emitter object
|
|
8
|
+
* @param {Emitter} emitter - the emitter object to be parsed
|
|
9
|
+
*/
|
|
5
10
|
export default class EmitterParser {
|
|
11
|
+
/**
|
|
12
|
+
* @constructor
|
|
13
|
+
* @param {Emitter} emitter - the emitter object to be parsed
|
|
14
|
+
*/
|
|
6
15
|
constructor(emitter) {
|
|
16
|
+
/**
|
|
17
|
+
* @function write
|
|
18
|
+
* @description Writes the emitter configuration to a json object
|
|
19
|
+
* @returns {Object} - the emitter configuration
|
|
20
|
+
*/
|
|
7
21
|
this.write = () => {
|
|
8
22
|
const config = { behaviours: [] };
|
|
9
|
-
const
|
|
10
|
-
for (let i = 0; i <
|
|
11
|
-
const behaviourConfig =
|
|
23
|
+
const emitterBehaviours = this.emitter.behaviours.getAll();
|
|
24
|
+
for (let i = 0; i < emitterBehaviours.length; i++) {
|
|
25
|
+
const behaviourConfig = emitterBehaviours[i].getParser().write();
|
|
12
26
|
config.behaviours.push(behaviourConfig);
|
|
13
27
|
}
|
|
14
28
|
config.emitController = this.emitter.emitController.getParser().write();
|
|
29
|
+
delete config.emitController._frames;
|
|
15
30
|
config.duration = this.emitter.duration.maxTime;
|
|
16
31
|
if (typeof this.emitter.alpha !== 'undefined') {
|
|
17
32
|
config.alpha = this.emitter.alpha;
|
|
@@ -27,18 +42,29 @@ export default class EmitterParser {
|
|
|
27
42
|
}
|
|
28
43
|
return config;
|
|
29
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* @function read
|
|
47
|
+
* @description Reads the emitter configuration from a json object
|
|
48
|
+
* @param {Object} config - the emitter configuration
|
|
49
|
+
* @param {Model} model - the model to be updated
|
|
50
|
+
* @returns {Emitter} - the emitter
|
|
51
|
+
*/
|
|
30
52
|
this.read = (config, model) => {
|
|
31
53
|
const behavioursConfig = config.behaviours;
|
|
32
54
|
const existingBehaviours = this.emitter.behaviours.getAll();
|
|
33
|
-
const alwaysCreate = this.emitter.behaviours.isEmpty();
|
|
34
55
|
this.emitter.behaviours.clear();
|
|
35
56
|
for (let i = 0; i < behavioursConfig.length; i++) {
|
|
36
57
|
const name = behavioursConfig[i].name;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
58
|
+
if (!behavioursConfig[i].enabled) {
|
|
59
|
+
this.emitter.behaviours.removeByName(name);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
const behaviour = this.getExistingOrCreate(name, existingBehaviours);
|
|
63
|
+
behaviour.getParser().read(behavioursConfig[i]);
|
|
64
|
+
this.emitter.behaviours.add(behaviour);
|
|
65
|
+
if (behaviour.name === 'PositionBehaviour') {
|
|
66
|
+
model.update(behaviour);
|
|
67
|
+
}
|
|
42
68
|
}
|
|
43
69
|
}
|
|
44
70
|
this.emitter.emitController = this.createEmitController(config.emitController.name || emissions.EmissionTypes.DEFAULT);
|
|
@@ -58,18 +84,29 @@ export default class EmitterParser {
|
|
|
58
84
|
}
|
|
59
85
|
return this.emitter;
|
|
60
86
|
};
|
|
87
|
+
/**
|
|
88
|
+
* @function update
|
|
89
|
+
* @description Updates the emitter configuration from a json object
|
|
90
|
+
* @param {Object} config - the emitter configuration
|
|
91
|
+
* @param {Model} model - the model to be updated
|
|
92
|
+
* @returns {Emitter} - the emitter
|
|
93
|
+
*/
|
|
61
94
|
this.update = (config, model) => {
|
|
62
95
|
const behavioursConfig = config.behaviours;
|
|
63
96
|
const existingBehaviours = this.emitter.behaviours.getAll();
|
|
64
|
-
const alwaysCreate = this.emitter.behaviours.isEmpty();
|
|
65
97
|
this.emitter.behaviours.clear();
|
|
66
98
|
for (let i = 0; i < behavioursConfig.length; i++) {
|
|
67
99
|
const name = behavioursConfig[i].name;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
100
|
+
if (!behavioursConfig[i].enabled) {
|
|
101
|
+
this.emitter.behaviours.removeByName(name);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
const behaviour = this.getExistingOrCreate(name, existingBehaviours);
|
|
105
|
+
behaviour.getParser().read(behavioursConfig[i]);
|
|
106
|
+
this.emitter.behaviours.add(behaviour);
|
|
107
|
+
if (behaviour.name === 'PositionBehaviour') {
|
|
108
|
+
model.update(behaviour);
|
|
109
|
+
}
|
|
73
110
|
}
|
|
74
111
|
}
|
|
75
112
|
this.emitter.emitController.getParser().read(config.emitController);
|
|
@@ -89,6 +126,12 @@ export default class EmitterParser {
|
|
|
89
126
|
}
|
|
90
127
|
return this.emitter;
|
|
91
128
|
};
|
|
129
|
+
/**
|
|
130
|
+
* Retrieves an existing behaviour or creates a new behaviour
|
|
131
|
+
* @param {string} name - The name of the behaviour to retreive or create
|
|
132
|
+
* @param {any[]} existingBehaviours - An array of existing behaviours
|
|
133
|
+
* @return {any} The existing behaviour or a new behaviour
|
|
134
|
+
*/
|
|
92
135
|
this.getExistingOrCreate = (name, existingBehaviours) => {
|
|
93
136
|
for (let i = 0; i < existingBehaviours.length; i++) {
|
|
94
137
|
if (existingBehaviours[i].getName() === name) {
|
|
@@ -97,14 +140,29 @@ export default class EmitterParser {
|
|
|
97
140
|
}
|
|
98
141
|
return this.createBehaviour(name);
|
|
99
142
|
};
|
|
143
|
+
/**
|
|
144
|
+
* Creates a new behaviour
|
|
145
|
+
* @param {string} name - The name of the behaviour to create
|
|
146
|
+
* @return {any} The new behaviour
|
|
147
|
+
*/
|
|
100
148
|
this.createBehaviour = (name) => {
|
|
101
149
|
// @ts-ignore
|
|
102
150
|
return new behaviours[name]();
|
|
103
151
|
};
|
|
152
|
+
/**
|
|
153
|
+
* Creates a new behaviour properties
|
|
154
|
+
* @param {string} name - The name of the behaviour to create
|
|
155
|
+
* @return {any} The new behaviour properties
|
|
156
|
+
*/
|
|
104
157
|
this.createBehaviourProps = (name) => {
|
|
105
158
|
// @ts-ignore
|
|
106
159
|
return new behaviours[name]().getProps();
|
|
107
160
|
};
|
|
161
|
+
/**
|
|
162
|
+
* Creates a new emission controller
|
|
163
|
+
* @param {string} name - The name of the emission controller to create
|
|
164
|
+
* @return {any} The new emission controller
|
|
165
|
+
*/
|
|
108
166
|
this.createEmitController = (name) => {
|
|
109
167
|
// @ts-ignore
|
|
110
168
|
return new emissions[name]();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmitterParser.js","sourceRoot":"","sources":["../../../src/lib/parser/EmitterParser.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,OAAO,mBAAmB,MAAM,uBAAuB,CAAA;AACvD,OAAO,KAAK,SAAS,MAAM,aAAa,CAAA;AACxC,OAAO,KAAK,UAAU,MAAM,cAAc,CAAA;AAI1C,MAAM,CAAC,OAAO,OAAO,aAAa;
|
|
1
|
+
{"version":3,"file":"EmitterParser.js","sourceRoot":"","sources":["../../../src/lib/parser/EmitterParser.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,OAAO,mBAAmB,MAAM,uBAAuB,CAAA;AACvD,OAAO,KAAK,SAAS,MAAM,aAAa,CAAA;AACxC,OAAO,KAAK,UAAU,MAAM,cAAc,CAAA;AAI1C;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,aAAa;IAOhC;;;OAGG;IACH,YAAY,OAAY;QAIxB;;;;WAIG;QACH,UAAK,GAAG,GAAG,EAAE;YACX,MAAM,MAAM,GAAQ,EAAE,UAAU,EAAE,EAAE,EAAE,CAAA;YACtC,MAAM,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,CAAA;YAE1D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,iBAAiB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACjD,MAAM,eAAe,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,CAAA;gBAChE,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;aACxC;YAED,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,CAAA;YACvE,OAAO,MAAM,CAAC,cAAc,CAAC,OAAO,CAAA;YACpC,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO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