custom-pixi-particles 8.1.1 → 8.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,72 @@
|
|
|
1
|
+
const deepClone = (obj, hash = new WeakMap()) => {
|
|
2
|
+
if (Object(obj) !== obj || obj instanceof Function)
|
|
3
|
+
return obj; // Primitives or functions
|
|
4
|
+
if (hash.has(obj))
|
|
5
|
+
return hash.get(obj); // Circular reference
|
|
6
|
+
let result;
|
|
7
|
+
try {
|
|
8
|
+
result = new obj.constructor();
|
|
9
|
+
}
|
|
10
|
+
catch (_a) {
|
|
11
|
+
result = Object.create(Object.getPrototypeOf(obj));
|
|
12
|
+
}
|
|
13
|
+
hash.set(obj, result);
|
|
14
|
+
if (obj instanceof Map) {
|
|
15
|
+
obj.forEach((value, key) => {
|
|
16
|
+
result.set(deepClone(key, hash), deepClone(value, hash));
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
else if (obj instanceof Set) {
|
|
20
|
+
obj.forEach((value) => {
|
|
21
|
+
result.add(deepClone(value, hash));
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
for (const key of Reflect.ownKeys(obj)) {
|
|
26
|
+
// Skip cloning functions
|
|
27
|
+
if (typeof obj[key] === 'function') {
|
|
28
|
+
result[key] = obj[key];
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
result[key] = deepClone(obj[key], hash);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Class used to parse a behaviour object into a JSON config object and vice versa
|
|
39
|
+
*/
|
|
40
|
+
export default class BehaviourParser {
|
|
41
|
+
/**
|
|
42
|
+
* Constructs a BehaviourParser object.
|
|
43
|
+
* @param {any} behaviour The behaviour to be parsed.
|
|
44
|
+
*/
|
|
45
|
+
constructor(behaviour) {
|
|
46
|
+
/**
|
|
47
|
+
* Writes the behaviour to a config object.
|
|
48
|
+
* @returns {object} The config object.
|
|
49
|
+
*/
|
|
50
|
+
this.write = () => {
|
|
51
|
+
const config = deepClone(this._behaviour.getProps());
|
|
52
|
+
config.name = this._behaviour.getName();
|
|
53
|
+
return config;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Reads a config object and sets the behaviour appropriately.
|
|
57
|
+
* @param {object} config The config object to be read.
|
|
58
|
+
*/
|
|
59
|
+
this.read = (config) => {
|
|
60
|
+
for (const key in config) {
|
|
61
|
+
if (this._behaviour[key] instanceof Object && typeof this._behaviour[key].copyFromRawData === 'function') {
|
|
62
|
+
this._behaviour[key].copyFromRawData(config[key]);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
this._behaviour[key] = config[key];
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
this._behaviour = behaviour;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=BehaviourParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BehaviourParser.js","sourceRoot":"","sources":["../../../src/lib/parser/BehaviourParser.ts"],"names":[],"mappings":"AAAA,MAAM,SAAS,GAAG,CAAC,GAAQ,EAAE,IAAI,GAAG,IAAI,OAAO,EAAE,EAAE,EAAE;IACnD,IAAI,MAAM,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI,GAAG,YAAY,QAAQ;QAAE,OAAO,GAAG,CAAA,CAAC,0BAA0B;IACzF,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA,CAAC,qBAAqB;IAE7D,IAAI,MAAW,CAAA;IACf,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,GAAG,CAAC,WAAW,EAAE,CAAA;IAChC,CAAC;IAAC,WAAM,CAAC;QACP,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAA;IACpD,CAAC;IAED,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;IAErB,IAAI,GAAG,YAAY,GAAG,EAAE,CAAC;QACvB,GAAG,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YACzB,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAA;QAC1D,CAAC,CAAC,CAAA;IACJ,CAAC;SAAM,IAAI,GAAG,YAAY,GAAG,EAAE,CAAC;QAC9B,GAAG,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YACpB,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAA;QACpC,CAAC,CAAC,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C;YACH,CAAC;QACH,CAAC,CAAA;QAzBC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAA;IAC7B,CAAC;CAyBF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Class that provides helper methods for checking compatibility.
|
|
3
|
+
*/
|
|
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
|
+
*/
|
|
11
|
+
static readDuration: (config: any) => any;
|
|
12
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Class that provides helper methods for checking compatibility.
|
|
3
|
+
*/
|
|
4
|
+
class CompatibilityHelper {
|
|
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
|
+
*/
|
|
12
|
+
CompatibilityHelper.readDuration = (config) => {
|
|
13
|
+
if (config.duration) {
|
|
14
|
+
return config.duration;
|
|
15
|
+
}
|
|
16
|
+
return -1;
|
|
17
|
+
};
|
|
18
|
+
export default CompatibilityHelper;
|
|
19
|
+
//# sourceMappingURL=CompatibilityHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompatibilityHelper.js","sourceRoot":"","sources":["../../../src/lib/parser/CompatibilityHelper.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAqB,mBAAmB;;AACtC;;;;;GAKG;AACI,gCAAY,GAAG,CAAC,MAAW,EAAE,EAAE;IACpC,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpB,OAAO,MAAM,CAAC,QAAQ,CAAA;IACxB,CAAC;IAED,OAAO,CAAC,CAAC,CAAA;AACX,CAAC,CAAA;eAbkB,mBAAmB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EmitControllerParser is used to write and read configuration data.
|
|
3
|
+
*
|
|
4
|
+
* @class EmitControllerParser
|
|
5
|
+
*/
|
|
6
|
+
export default class EmitControllerParser {
|
|
7
|
+
private readonly _controller;
|
|
8
|
+
/**
|
|
9
|
+
* The constructor of the class.
|
|
10
|
+
*
|
|
11
|
+
* @constructor
|
|
12
|
+
* @param {any} controller The controller object.
|
|
13
|
+
*/
|
|
14
|
+
constructor(controller: any);
|
|
15
|
+
/**
|
|
16
|
+
* Writes the configuration data to a JSON format.
|
|
17
|
+
*
|
|
18
|
+
* @returns {object} The configuration object.
|
|
19
|
+
*/
|
|
20
|
+
write: () => any;
|
|
21
|
+
/**
|
|
22
|
+
* Reads the configuration data from a JSON format.
|
|
23
|
+
*
|
|
24
|
+
* @param {object} config The configuration object.
|
|
25
|
+
*/
|
|
26
|
+
read: (config: any) => void;
|
|
27
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EmitControllerParser is used to write and read configuration data.
|
|
3
|
+
*
|
|
4
|
+
* @class EmitControllerParser
|
|
5
|
+
*/
|
|
6
|
+
export default class EmitControllerParser {
|
|
7
|
+
/**
|
|
8
|
+
* The constructor of the class.
|
|
9
|
+
*
|
|
10
|
+
* @constructor
|
|
11
|
+
* @param {any} controller The controller object.
|
|
12
|
+
*/
|
|
13
|
+
constructor(controller) {
|
|
14
|
+
/**
|
|
15
|
+
* Writes the configuration data to a JSON format.
|
|
16
|
+
*
|
|
17
|
+
* @returns {object} The configuration object.
|
|
18
|
+
*/
|
|
19
|
+
this.write = () => {
|
|
20
|
+
const config = JSON.parse(JSON.stringify(this._controller));
|
|
21
|
+
config.name = this._controller.getName();
|
|
22
|
+
return config;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Reads the configuration data from a JSON format.
|
|
26
|
+
*
|
|
27
|
+
* @param {object} config The configuration object.
|
|
28
|
+
*/
|
|
29
|
+
this.read = (config) => {
|
|
30
|
+
for (const key in config) {
|
|
31
|
+
if (!(this._controller[key] instanceof Object)) {
|
|
32
|
+
this._controller[key] = config[key];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
this._controller = controller;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=EmitControllerParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,CAAC;gBACzB,IAAI,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,YAAY,MAAM,CAAC,EAAE,CAAC;oBAC/C,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;gBACrC,CAAC;YACH,CAAC;QACH,CAAC,CAAA;QAzBC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAA;IAC/B,CAAC;CAyBF"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Emitter } from '../emitter';
|
|
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
|
+
*/
|
|
8
|
+
export default class EmitterParser {
|
|
9
|
+
/**
|
|
10
|
+
* @memberof EmitterParser
|
|
11
|
+
* @property {Emitter} emitter - the emitter object to be parsed
|
|
12
|
+
*/
|
|
13
|
+
private readonly emitter;
|
|
14
|
+
/**
|
|
15
|
+
* @constructor
|
|
16
|
+
* @param {Emitter} emitter - the emitter object to be parsed
|
|
17
|
+
*/
|
|
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
|
+
*/
|
|
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
|
+
*/
|
|
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
|
+
* @param {boolean} resetDuration - should duration be reset
|
|
39
|
+
* @returns {Emitter} - the emitter
|
|
40
|
+
*/
|
|
41
|
+
update: (config: any, model: Model, resetDuration: boolean) => Emitter;
|
|
42
|
+
/**
|
|
43
|
+
* Retrieves an existing behaviour or creates a new behaviour
|
|
44
|
+
* @param {string} name - The name of the behaviour to retreive or create
|
|
45
|
+
* @param {any[]} existingBehaviours - An array of existing behaviours
|
|
46
|
+
* @return {any} The existing behaviour or a new behaviour
|
|
47
|
+
*/
|
|
48
|
+
getExistingOrCreate: (name: string, existingBehaviours: any) => any;
|
|
49
|
+
/**
|
|
50
|
+
* Creates a new behaviour
|
|
51
|
+
* @param {string} name - The name of the behaviour to create
|
|
52
|
+
* @return {any} The new behaviour
|
|
53
|
+
*/
|
|
54
|
+
createBehaviour: (name: string) => any;
|
|
55
|
+
/**
|
|
56
|
+
* Creates a new behaviour properties
|
|
57
|
+
* @param {string} name - The name of the behaviour to create
|
|
58
|
+
* @return {any} The new behaviour properties
|
|
59
|
+
*/
|
|
60
|
+
createBehaviourProps: (name: string) => any;
|
|
61
|
+
/**
|
|
62
|
+
* Creates a new emission controller
|
|
63
|
+
* @param {string} name - The name of the emission controller to create
|
|
64
|
+
* @return {any} The new emission controller
|
|
65
|
+
*/
|
|
66
|
+
createEmitController: (name: string) => any;
|
|
67
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
// tslint:disable:prefer-for-of
|
|
2
|
+
import CompatibilityHelper from './CompatibilityHelper';
|
|
3
|
+
import * as emissions from '../emission';
|
|
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
|
+
*/
|
|
10
|
+
export default class EmitterParser {
|
|
11
|
+
/**
|
|
12
|
+
* @constructor
|
|
13
|
+
* @param {Emitter} emitter - the emitter object to be parsed
|
|
14
|
+
*/
|
|
15
|
+
constructor(emitter) {
|
|
16
|
+
/**
|
|
17
|
+
* @function write
|
|
18
|
+
* @description Writes the emitter configuration to a json object
|
|
19
|
+
* @returns {Object} - the emitter configuration
|
|
20
|
+
*/
|
|
21
|
+
this.write = () => {
|
|
22
|
+
const config = { behaviours: [] };
|
|
23
|
+
const emitterBehaviours = this.emitter.behaviours.getAll();
|
|
24
|
+
for (let i = 0; i < emitterBehaviours.length; i++) {
|
|
25
|
+
const behaviourConfig = emitterBehaviours[i].getParser().write();
|
|
26
|
+
config.behaviours.push(behaviourConfig);
|
|
27
|
+
}
|
|
28
|
+
config.emitController = this.emitter.emitController.getParser().write();
|
|
29
|
+
delete config.emitController._frames;
|
|
30
|
+
config.duration = this.emitter.duration.maxTime;
|
|
31
|
+
if (typeof this.emitter.alpha !== 'undefined') {
|
|
32
|
+
config.alpha = this.emitter.alpha;
|
|
33
|
+
}
|
|
34
|
+
if (typeof this.emitter.anchor !== 'undefined') {
|
|
35
|
+
config.anchor = this.emitter.anchor;
|
|
36
|
+
}
|
|
37
|
+
if (typeof this.emitter.blendMode !== 'undefined') {
|
|
38
|
+
config.blendMode = this.emitter.blendMode;
|
|
39
|
+
}
|
|
40
|
+
if (typeof this.emitter.animatedSprite !== 'undefined') {
|
|
41
|
+
config.animatedSprite = this.emitter.animatedSprite;
|
|
42
|
+
}
|
|
43
|
+
return config;
|
|
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
|
+
*/
|
|
52
|
+
this.read = (config, model) => {
|
|
53
|
+
const behavioursConfig = config.behaviours;
|
|
54
|
+
const existingBehaviours = this.emitter.behaviours.getAll();
|
|
55
|
+
const alwaysCreate = this.emitter.behaviours.isEmpty();
|
|
56
|
+
this.emitter.behaviours.clear();
|
|
57
|
+
for (let i = 0; i < behavioursConfig.length; i++) {
|
|
58
|
+
const name = behavioursConfig[i].name;
|
|
59
|
+
const behaviour = alwaysCreate ? this.createBehaviour(name) : this.getExistingOrCreate(name, existingBehaviours);
|
|
60
|
+
behaviour.getParser().read(behavioursConfig[i]);
|
|
61
|
+
this.emitter.behaviours.add(behaviour);
|
|
62
|
+
if (behaviour.name === 'PositionBehaviour') {
|
|
63
|
+
model.update(behaviour);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
this.emitter.emitController = this.createEmitController(config.emitController.name || emissions.EmissionTypes.DEFAULT);
|
|
67
|
+
this.emitter.emitController.getParser().read(config.emitController);
|
|
68
|
+
this.emitter.duration.maxTime = CompatibilityHelper.readDuration(config);
|
|
69
|
+
if (typeof config.alpha !== 'undefined') {
|
|
70
|
+
this.emitter.alpha = config.alpha;
|
|
71
|
+
}
|
|
72
|
+
if (typeof config.anchor !== 'undefined') {
|
|
73
|
+
this.emitter.anchor = config.anchor;
|
|
74
|
+
}
|
|
75
|
+
if (typeof config.blendMode !== 'undefined') {
|
|
76
|
+
this.emitter.blendMode = config.blendMode;
|
|
77
|
+
}
|
|
78
|
+
if (typeof config.animatedSprite !== 'undefined') {
|
|
79
|
+
this.emitter.animatedSprite = config.animatedSprite;
|
|
80
|
+
}
|
|
81
|
+
return this.emitter;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* @function update
|
|
85
|
+
* @description Updates the emitter configuration from a json object
|
|
86
|
+
* @param {Object} config - the emitter configuration
|
|
87
|
+
* @param {Model} model - the model to be updated
|
|
88
|
+
* @param {boolean} resetDuration - should duration be reset
|
|
89
|
+
* @returns {Emitter} - the emitter
|
|
90
|
+
*/
|
|
91
|
+
this.update = (config, model, resetDuration) => {
|
|
92
|
+
const behavioursConfig = config.behaviours;
|
|
93
|
+
const existingBehaviours = this.emitter.behaviours.getAll();
|
|
94
|
+
const alwaysCreate = this.emitter.behaviours.isEmpty();
|
|
95
|
+
this.emitter.behaviours.clear();
|
|
96
|
+
for (let i = 0; i < behavioursConfig.length; i++) {
|
|
97
|
+
const name = behavioursConfig[i].name;
|
|
98
|
+
const behaviour = alwaysCreate ? this.createBehaviour(name) : this.getExistingOrCreate(name, existingBehaviours);
|
|
99
|
+
behaviour.getParser().read(behavioursConfig[i]);
|
|
100
|
+
this.emitter.behaviours.add(behaviour);
|
|
101
|
+
if (behaviour.name === 'PositionBehaviour') {
|
|
102
|
+
model.update(behaviour);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
this.emitter.emitController.getParser().read(config.emitController);
|
|
106
|
+
this.emitter.duration.maxTime = CompatibilityHelper.readDuration(config);
|
|
107
|
+
if (resetDuration) {
|
|
108
|
+
this.emitter.duration.reset();
|
|
109
|
+
}
|
|
110
|
+
if (typeof config.alpha !== 'undefined') {
|
|
111
|
+
this.emitter.alpha = config.alpha;
|
|
112
|
+
}
|
|
113
|
+
if (typeof config.anchor !== 'undefined') {
|
|
114
|
+
this.emitter.anchor = config.anchor;
|
|
115
|
+
}
|
|
116
|
+
if (typeof config.blendMode !== 'undefined') {
|
|
117
|
+
this.emitter.blendMode = config.blendMode;
|
|
118
|
+
}
|
|
119
|
+
if (typeof config.animatedSprite !== 'undefined') {
|
|
120
|
+
this.emitter.animatedSprite = config.animatedSprite;
|
|
121
|
+
}
|
|
122
|
+
return this.emitter;
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Retrieves an existing behaviour or creates a new behaviour
|
|
126
|
+
* @param {string} name - The name of the behaviour to retreive or create
|
|
127
|
+
* @param {any[]} existingBehaviours - An array of existing behaviours
|
|
128
|
+
* @return {any} The existing behaviour or a new behaviour
|
|
129
|
+
*/
|
|
130
|
+
this.getExistingOrCreate = (name, existingBehaviours) => {
|
|
131
|
+
for (let i = 0; i < existingBehaviours.length; i++) {
|
|
132
|
+
if (existingBehaviours[i].getName() === name) {
|
|
133
|
+
return existingBehaviours[i];
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return this.createBehaviour(name);
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Creates a new behaviour
|
|
140
|
+
* @param {string} name - The name of the behaviour to create
|
|
141
|
+
* @return {any} The new behaviour
|
|
142
|
+
*/
|
|
143
|
+
this.createBehaviour = (name) => {
|
|
144
|
+
// @ts-ignore
|
|
145
|
+
return new behaviours[name]();
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Creates a new behaviour properties
|
|
149
|
+
* @param {string} name - The name of the behaviour to create
|
|
150
|
+
* @return {any} The new behaviour properties
|
|
151
|
+
*/
|
|
152
|
+
this.createBehaviourProps = (name) => {
|
|
153
|
+
// @ts-ignore
|
|
154
|
+
return new behaviours[name]().getProps();
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Creates a new emission controller
|
|
158
|
+
* @param {string} name - The name of the emission controller to create
|
|
159
|
+
* @return {any} The new emission controller
|
|
160
|
+
*/
|
|
161
|
+
this.createEmitController = (name) => {
|
|
162
|
+
// @ts-ignore
|
|
163
|
+
return new emissions[name]();
|
|
164
|
+
};
|
|
165
|
+
this.emitter = emitter;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=EmitterParser.js.map
|
|
@@ -0,0 +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;;;;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,CAAC;gBAClD,MAAM,eAAe,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,CAAA;gBAChE,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;YACzC,CAAC;YAED,MAAM,CAAC,c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AAO,EAAE,KAAK,IAAI,EAAE,CAAC;oBAC7C,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAA;gBAC9B,CAAC;YACH,CAAC;YAED,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAA;QACnC,CAAC,CAAA;QAED;;;;WAIG;QACH,oBAAe,GAAG,CAAC,IAAY,EAAE,EAAE;YACjC,aAAa;YACb,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAA;QAC/B,CAAC,CAAA;QAED;;;;WAIG;QACH,yBAAoB,GAAG,CAAC,IAAY,EAAE,EAAE;YACtC,aAAa;YACb,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAA;QAC1C,CAAC,CAAA;QAED;;;;WAIG;QACH,yBAAoB,GAAG,CAAC,IAAY,EAAE,EAAE;YACtC,aAAa;YACb,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,CAAA;QAC9B,CAAC,CAAA;QA3KC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;CA2KF"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import BehaviourParser from './BehaviourParser';
|
|
2
|
+
import CompatibilityHelper from './CompatibilityHelper';
|
|
3
|
+
import EmitControllerParser from './EmitControllerParser';
|
|
4
|
+
import EmitterParser from './EmitterParser';
|
|
5
|
+
export { BehaviourParser, CompatibilityHelper, EmitControllerParser, EmitterParser };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import BehaviourParser from './BehaviourParser';
|
|
2
|
+
import CompatibilityHelper from './CompatibilityHelper';
|
|
3
|
+
import EmitControllerParser from './EmitControllerParser';
|
|
4
|
+
import EmitterParser from './EmitterParser';
|
|
5
|
+
export { BehaviourParser, CompatibilityHelper, EmitControllerParser, EmitterParser };
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/parser/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,mBAAmB,CAAA;AAC/C,OAAO,mBAAmB,MAAM,uBAAuB,CAAA;AACvD,OAAO,oBAAoB,MAAM,wBAAwB,CAAA;AACzD,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAE3C,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { Emitter } from '../emitter';
|
|
2
|
+
import { ICustomPixiParticlesSettings } from '../customPixiParticlesSettingsInterface';
|
|
3
|
+
import { ParticleContainer } from 'pixi.js';
|
|
4
|
+
/**
|
|
5
|
+
* Renderer is a class used to render particles in the Pixi library.
|
|
6
|
+
*
|
|
7
|
+
* @class Renderer
|
|
8
|
+
*/
|
|
9
|
+
export default class Renderer extends ParticleContainer {
|
|
10
|
+
blendMode: any;
|
|
11
|
+
emitter: Emitter;
|
|
12
|
+
turbulenceEmitter: Emitter;
|
|
13
|
+
private _paused;
|
|
14
|
+
private _internalPaused;
|
|
15
|
+
private textures;
|
|
16
|
+
private zeroPad;
|
|
17
|
+
private indexToStart;
|
|
18
|
+
private finishingTextureNames;
|
|
19
|
+
private unusedSprites;
|
|
20
|
+
private emitterParser;
|
|
21
|
+
private turbulenceParser;
|
|
22
|
+
private config;
|
|
23
|
+
private anchor;
|
|
24
|
+
private _model;
|
|
25
|
+
private _ticker;
|
|
26
|
+
private _visibilitychangeBinding;
|
|
27
|
+
/**
|
|
28
|
+
* Creates an instance of Renderer.
|
|
29
|
+
*
|
|
30
|
+
* @memberof Renderer
|
|
31
|
+
*/
|
|
32
|
+
constructor(settings: ICustomPixiParticlesSettings);
|
|
33
|
+
onComplete: any;
|
|
34
|
+
onCompleteFN: any;
|
|
35
|
+
/**
|
|
36
|
+
* Sets the paused state of the object.
|
|
37
|
+
*
|
|
38
|
+
* @param {boolean} [isPaused=true] - The new paused state of the object. Defaults to `true`.
|
|
39
|
+
* @returns {void}
|
|
40
|
+
*/
|
|
41
|
+
pause(isPaused?: boolean): void;
|
|
42
|
+
/**
|
|
43
|
+
* Resumes the object's operation by setting its paused state to false.
|
|
44
|
+
*
|
|
45
|
+
* @returns {void}
|
|
46
|
+
*/
|
|
47
|
+
resume(): void;
|
|
48
|
+
/**
|
|
49
|
+
* Updates the transform of the ParticleContainer and updates the emitters.
|
|
50
|
+
*/
|
|
51
|
+
_updateTransform(deltaTime: number): void;
|
|
52
|
+
/**
|
|
53
|
+
*
|
|
54
|
+
* @method updateTexture
|
|
55
|
+
* @description This method updates the texture of the unused sprites and children to a randomly generated texture.
|
|
56
|
+
*/
|
|
57
|
+
updateTexture(): void;
|
|
58
|
+
/**
|
|
59
|
+
* This method is used to start the emitter and turbulenceEmitter if available.
|
|
60
|
+
* @function start
|
|
61
|
+
*/
|
|
62
|
+
start(): void;
|
|
63
|
+
/**
|
|
64
|
+
* Resets the particle emitters in this class without removing existing particles and plays them.
|
|
65
|
+
* @function play
|
|
66
|
+
*/
|
|
67
|
+
play(): void;
|
|
68
|
+
/**
|
|
69
|
+
* Immediately stops emitting particles
|
|
70
|
+
*/
|
|
71
|
+
stopImmediately(): void;
|
|
72
|
+
/**
|
|
73
|
+
* Destroy particles
|
|
74
|
+
*/
|
|
75
|
+
destroy(): void;
|
|
76
|
+
/**
|
|
77
|
+
* Terminates the emitter and any turbulence emitter it is associated with
|
|
78
|
+
*/
|
|
79
|
+
stop(): void;
|
|
80
|
+
/**
|
|
81
|
+
* Resets the emitters to their initial state
|
|
82
|
+
*/
|
|
83
|
+
resetEmitter(): void;
|
|
84
|
+
/**
|
|
85
|
+
* Sets the textures used by the emitter
|
|
86
|
+
* @param {string[]} textures - Array of strings containing the textures to be used by the emitter
|
|
87
|
+
*/
|
|
88
|
+
setTextures(textures: string[]): void;
|
|
89
|
+
/**
|
|
90
|
+
* Updates the configuration of the emitter
|
|
91
|
+
* @param {any} config - Configuration object to be used to update the emitter
|
|
92
|
+
* @param {boolean} resetDuration - should duration be reset
|
|
93
|
+
*/
|
|
94
|
+
updateConfig(config: any, resetDuration?: boolean): void;
|
|
95
|
+
/**
|
|
96
|
+
* Updates the position of the emitter
|
|
97
|
+
* @param {Object} position - Object containing the x and y coordinates of the new position
|
|
98
|
+
* @param {boolean} resetDuration - should duration be reset
|
|
99
|
+
*/
|
|
100
|
+
updatePosition(position: {
|
|
101
|
+
x: number;
|
|
102
|
+
y: number;
|
|
103
|
+
}, resetDuration?: boolean): void;
|
|
104
|
+
/**
|
|
105
|
+
* Clears the sprite pool, the unused sprites list and the turbulence and particle pools.
|
|
106
|
+
*/
|
|
107
|
+
clearPool(): void;
|
|
108
|
+
private getByName;
|
|
109
|
+
private getOrCreateSprite;
|
|
110
|
+
private createFrameAnimationByName;
|
|
111
|
+
private onCreate;
|
|
112
|
+
private onCreateTurbulence;
|
|
113
|
+
private onUpdate;
|
|
114
|
+
private onUpdateTurbulence;
|
|
115
|
+
private onFinishing;
|
|
116
|
+
private onRemove;
|
|
117
|
+
private onRemoveTurbulence;
|
|
118
|
+
private getRandomTexture;
|
|
119
|
+
private getRandomFinishingTexture;
|
|
120
|
+
private getRandomFrameNumber;
|
|
121
|
+
private paused;
|
|
122
|
+
private internalPause;
|
|
123
|
+
private getConfigIndexByName;
|
|
124
|
+
private buildTurbulenceConfig;
|
|
125
|
+
}
|