custom-pixi-particles 4.0.5 → 4.0.7
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.js +10 -17
- package/dist/index.js.map +1 -1
- package/dist/lib/Particle.d.ts +1 -1
- package/dist/lib/Particle.js +24 -28
- package/dist/lib/Particle.js.map +1 -1
- package/dist/lib/ParticlePool.js +15 -22
- package/dist/lib/ParticlePool.js.map +1 -1
- package/dist/lib/behaviour/AngularVelocityBehaviour.js +27 -51
- package/dist/lib/behaviour/AngularVelocityBehaviour.js.map +1 -1
- package/dist/lib/behaviour/Behaviour.js +11 -19
- package/dist/lib/behaviour/Behaviour.js.map +1 -1
- package/dist/lib/behaviour/BehaviourNames.js +1 -3
- package/dist/lib/behaviour/BehaviourNames.js.map +1 -1
- package/dist/lib/behaviour/ColorBehaviour.js +34 -58
- package/dist/lib/behaviour/ColorBehaviour.js.map +1 -1
- package/dist/lib/behaviour/EmitDirectionBehaviour.js +34 -66
- package/dist/lib/behaviour/EmitDirectionBehaviour.js.map +1 -1
- package/dist/lib/behaviour/EmitterBehaviours.js +29 -34
- package/dist/lib/behaviour/EmitterBehaviours.js.map +1 -1
- package/dist/lib/behaviour/LifeBehaviour.js +17 -38
- package/dist/lib/behaviour/LifeBehaviour.js.map +1 -1
- package/dist/lib/behaviour/PositionBehaviour.js +55 -76
- package/dist/lib/behaviour/PositionBehaviour.js.map +1 -1
- package/dist/lib/behaviour/RotationBehaviour.js +32 -64
- package/dist/lib/behaviour/RotationBehaviour.js.map +1 -1
- package/dist/lib/behaviour/SizeBehaviour.js +30 -51
- package/dist/lib/behaviour/SizeBehaviour.js.map +1 -1
- package/dist/lib/behaviour/TurbulenceBehaviour.js +54 -78
- package/dist/lib/behaviour/TurbulenceBehaviour.js.map +1 -1
- package/dist/lib/behaviour/index.js +12 -28
- package/dist/lib/behaviour/index.js.map +1 -1
- package/dist/lib/customPixiParticlesSettingsInterface.js +1 -2
- package/dist/lib/emission/AbstractEmission.js +12 -18
- package/dist/lib/emission/AbstractEmission.js.map +1 -1
- package/dist/lib/emission/EmissionTypes.js +1 -3
- package/dist/lib/emission/EmissionTypes.js.map +1 -1
- package/dist/lib/emission/RandomEmission.js +26 -55
- package/dist/lib/emission/RandomEmission.js.map +1 -1
- package/dist/lib/emission/StandardEmission.js +26 -55
- package/dist/lib/emission/StandardEmission.js.map +1 -1
- package/dist/lib/emission/UniformEmission.js +31 -64
- package/dist/lib/emission/UniformEmission.js.map +1 -1
- package/dist/lib/emission/index.js +6 -16
- package/dist/lib/emission/index.js.map +1 -1
- package/dist/lib/emitter/Duration.js +14 -19
- package/dist/lib/emitter/Duration.js.map +1 -1
- package/dist/lib/emitter/Emitter.d.ts +2 -2
- package/dist/lib/emitter/Emitter.js +84 -164
- package/dist/lib/emitter/Emitter.js.map +1 -1
- package/dist/lib/emitter/index.js +3 -10
- package/dist/lib/emitter/index.js.map +1 -1
- package/dist/lib/index.js +19 -47
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/parser/BehaviourParser.js +18 -23
- package/dist/lib/parser/BehaviourParser.js.map +1 -1
- package/dist/lib/parser/CompatibilityHelper.js +7 -13
- package/dist/lib/parser/CompatibilityHelper.js.map +1 -1
- package/dist/lib/parser/EmitControllerParser.js +10 -15
- package/dist/lib/parser/EmitControllerParser.js.map +1 -1
- package/dist/lib/parser/EmitterParser.js +57 -88
- package/dist/lib/parser/EmitterParser.js.map +1 -1
- package/dist/lib/parser/index.js +5 -14
- package/dist/lib/parser/index.js.map +1 -1
- package/dist/lib/pixi/Renderer.d.ts +1 -1
- package/dist/lib/pixi/Renderer.js +155 -181
- package/dist/lib/pixi/Renderer.js.map +1 -1
- package/dist/lib/pixi/TestRenderer.d.ts +2 -2
- package/dist/lib/pixi/TestRenderer.js +154 -180
- package/dist/lib/pixi/TestRenderer.js.map +1 -1
- package/dist/lib/util/Color.js +60 -88
- package/dist/lib/util/Color.js.map +1 -1
- package/dist/lib/util/List.js +17 -21
- package/dist/lib/util/List.js.map +1 -1
- package/dist/lib/util/Point.js +17 -22
- package/dist/lib/util/Point.js.map +1 -1
- package/dist/lib/util/Random.js +8 -14
- package/dist/lib/util/Random.js.map +1 -1
- package/dist/lib/util/index.js +5 -14
- package/dist/lib/util/index.js.map +1 -1
- package/dist/lib/util/maths.js +6 -8
- package/dist/lib/util/maths.js.map +1 -1
- package/dist/lib/util/turbulencePool.js +3 -8
- package/dist/lib/util/turbulencePool.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,42 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
-
if (k2 === undefined) k2 = k;
|
|
19
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
-
}
|
|
23
|
-
Object.defineProperty(o, k2, desc);
|
|
24
|
-
}) : (function(o, m, k, k2) {
|
|
25
|
-
if (k2 === undefined) k2 = k;
|
|
26
|
-
o[k2] = m[k];
|
|
27
|
-
}));
|
|
28
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
-
}) : function(o, v) {
|
|
31
|
-
o["default"] = v;
|
|
32
|
-
});
|
|
33
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
37
|
-
__setModuleDefault(result, mod);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
41
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
42
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -46,98 +7,60 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
46
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
47
8
|
});
|
|
48
9
|
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
67
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
68
|
-
if (t[2]) _.ops.pop();
|
|
69
|
-
_.trys.pop(); continue;
|
|
70
|
-
}
|
|
71
|
-
op = body.call(thisArg, _);
|
|
72
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
73
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
77
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
78
|
-
};
|
|
79
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
80
|
-
var Duration_1 = __importDefault(require("./Duration"));
|
|
81
|
-
var behaviour_1 = require("../behaviour");
|
|
82
|
-
var eventemitter3 = require("eventemitter3");
|
|
83
|
-
var ParticlePool_1 = __importDefault(require("../ParticlePool"));
|
|
84
|
-
var parser_1 = require("../parser");
|
|
85
|
-
var List_1 = __importDefault(require("../util/List"));
|
|
86
|
-
var emission = __importStar(require("../emission"));
|
|
87
|
-
var turbulencePool_1 = __importDefault(require("../util/turbulencePool"));
|
|
88
|
-
var pixi_js_1 = require("pixi.js");
|
|
89
|
-
var Emitter = /** @class */ (function (_super) {
|
|
90
|
-
__extends(Emitter, _super);
|
|
91
|
-
function Emitter() {
|
|
92
|
-
var _this = _super.call(this) || this;
|
|
93
|
-
_this.list = new List_1.default();
|
|
94
|
-
_this.duration = new Duration_1.default();
|
|
95
|
-
_this.alpha = 1;
|
|
96
|
-
_this.blendMode = pixi_js_1.BLEND_MODES.NONE;
|
|
97
|
-
_this.behaviours = new behaviour_1.EmitterBehaviours();
|
|
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 turbulencePool from '../util/turbulencePool';
|
|
18
|
+
import { BLEND_MODES } from 'pixi.js-legacy';
|
|
19
|
+
export default class Emitter extends eventemitter3 {
|
|
20
|
+
constructor() {
|
|
21
|
+
super();
|
|
22
|
+
this.list = new List();
|
|
23
|
+
this.duration = new Duration();
|
|
24
|
+
this.alpha = 1;
|
|
25
|
+
this.blendMode = BLEND_MODES.NONE;
|
|
26
|
+
this.behaviours = new EmitterBehaviours();
|
|
98
27
|
// @ts-ignore
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
this.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
_this.emit(Emitter.COMPLETE);
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
return [2 /*return*/];
|
|
118
|
-
});
|
|
28
|
+
this.emitController = new emission[emission.EmissionTypes.DEFAULT]();
|
|
29
|
+
}
|
|
30
|
+
update(deltaTime) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
if (!this._play)
|
|
33
|
+
return;
|
|
34
|
+
this.emitParticles(deltaTime);
|
|
35
|
+
this.updateParticles(deltaTime);
|
|
36
|
+
this.duration.update(deltaTime);
|
|
37
|
+
if (this.duration.isTimeElapsed() && this.list.isEmpty()) {
|
|
38
|
+
this.stop();
|
|
39
|
+
setTimeout(() => {
|
|
40
|
+
this.emit(Emitter.COMPLETE);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
119
43
|
});
|
|
120
|
-
}
|
|
121
|
-
|
|
44
|
+
}
|
|
45
|
+
emitParticles(deltaTime) {
|
|
122
46
|
if (!this.duration.isTimeElapsed()) {
|
|
123
47
|
this.createParticles(deltaTime);
|
|
124
48
|
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
for (
|
|
129
|
-
|
|
49
|
+
}
|
|
50
|
+
createParticles(deltaTime) {
|
|
51
|
+
const particlesToEmit = this.emitController.howMany(deltaTime, this.list.length);
|
|
52
|
+
for (let i = 0; i < particlesToEmit; ++i) {
|
|
53
|
+
const particle = this.list.add(ParticlePool.global.pop());
|
|
130
54
|
this.behaviours.init(particle);
|
|
131
55
|
this.emit(Emitter.CREATE, particle);
|
|
132
56
|
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
_this.updateParticle(particle, deltaTime);
|
|
57
|
+
}
|
|
58
|
+
updateParticles(deltaTime) {
|
|
59
|
+
this.list.forEach((particle) => {
|
|
60
|
+
this.updateParticle(particle, deltaTime);
|
|
138
61
|
});
|
|
139
|
-
}
|
|
140
|
-
|
|
62
|
+
}
|
|
63
|
+
updateParticle(particle, deltaTime) {
|
|
141
64
|
if (particle.isDead()) {
|
|
142
65
|
this.removeParticle(particle);
|
|
143
66
|
}
|
|
@@ -150,70 +73,67 @@ var Emitter = /** @class */ (function (_super) {
|
|
|
150
73
|
this.behaviours.apply(particle, deltaTime);
|
|
151
74
|
this.emit(Emitter.UPDATE, particle);
|
|
152
75
|
}
|
|
153
|
-
}
|
|
154
|
-
|
|
76
|
+
}
|
|
77
|
+
removeParticle(particle) {
|
|
155
78
|
this.emit(Emitter.REMOVE, particle);
|
|
156
79
|
this.list.remove(particle);
|
|
157
80
|
particle.reset();
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
return new
|
|
163
|
-
}
|
|
164
|
-
|
|
81
|
+
ParticlePool.global.push(particle);
|
|
82
|
+
turbulencePool.list.remove(particle);
|
|
83
|
+
}
|
|
84
|
+
getParser() {
|
|
85
|
+
return new EmitterParser(this);
|
|
86
|
+
}
|
|
87
|
+
createBehaviourProps(name) {
|
|
165
88
|
return this.getParser().createBehaviourProps(name);
|
|
166
|
-
}
|
|
167
|
-
|
|
89
|
+
}
|
|
90
|
+
play() {
|
|
168
91
|
this.duration.start();
|
|
169
92
|
this._play = true;
|
|
170
93
|
this.emit(Emitter.PLAY);
|
|
171
|
-
}
|
|
172
|
-
|
|
94
|
+
}
|
|
95
|
+
resetAndPlay() {
|
|
173
96
|
this.reset();
|
|
174
97
|
this.play();
|
|
175
|
-
}
|
|
176
|
-
|
|
98
|
+
}
|
|
99
|
+
resetWithoutRemovingAndPlay() {
|
|
177
100
|
this.resetWithoutRemoving();
|
|
178
101
|
this.play();
|
|
179
|
-
}
|
|
180
|
-
|
|
102
|
+
}
|
|
103
|
+
reset() {
|
|
181
104
|
this.emitController.reset();
|
|
182
105
|
this.duration.reset();
|
|
183
106
|
this.removeParticles();
|
|
184
107
|
this.emit(Emitter.RESET);
|
|
185
|
-
}
|
|
186
|
-
|
|
108
|
+
}
|
|
109
|
+
resetWithoutRemoving() {
|
|
187
110
|
this.emitController.reset();
|
|
188
111
|
this.duration.reset();
|
|
189
112
|
this.emit(Emitter.RESET);
|
|
190
|
-
}
|
|
191
|
-
|
|
113
|
+
}
|
|
114
|
+
stop() {
|
|
192
115
|
this._play = false;
|
|
193
116
|
this.removeParticles();
|
|
194
117
|
this.emit(Emitter.STOP);
|
|
195
|
-
}
|
|
196
|
-
|
|
118
|
+
}
|
|
119
|
+
stopWithoutKilling() {
|
|
197
120
|
this.duration.stop();
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
_this.removeParticle(particle);
|
|
121
|
+
}
|
|
122
|
+
removeParticles() {
|
|
123
|
+
this.list.forEach((particle) => {
|
|
124
|
+
this.removeParticle(particle);
|
|
203
125
|
});
|
|
204
|
-
|
|
205
|
-
|
|
126
|
+
turbulencePool.list.forEach((particle) => {
|
|
127
|
+
this.removeParticle(particle);
|
|
206
128
|
});
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}(eventemitter3));
|
|
218
|
-
exports.default = Emitter;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
Emitter.PLAY = 'emitter/play';
|
|
132
|
+
Emitter.STOP = 'emitter/stop';
|
|
133
|
+
Emitter.RESET = 'emitter/reset';
|
|
134
|
+
Emitter.CREATE = 'emitter/create';
|
|
135
|
+
Emitter.UPDATE = 'emitter/update';
|
|
136
|
+
Emitter.REMOVE = 'emitter/remove';
|
|
137
|
+
Emitter.FINISHING = 'emitter/finishing';
|
|
138
|
+
Emitter.COMPLETE = 'emitter/complete';
|
|
219
139
|
//# sourceMappingURL=Emitter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Emitter.js","sourceRoot":"","sources":["../../../src/lib/emitter/Emitter.ts"],"names":[],"mappings":"
|
|
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;AAE5C,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,aAAa;IAkBhD;QACE,KAAK,EAAE,CAAA;QAVT,SAAI,GAAS,IAAI,IAAI,EAAE,CAAA;QACvB,aAAQ,GAAa,IAAI,QAAQ,EAAE,CAAA;QAEnC,UAAK,GAAW,CAAC,CAAA;QACjB,cAAS,GAAgB,WAAW,CAAC,IAAI,CAAA;QACzC,eAAU,GAAsB,IAAI,iBAAiB,EAAE,CAAA;QAOrD,aAAa;QACb,IAAI,CAAC,cAAc,GAAG,IAAI,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,CAAA;IACtE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AAQ,CAAC,CAAA;QAC/B,CAAC,CAAC,CAAA;IACJ,CAAC;;AAvIM,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,11 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Duration = exports.Emitter = void 0;
|
|
7
|
-
var Emitter_1 = __importDefault(require("./Emitter"));
|
|
8
|
-
exports.Emitter = Emitter_1.default;
|
|
9
|
-
var Duration_1 = __importDefault(require("./Duration"));
|
|
10
|
-
exports.Duration = Duration_1.default;
|
|
1
|
+
import Emitter from './Emitter';
|
|
2
|
+
import Duration from './Duration';
|
|
3
|
+
export { Emitter, Duration };
|
|
11
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/emitter/index.ts"],"names":[],"mappings":"
|
|
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"}
|
package/dist/lib/index.js
CHANGED
|
@@ -1,49 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
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,
|
|
24
19
|
};
|
|
25
|
-
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
var controller = __importStar(require("./emission"));
|
|
30
|
-
var behaviour = __importStar(require("./behaviour"));
|
|
31
|
-
var parser = __importStar(require("./parser"));
|
|
32
|
-
var Particle_1 = __importDefault(require("./Particle"));
|
|
33
|
-
var ParticlePool_1 = __importDefault(require("./ParticlePool"));
|
|
34
|
-
var emitter_1 = require("./emitter");
|
|
35
|
-
var util_1 = require("./util");
|
|
36
|
-
var cpp = {
|
|
37
|
-
Particle: Particle_1.default,
|
|
38
|
-
ParticlePool: ParticlePool_1.default,
|
|
39
|
-
parser: parser,
|
|
40
|
-
controller: controller,
|
|
41
|
-
behaviour: behaviour,
|
|
42
|
-
Color: util_1.Color,
|
|
43
|
-
Point: util_1.Point,
|
|
44
|
-
Random: util_1.Random,
|
|
45
|
-
Duration: emitter_1.Duration,
|
|
46
|
-
Emitter: emitter_1.Emitter,
|
|
47
|
-
};
|
|
48
|
-
exports.default = cpp;
|
|
20
|
+
export default cpp;
|
|
49
21
|
//# sourceMappingURL=index.js.map
|
package/dist/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -1,40 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
this.write = function () {
|
|
8
|
-
var config = JSON.parse(JSON.stringify(_this._behaviour));
|
|
9
|
-
config.name = _this._behaviour.getName();
|
|
1
|
+
import { Color, Point } from '../util';
|
|
2
|
+
export default class BehaviourParser {
|
|
3
|
+
constructor(behaviour) {
|
|
4
|
+
this.write = () => {
|
|
5
|
+
const config = JSON.parse(JSON.stringify(this._behaviour));
|
|
6
|
+
config.name = this._behaviour.getName();
|
|
10
7
|
return config;
|
|
11
8
|
};
|
|
12
|
-
this.read =
|
|
13
|
-
for (
|
|
14
|
-
if (
|
|
15
|
-
|
|
9
|
+
this.read = (config) => {
|
|
10
|
+
for (const key in config) {
|
|
11
|
+
if (this._behaviour[key] instanceof Object) {
|
|
12
|
+
this._behaviour[key].copyFromRawData(config[key]);
|
|
16
13
|
}
|
|
17
14
|
else {
|
|
18
|
-
|
|
15
|
+
this._behaviour[key] = config[key];
|
|
19
16
|
}
|
|
20
17
|
}
|
|
21
18
|
};
|
|
22
|
-
this.writePoint =
|
|
19
|
+
this.writePoint = (point) => {
|
|
23
20
|
return { x: point.x, y: point.y };
|
|
24
21
|
};
|
|
25
|
-
this.readPoint =
|
|
26
|
-
|
|
22
|
+
this.readPoint = (rawData) => {
|
|
23
|
+
const point = new Point();
|
|
27
24
|
if (rawData) {
|
|
28
25
|
point.x = rawData.x || 0;
|
|
29
26
|
point.y = rawData.y || 0;
|
|
30
27
|
}
|
|
31
28
|
return point;
|
|
32
29
|
};
|
|
33
|
-
this.writeColor =
|
|
30
|
+
this.writeColor = (color) => {
|
|
34
31
|
return { hex: color.hex, alpha: color.alpha };
|
|
35
32
|
};
|
|
36
|
-
this.readColor =
|
|
37
|
-
|
|
33
|
+
this.readColor = (rawData) => {
|
|
34
|
+
const color = new Color();
|
|
38
35
|
if (rawData) {
|
|
39
36
|
color.hex = rawData.hex || 0;
|
|
40
37
|
color.alpha = rawData.alpha || 0;
|
|
@@ -43,7 +40,5 @@ var BehaviourParser = /** @class */ (function () {
|
|
|
43
40
|
};
|
|
44
41
|
this._behaviour = behaviour;
|
|
45
42
|
}
|
|
46
|
-
|
|
47
|
-
}());
|
|
48
|
-
exports.default = BehaviourParser;
|
|
43
|
+
}
|
|
49
44
|
//# sourceMappingURL=BehaviourParser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BehaviourParser.js","sourceRoot":"","sources":["../../../src/lib/parser/BehaviourParser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BehaviourParser.js","sourceRoot":"","sources":["../../../src/lib/parser/BehaviourParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEtC,MAAM,CAAC,OAAO,OAAO,eAAe;IAGlC,YAAY,SAAc;QAI1B,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,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;QAEO,eAAU,GAAG,CAAC,KAAY,EAAE,EAAE;YACpC,OAAO,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAA;QACnC,CAAC,CAAA;QAEO,cAAS,GAAG,CAAC,OAAc,EAAE,EAAE;YACrC,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAA;YACzB,IAAI,OAAO,EAAE;gBACX,KAAK,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,CAAA;gBACxB,KAAK,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,CAAA;aACzB;YACD,OAAO,KAAK,CAAA;QACd,CAAC,CAAA;QAEO,eAAU,GAAG,CAAC,KAAY,EAAE,EAAE;YACpC,OAAO,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAA;QAC/C,CAAC,CAAA;QAEO,cAAS,GAAG,CAAC,OAAc,EAAE,EAAE;YACrC,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAA;YACzB,IAAI,OAAO,EAAE;gBACX,KAAK,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,CAAA;gBAC5B,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,CAAA;aACjC;YACD,OAAO,KAAK,CAAA;QACd,CAAC,CAAA;QA3CC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAA;IAC7B,CAAC;CA2CF"}
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export default class CompatibilityHelper {
|
|
2
|
+
}
|
|
3
|
+
CompatibilityHelper.readDuration = (config) => {
|
|
4
|
+
if (config.duration) {
|
|
5
|
+
return config.duration;
|
|
5
6
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return config.duration;
|
|
9
|
-
}
|
|
10
|
-
return -1;
|
|
11
|
-
};
|
|
12
|
-
return CompatibilityHelper;
|
|
13
|
-
}());
|
|
14
|
-
exports.default = CompatibilityHelper;
|
|
7
|
+
return -1;
|
|
8
|
+
};
|
|
15
9
|
//# sourceMappingURL=CompatibilityHelper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompatibilityHelper.js","sourceRoot":"","sources":["../../../src/lib/parser/CompatibilityHelper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CompatibilityHelper.js","sourceRoot":"","sources":["../../../src/lib/parser/CompatibilityHelper.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,OAAO,mBAAmB;;AAC/B,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,23 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
this.write = function () {
|
|
7
|
-
var config = JSON.parse(JSON.stringify(_this._controller));
|
|
8
|
-
config.name = _this._controller.getName();
|
|
1
|
+
export default class EmitControllerParser {
|
|
2
|
+
constructor(controller) {
|
|
3
|
+
this.write = () => {
|
|
4
|
+
const config = JSON.parse(JSON.stringify(this._controller));
|
|
5
|
+
config.name = this._controller.getName();
|
|
9
6
|
return config;
|
|
10
7
|
};
|
|
11
|
-
this.read =
|
|
12
|
-
for (
|
|
13
|
-
if (!(
|
|
14
|
-
|
|
8
|
+
this.read = (config) => {
|
|
9
|
+
for (const key in config) {
|
|
10
|
+
if (!(this._controller[key] instanceof Object)) {
|
|
11
|
+
this._controller[key] = config[key];
|
|
15
12
|
}
|
|
16
13
|
}
|
|
17
14
|
};
|
|
18
15
|
this._controller = controller;
|
|
19
16
|
}
|
|
20
|
-
|
|
21
|
-
}());
|
|
22
|
-
exports.default = EmitControllerParser;
|
|
17
|
+
}
|
|
23
18
|
//# sourceMappingURL=EmitControllerParser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmitControllerParser.js","sourceRoot":"","sources":["../../../src/lib/parser/EmitControllerParser.ts"],"names":[],"mappings":"
|
|
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;QAfC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAA;IAC/B,CAAC;CAeF"}
|