custom-pixi-particles 2.0.10 → 3.0.2
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/LICENSE +21 -21
- package/README.md +45 -45
- package/dist/index.d.ts +6 -6
- package/dist/index.js +15 -15
- package/dist/index.js.map +1 -1
- package/dist/lib/Particle.d.ts +44 -45
- package/dist/lib/Particle.js +68 -68
- package/dist/lib/Particle.js.map +1 -1
- package/dist/lib/ParticlePool.d.ts +9 -9
- package/dist/lib/ParticlePool.js +33 -33
- package/dist/lib/behaviour/AngularVelocityBehaviour.d.ts +26 -26
- package/dist/lib/behaviour/AngularVelocityBehaviour.js +77 -77
- package/dist/lib/behaviour/Behaviour.d.ts +7 -7
- package/dist/lib/behaviour/Behaviour.js +26 -26
- package/dist/lib/behaviour/BehaviourNames.d.ts +11 -11
- package/dist/lib/behaviour/BehaviourNames.js +12 -12
- package/dist/lib/behaviour/ColorBehaviour.d.ts +45 -45
- package/dist/lib/behaviour/ColorBehaviour.js +103 -103
- package/dist/lib/behaviour/EmitDirectionBehaviour.d.ts +22 -22
- package/dist/lib/behaviour/EmitDirectionBehaviour.js +83 -83
- package/dist/lib/behaviour/EmitterBehaviours.d.ts +12 -12
- package/dist/lib/behaviour/EmitterBehaviours.js +59 -59
- package/dist/lib/behaviour/LifeBehaviour.d.ts +18 -18
- package/dist/lib/behaviour/LifeBehaviour.js +55 -55
- package/dist/lib/behaviour/PositionBehaviour.d.ts +62 -62
- package/dist/lib/behaviour/PositionBehaviour.js +146 -146
- package/dist/lib/behaviour/RotationBehaviour.d.ts +22 -22
- package/dist/lib/behaviour/RotationBehaviour.js +77 -77
- package/dist/lib/behaviour/SizeBehaviour.d.ts +31 -31
- package/dist/lib/behaviour/SizeBehaviour.js +84 -84
- package/dist/lib/behaviour/TurbulenceBehaviour.d.ts +69 -69
- package/dist/lib/behaviour/TurbulenceBehaviour.js +153 -153
- package/dist/lib/behaviour/index.d.ts +12 -12
- package/dist/lib/behaviour/index.js +28 -28
- package/dist/lib/customPixiParticlesSettingsInterface.d.ts +9 -8
- package/dist/lib/customPixiParticlesSettingsInterface.js +2 -2
- package/dist/lib/emission/AbstractEmission.d.ts +7 -7
- package/dist/lib/emission/AbstractEmission.js +21 -21
- package/dist/lib/emission/EmissionTypes.d.ts +6 -6
- package/dist/lib/emission/EmissionTypes.js +7 -7
- package/dist/lib/emission/RandomEmission.d.ts +11 -11
- package/dist/lib/emission/RandomEmission.js +61 -61
- package/dist/lib/emission/StandardEmission.d.ts +12 -12
- package/dist/lib/emission/StandardEmission.js +65 -65
- package/dist/lib/emission/UniformEmission.d.ts +14 -14
- package/dist/lib/emission/UniformEmission.js +73 -73
- package/dist/lib/emission/index.d.ts +6 -6
- package/dist/lib/emission/index.js +16 -16
- package/dist/lib/emitter/Duration.d.ts +10 -10
- package/dist/lib/emitter/Duration.js +28 -28
- package/dist/lib/emitter/Emitter.d.ts +43 -45
- package/dist/lib/emitter/Emitter.js +213 -214
- package/dist/lib/emitter/Emitter.js.map +1 -1
- package/dist/lib/emitter/index.d.ts +3 -3
- package/dist/lib/emitter/index.js +10 -10
- package/dist/lib/index.d.ts +20 -20
- package/dist/lib/index.js +44 -44
- package/dist/lib/parser/BehaviourParser.d.ts +10 -10
- package/dist/lib/parser/BehaviourParser.js +48 -48
- package/dist/lib/parser/CompatibilityHelper.d.ts +3 -3
- package/dist/lib/parser/CompatibilityHelper.js +14 -14
- package/dist/lib/parser/EmitControllerParser.d.ts +6 -6
- package/dist/lib/parser/EmitControllerParser.js +22 -22
- package/dist/lib/parser/EmitterParser.d.ts +12 -12
- package/dist/lib/parser/EmitterParser.js +126 -126
- package/dist/lib/parser/EmitterParser.js.map +1 -1
- package/dist/lib/parser/index.d.ts +5 -5
- package/dist/lib/parser/index.js +14 -14
- package/dist/lib/pixi/Renderer.d.ts +50 -49
- package/dist/lib/pixi/Renderer.js +427 -437
- package/dist/lib/pixi/Renderer.js.map +1 -1
- package/dist/lib/util/Color.d.ts +32 -32
- package/dist/lib/util/Color.js +98 -98
- package/dist/lib/util/List.d.ts +9 -9
- package/dist/lib/util/List.js +50 -50
- package/dist/lib/util/Point.d.ts +13 -13
- package/dist/lib/util/Point.js +29 -29
- package/dist/lib/util/Random.d.ts +4 -4
- package/dist/lib/util/Random.js +14 -14
- package/dist/lib/util/index.d.ts +5 -5
- package/dist/lib/util/index.js +14 -14
- package/dist/lib/util/maths.d.ts +7 -7
- package/dist/lib/util/maths.js +16 -16
- package/dist/lib/util/turbulencePool.d.ts +5 -5
- package/dist/lib/util/turbulencePool.js +9 -9
- package/package.json +40 -41
|
@@ -1,84 +1,84 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
-
};
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
var Behaviour_1 = __importDefault(require("./Behaviour"));
|
|
22
|
-
var BehaviourNames_1 = __importDefault(require("./BehaviourNames"));
|
|
23
|
-
var maths_1 = __importDefault(require("../util/maths"));
|
|
24
|
-
var _tmp = 0;
|
|
25
|
-
var EmitDirectionBehaviour = /** @class */ (function (_super) {
|
|
26
|
-
__extends(EmitDirectionBehaviour, _super);
|
|
27
|
-
function EmitDirectionBehaviour() {
|
|
28
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
29
|
-
_this.enabled = true;
|
|
30
|
-
_this.priority = 0;
|
|
31
|
-
_this.angle = 0;
|
|
32
|
-
_this.variance = 0;
|
|
33
|
-
_this.init = function (particle) {
|
|
34
|
-
if (!_this.enabled)
|
|
35
|
-
return;
|
|
36
|
-
var directionAngle = _this.angle + _this.varianceFrom(_this.variance);
|
|
37
|
-
particle.directionCos = Math.cos(directionAngle);
|
|
38
|
-
particle.directionSin = Math.sin(directionAngle);
|
|
39
|
-
};
|
|
40
|
-
_this.apply = function (particle, deltaTime) {
|
|
41
|
-
if (!_this.enabled)
|
|
42
|
-
return;
|
|
43
|
-
_tmp = particle.directionCos * particle.x - particle.directionSin * particle.y;
|
|
44
|
-
particle.y = particle.directionSin * particle.x + particle.directionCos * particle.y;
|
|
45
|
-
particle.x = _tmp;
|
|
46
|
-
};
|
|
47
|
-
return _this;
|
|
48
|
-
}
|
|
49
|
-
EmitDirectionBehaviour.prototype.getName = function () {
|
|
50
|
-
return BehaviourNames_1.default.EMIT_DIRECTION;
|
|
51
|
-
};
|
|
52
|
-
Object.defineProperty(EmitDirectionBehaviour.prototype, "angleInDegrees", {
|
|
53
|
-
get: function () {
|
|
54
|
-
return maths_1.default.radiansToDegrees(this.variance);
|
|
55
|
-
},
|
|
56
|
-
set: function (value) {
|
|
57
|
-
this.angle = maths_1.default.degreesToRadians(value);
|
|
58
|
-
},
|
|
59
|
-
enumerable: false,
|
|
60
|
-
configurable: true
|
|
61
|
-
});
|
|
62
|
-
Object.defineProperty(EmitDirectionBehaviour.prototype, "varianceInDegrees", {
|
|
63
|
-
get: function () {
|
|
64
|
-
return maths_1.default.radiansToDegrees(this.variance);
|
|
65
|
-
},
|
|
66
|
-
set: function (value) {
|
|
67
|
-
this.variance = maths_1.default.degreesToRadians(value);
|
|
68
|
-
},
|
|
69
|
-
enumerable: false,
|
|
70
|
-
configurable: true
|
|
71
|
-
});
|
|
72
|
-
EmitDirectionBehaviour.prototype.getProps = function () {
|
|
73
|
-
return {
|
|
74
|
-
enabled: this.enabled,
|
|
75
|
-
priority: this.priority,
|
|
76
|
-
angle: this.angle,
|
|
77
|
-
variance: this.variance,
|
|
78
|
-
name: this.getName(),
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
return EmitDirectionBehaviour;
|
|
82
|
-
}(Behaviour_1.default));
|
|
83
|
-
exports.default = EmitDirectionBehaviour;
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
var Behaviour_1 = __importDefault(require("./Behaviour"));
|
|
22
|
+
var BehaviourNames_1 = __importDefault(require("./BehaviourNames"));
|
|
23
|
+
var maths_1 = __importDefault(require("../util/maths"));
|
|
24
|
+
var _tmp = 0;
|
|
25
|
+
var EmitDirectionBehaviour = /** @class */ (function (_super) {
|
|
26
|
+
__extends(EmitDirectionBehaviour, _super);
|
|
27
|
+
function EmitDirectionBehaviour() {
|
|
28
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
29
|
+
_this.enabled = true;
|
|
30
|
+
_this.priority = 0;
|
|
31
|
+
_this.angle = 0;
|
|
32
|
+
_this.variance = 0;
|
|
33
|
+
_this.init = function (particle) {
|
|
34
|
+
if (!_this.enabled)
|
|
35
|
+
return;
|
|
36
|
+
var directionAngle = _this.angle + _this.varianceFrom(_this.variance);
|
|
37
|
+
particle.directionCos = Math.cos(directionAngle);
|
|
38
|
+
particle.directionSin = Math.sin(directionAngle);
|
|
39
|
+
};
|
|
40
|
+
_this.apply = function (particle, deltaTime) {
|
|
41
|
+
if (!_this.enabled)
|
|
42
|
+
return;
|
|
43
|
+
_tmp = particle.directionCos * particle.x - particle.directionSin * particle.y;
|
|
44
|
+
particle.y = particle.directionSin * particle.x + particle.directionCos * particle.y;
|
|
45
|
+
particle.x = _tmp;
|
|
46
|
+
};
|
|
47
|
+
return _this;
|
|
48
|
+
}
|
|
49
|
+
EmitDirectionBehaviour.prototype.getName = function () {
|
|
50
|
+
return BehaviourNames_1.default.EMIT_DIRECTION;
|
|
51
|
+
};
|
|
52
|
+
Object.defineProperty(EmitDirectionBehaviour.prototype, "angleInDegrees", {
|
|
53
|
+
get: function () {
|
|
54
|
+
return maths_1.default.radiansToDegrees(this.variance);
|
|
55
|
+
},
|
|
56
|
+
set: function (value) {
|
|
57
|
+
this.angle = maths_1.default.degreesToRadians(value);
|
|
58
|
+
},
|
|
59
|
+
enumerable: false,
|
|
60
|
+
configurable: true
|
|
61
|
+
});
|
|
62
|
+
Object.defineProperty(EmitDirectionBehaviour.prototype, "varianceInDegrees", {
|
|
63
|
+
get: function () {
|
|
64
|
+
return maths_1.default.radiansToDegrees(this.variance);
|
|
65
|
+
},
|
|
66
|
+
set: function (value) {
|
|
67
|
+
this.variance = maths_1.default.degreesToRadians(value);
|
|
68
|
+
},
|
|
69
|
+
enumerable: false,
|
|
70
|
+
configurable: true
|
|
71
|
+
});
|
|
72
|
+
EmitDirectionBehaviour.prototype.getProps = function () {
|
|
73
|
+
return {
|
|
74
|
+
enabled: this.enabled,
|
|
75
|
+
priority: this.priority,
|
|
76
|
+
angle: this.angle,
|
|
77
|
+
variance: this.variance,
|
|
78
|
+
name: this.getName(),
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
return EmitDirectionBehaviour;
|
|
82
|
+
}(Behaviour_1.default));
|
|
83
|
+
exports.default = EmitDirectionBehaviour;
|
|
84
84
|
//# sourceMappingURL=EmitDirectionBehaviour.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import Particle from '../Particle';
|
|
2
|
-
export default class EmitterBehaviours {
|
|
3
|
-
behaviours: any;
|
|
4
|
-
getAll: () => any;
|
|
5
|
-
isEmpty: () => boolean;
|
|
6
|
-
clear: () => void;
|
|
7
|
-
add: (behaviour: any) => any;
|
|
8
|
-
getByName: (name: string) => any;
|
|
9
|
-
removeByName: (name: string) => void;
|
|
10
|
-
init: (particle: Particle) => void;
|
|
11
|
-
apply: (particle: Particle, deltaTime: number) => void;
|
|
12
|
-
}
|
|
1
|
+
import Particle from '../Particle';
|
|
2
|
+
export default class EmitterBehaviours {
|
|
3
|
+
behaviours: any;
|
|
4
|
+
getAll: () => any;
|
|
5
|
+
isEmpty: () => boolean;
|
|
6
|
+
clear: () => void;
|
|
7
|
+
add: (behaviour: any) => any;
|
|
8
|
+
getByName: (name: string) => any;
|
|
9
|
+
removeByName: (name: string) => void;
|
|
10
|
+
init: (particle: Particle) => void;
|
|
11
|
+
apply: (particle: Particle, deltaTime: number) => void;
|
|
12
|
+
}
|
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// tslint:disable:prefer-for-of
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
var EmitterBehaviours = /** @class */ (function () {
|
|
5
|
-
function EmitterBehaviours() {
|
|
6
|
-
var _this = this;
|
|
7
|
-
this.behaviours = [];
|
|
8
|
-
this.getAll = function () {
|
|
9
|
-
return _this.behaviours.filter(function (behaviour) {
|
|
10
|
-
return behaviour.enabled;
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
this.isEmpty = function () {
|
|
14
|
-
return _this.getAll().length === 0;
|
|
15
|
-
};
|
|
16
|
-
this.clear = function () {
|
|
17
|
-
_this.behaviours = [];
|
|
18
|
-
};
|
|
19
|
-
this.add = function (behaviour) {
|
|
20
|
-
if (_this.getByName(behaviour.getName()) !== null) {
|
|
21
|
-
throw new Error('Emitter duplicate');
|
|
22
|
-
}
|
|
23
|
-
_this.behaviours.push(behaviour);
|
|
24
|
-
_this.behaviours.sort(function (a, b) {
|
|
25
|
-
return b.priority - a.priority;
|
|
26
|
-
});
|
|
27
|
-
return behaviour;
|
|
28
|
-
};
|
|
29
|
-
this.getByName = function (name) {
|
|
30
|
-
for (var i = 0; i < _this.behaviours.length; ++i) {
|
|
31
|
-
if (_this.behaviours[i].getName() === name) {
|
|
32
|
-
return _this.behaviours[i];
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return null;
|
|
36
|
-
};
|
|
37
|
-
this.removeByName = function (name) {
|
|
38
|
-
var behaviours = [];
|
|
39
|
-
for (var i = 0; i < _this.behaviours.length; ++i) {
|
|
40
|
-
if (_this.behaviours[i].getName() !== name) {
|
|
41
|
-
behaviours.push(_this.behaviours[i]);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
_this.behaviours = behaviours;
|
|
45
|
-
};
|
|
46
|
-
this.init = function (particle) {
|
|
47
|
-
for (var i = 0; i < _this.behaviours.length; ++i) {
|
|
48
|
-
_this.behaviours[i].init(particle);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
this.apply = function (particle, deltaTime) {
|
|
52
|
-
for (var i = 0; i < _this.behaviours.length; ++i) {
|
|
53
|
-
_this.behaviours[i].apply(particle, deltaTime);
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
return EmitterBehaviours;
|
|
58
|
-
}());
|
|
59
|
-
exports.default = EmitterBehaviours;
|
|
1
|
+
"use strict";
|
|
2
|
+
// tslint:disable:prefer-for-of
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
var EmitterBehaviours = /** @class */ (function () {
|
|
5
|
+
function EmitterBehaviours() {
|
|
6
|
+
var _this = this;
|
|
7
|
+
this.behaviours = [];
|
|
8
|
+
this.getAll = function () {
|
|
9
|
+
return _this.behaviours.filter(function (behaviour) {
|
|
10
|
+
return behaviour.enabled;
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
this.isEmpty = function () {
|
|
14
|
+
return _this.getAll().length === 0;
|
|
15
|
+
};
|
|
16
|
+
this.clear = function () {
|
|
17
|
+
_this.behaviours = [];
|
|
18
|
+
};
|
|
19
|
+
this.add = function (behaviour) {
|
|
20
|
+
if (_this.getByName(behaviour.getName()) !== null) {
|
|
21
|
+
throw new Error('Emitter duplicate');
|
|
22
|
+
}
|
|
23
|
+
_this.behaviours.push(behaviour);
|
|
24
|
+
_this.behaviours.sort(function (a, b) {
|
|
25
|
+
return b.priority - a.priority;
|
|
26
|
+
});
|
|
27
|
+
return behaviour;
|
|
28
|
+
};
|
|
29
|
+
this.getByName = function (name) {
|
|
30
|
+
for (var i = 0; i < _this.behaviours.length; ++i) {
|
|
31
|
+
if (_this.behaviours[i].getName() === name) {
|
|
32
|
+
return _this.behaviours[i];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
};
|
|
37
|
+
this.removeByName = function (name) {
|
|
38
|
+
var behaviours = [];
|
|
39
|
+
for (var i = 0; i < _this.behaviours.length; ++i) {
|
|
40
|
+
if (_this.behaviours[i].getName() !== name) {
|
|
41
|
+
behaviours.push(_this.behaviours[i]);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
_this.behaviours = behaviours;
|
|
45
|
+
};
|
|
46
|
+
this.init = function (particle) {
|
|
47
|
+
for (var i = 0; i < _this.behaviours.length; ++i) {
|
|
48
|
+
_this.behaviours[i].init(particle);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
this.apply = function (particle, deltaTime) {
|
|
52
|
+
for (var i = 0; i < _this.behaviours.length; ++i) {
|
|
53
|
+
_this.behaviours[i].apply(particle, deltaTime);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
return EmitterBehaviours;
|
|
58
|
+
}());
|
|
59
|
+
exports.default = EmitterBehaviours;
|
|
60
60
|
//# sourceMappingURL=EmitterBehaviours.js.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { Behaviour } from './index';
|
|
2
|
-
import Particle from '../Particle';
|
|
3
|
-
export default class LifeBehaviour extends Behaviour {
|
|
4
|
-
enabled: boolean;
|
|
5
|
-
priority: number;
|
|
6
|
-
maxLifeTime: number;
|
|
7
|
-
timeVariance: number;
|
|
8
|
-
init: (particle: Particle) => void;
|
|
9
|
-
apply: (particle: Particle, deltaTime: number) => void;
|
|
10
|
-
getName(): string;
|
|
11
|
-
getProps(): {
|
|
12
|
-
enabled: boolean;
|
|
13
|
-
priority: number;
|
|
14
|
-
maxLifeTime: number;
|
|
15
|
-
timeVariance: number;
|
|
16
|
-
name: string;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
1
|
+
import { Behaviour } from './index';
|
|
2
|
+
import Particle from '../Particle';
|
|
3
|
+
export default class LifeBehaviour extends Behaviour {
|
|
4
|
+
enabled: boolean;
|
|
5
|
+
priority: number;
|
|
6
|
+
maxLifeTime: number;
|
|
7
|
+
timeVariance: number;
|
|
8
|
+
init: (particle: Particle) => void;
|
|
9
|
+
apply: (particle: Particle, deltaTime: number) => void;
|
|
10
|
+
getName(): string;
|
|
11
|
+
getProps(): {
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
priority: number;
|
|
14
|
+
maxLifeTime: number;
|
|
15
|
+
timeVariance: number;
|
|
16
|
+
name: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -1,56 +1,56 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
var index_1 = require("./index");
|
|
19
|
-
var LifeBehaviour = /** @class */ (function (_super) {
|
|
20
|
-
__extends(LifeBehaviour, _super);
|
|
21
|
-
function LifeBehaviour() {
|
|
22
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
23
|
-
_this.enabled = true;
|
|
24
|
-
_this.priority = 10000;
|
|
25
|
-
_this.maxLifeTime = 0;
|
|
26
|
-
_this.timeVariance = 0;
|
|
27
|
-
_this.init = function (particle) {
|
|
28
|
-
particle.lifeTime = 0;
|
|
29
|
-
particle.lifeProgress = 0;
|
|
30
|
-
particle.maxLifeTime = _this.maxLifeTime + _this.varianceFrom(_this.timeVariance);
|
|
31
|
-
particle.maxLifeTime = Math.max(particle.maxLifeTime, 0.0);
|
|
32
|
-
};
|
|
33
|
-
_this.apply = function (particle, deltaTime) {
|
|
34
|
-
particle.lifeTime += deltaTime;
|
|
35
|
-
if (particle.maxLifeTime > 0) {
|
|
36
|
-
particle.lifeProgress = Math.min(1.0, particle.lifeTime / particle.maxLifeTime);
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
return _this;
|
|
40
|
-
}
|
|
41
|
-
LifeBehaviour.prototype.getName = function () {
|
|
42
|
-
return index_1.BehaviourNames.LIFE_BEHAVIOUR;
|
|
43
|
-
};
|
|
44
|
-
LifeBehaviour.prototype.getProps = function () {
|
|
45
|
-
return {
|
|
46
|
-
enabled: this.enabled,
|
|
47
|
-
priority: this.priority,
|
|
48
|
-
maxLifeTime: this.maxLifeTime,
|
|
49
|
-
timeVariance: this.timeVariance,
|
|
50
|
-
name: this.getName(),
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
return LifeBehaviour;
|
|
54
|
-
}(index_1.Behaviour));
|
|
55
|
-
exports.default = LifeBehaviour;
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
var index_1 = require("./index");
|
|
19
|
+
var LifeBehaviour = /** @class */ (function (_super) {
|
|
20
|
+
__extends(LifeBehaviour, _super);
|
|
21
|
+
function LifeBehaviour() {
|
|
22
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
23
|
+
_this.enabled = true;
|
|
24
|
+
_this.priority = 10000;
|
|
25
|
+
_this.maxLifeTime = 0;
|
|
26
|
+
_this.timeVariance = 0;
|
|
27
|
+
_this.init = function (particle) {
|
|
28
|
+
particle.lifeTime = 0;
|
|
29
|
+
particle.lifeProgress = 0;
|
|
30
|
+
particle.maxLifeTime = _this.maxLifeTime + _this.varianceFrom(_this.timeVariance);
|
|
31
|
+
particle.maxLifeTime = Math.max(particle.maxLifeTime, 0.0);
|
|
32
|
+
};
|
|
33
|
+
_this.apply = function (particle, deltaTime) {
|
|
34
|
+
particle.lifeTime += deltaTime;
|
|
35
|
+
if (particle.maxLifeTime > 0) {
|
|
36
|
+
particle.lifeProgress = Math.min(1.0, particle.lifeTime / particle.maxLifeTime);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
return _this;
|
|
40
|
+
}
|
|
41
|
+
LifeBehaviour.prototype.getName = function () {
|
|
42
|
+
return index_1.BehaviourNames.LIFE_BEHAVIOUR;
|
|
43
|
+
};
|
|
44
|
+
LifeBehaviour.prototype.getProps = function () {
|
|
45
|
+
return {
|
|
46
|
+
enabled: this.enabled,
|
|
47
|
+
priority: this.priority,
|
|
48
|
+
maxLifeTime: this.maxLifeTime,
|
|
49
|
+
timeVariance: this.timeVariance,
|
|
50
|
+
name: this.getName(),
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
return LifeBehaviour;
|
|
54
|
+
}(index_1.Behaviour));
|
|
55
|
+
exports.default = LifeBehaviour;
|
|
56
56
|
//# sourceMappingURL=LifeBehaviour.js.map
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import { Point } from '../util';
|
|
2
|
-
import { Behaviour } from './index';
|
|
3
|
-
import Particle from '../Particle';
|
|
4
|
-
export default class PositionBehaviour extends Behaviour {
|
|
5
|
-
enabled: boolean;
|
|
6
|
-
priority: number;
|
|
7
|
-
spawnType: string;
|
|
8
|
-
radius: number;
|
|
9
|
-
sinX: boolean;
|
|
10
|
-
sinY: boolean;
|
|
11
|
-
sinXVal: Point;
|
|
12
|
-
sinYVal: Point;
|
|
13
|
-
sinXValVariance: Point;
|
|
14
|
-
sinYValVariance: Point;
|
|
15
|
-
position: Point;
|
|
16
|
-
positionVariance: Point;
|
|
17
|
-
velocity: Point;
|
|
18
|
-
velocityVariance: Point;
|
|
19
|
-
acceleration: Point;
|
|
20
|
-
accelerationVariance: Point;
|
|
21
|
-
init: (particle: Particle) => void;
|
|
22
|
-
calculate: (value: number, variance: number) => number;
|
|
23
|
-
apply: (particle: Particle, deltaTime: number) => void;
|
|
24
|
-
getName(): string;
|
|
25
|
-
getProps(): {
|
|
26
|
-
enabled: boolean;
|
|
27
|
-
priority: number;
|
|
28
|
-
spawnType: string;
|
|
29
|
-
radius: number;
|
|
30
|
-
sinX: boolean;
|
|
31
|
-
sinY: boolean;
|
|
32
|
-
sinXVal: Point;
|
|
33
|
-
sinYVal: Point;
|
|
34
|
-
sinXValVariance: Point;
|
|
35
|
-
sinYValVariance: Point;
|
|
36
|
-
position: {
|
|
37
|
-
x: number;
|
|
38
|
-
y: number;
|
|
39
|
-
};
|
|
40
|
-
positionVariance: {
|
|
41
|
-
x: number;
|
|
42
|
-
y: number;
|
|
43
|
-
};
|
|
44
|
-
velocity: {
|
|
45
|
-
x: number;
|
|
46
|
-
y: number;
|
|
47
|
-
};
|
|
48
|
-
velocityVariance: {
|
|
49
|
-
x: number;
|
|
50
|
-
y: number;
|
|
51
|
-
};
|
|
52
|
-
acceleration: {
|
|
53
|
-
x: number;
|
|
54
|
-
y: number;
|
|
55
|
-
};
|
|
56
|
-
accelerationVariance: {
|
|
57
|
-
x: number;
|
|
58
|
-
y: number;
|
|
59
|
-
};
|
|
60
|
-
name: string;
|
|
61
|
-
};
|
|
62
|
-
}
|
|
1
|
+
import { Point } from '../util';
|
|
2
|
+
import { Behaviour } from './index';
|
|
3
|
+
import Particle from '../Particle';
|
|
4
|
+
export default class PositionBehaviour extends Behaviour {
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
priority: number;
|
|
7
|
+
spawnType: string;
|
|
8
|
+
radius: number;
|
|
9
|
+
sinX: boolean;
|
|
10
|
+
sinY: boolean;
|
|
11
|
+
sinXVal: Point;
|
|
12
|
+
sinYVal: Point;
|
|
13
|
+
sinXValVariance: Point;
|
|
14
|
+
sinYValVariance: Point;
|
|
15
|
+
position: Point;
|
|
16
|
+
positionVariance: Point;
|
|
17
|
+
velocity: Point;
|
|
18
|
+
velocityVariance: Point;
|
|
19
|
+
acceleration: Point;
|
|
20
|
+
accelerationVariance: Point;
|
|
21
|
+
init: (particle: Particle) => void;
|
|
22
|
+
calculate: (value: number, variance: number) => number;
|
|
23
|
+
apply: (particle: Particle, deltaTime: number) => void;
|
|
24
|
+
getName(): string;
|
|
25
|
+
getProps(): {
|
|
26
|
+
enabled: boolean;
|
|
27
|
+
priority: number;
|
|
28
|
+
spawnType: string;
|
|
29
|
+
radius: number;
|
|
30
|
+
sinX: boolean;
|
|
31
|
+
sinY: boolean;
|
|
32
|
+
sinXVal: Point;
|
|
33
|
+
sinYVal: Point;
|
|
34
|
+
sinXValVariance: Point;
|
|
35
|
+
sinYValVariance: Point;
|
|
36
|
+
position: {
|
|
37
|
+
x: number;
|
|
38
|
+
y: number;
|
|
39
|
+
};
|
|
40
|
+
positionVariance: {
|
|
41
|
+
x: number;
|
|
42
|
+
y: number;
|
|
43
|
+
};
|
|
44
|
+
velocity: {
|
|
45
|
+
x: number;
|
|
46
|
+
y: number;
|
|
47
|
+
};
|
|
48
|
+
velocityVariance: {
|
|
49
|
+
x: number;
|
|
50
|
+
y: number;
|
|
51
|
+
};
|
|
52
|
+
acceleration: {
|
|
53
|
+
x: number;
|
|
54
|
+
y: number;
|
|
55
|
+
};
|
|
56
|
+
accelerationVariance: {
|
|
57
|
+
x: number;
|
|
58
|
+
y: number;
|
|
59
|
+
};
|
|
60
|
+
name: string;
|
|
61
|
+
};
|
|
62
|
+
}
|