custom-pixi-particles 2.0.10 → 3.0.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/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 +424 -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,147 +1,147 @@
|
|
|
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 util_1 = require("../util");
|
|
19
|
-
var index_1 = require("./index");
|
|
20
|
-
var PositionBehaviour = /** @class */ (function (_super) {
|
|
21
|
-
__extends(PositionBehaviour, _super);
|
|
22
|
-
function PositionBehaviour() {
|
|
23
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
24
|
-
_this.enabled = false;
|
|
25
|
-
_this.priority = 100;
|
|
26
|
-
_this.spawnType = 'Rectangle';
|
|
27
|
-
_this.radius = 0;
|
|
28
|
-
_this.sinX = false;
|
|
29
|
-
_this.sinY = false;
|
|
30
|
-
_this.sinXVal = new util_1.Point();
|
|
31
|
-
_this.sinYVal = new util_1.Point();
|
|
32
|
-
_this.sinXValVariance = new util_1.Point();
|
|
33
|
-
_this.sinYValVariance = new util_1.Point();
|
|
34
|
-
_this.position = new util_1.Point();
|
|
35
|
-
_this.positionVariance = new util_1.Point();
|
|
36
|
-
_this.velocity = new util_1.Point();
|
|
37
|
-
_this.velocityVariance = new util_1.Point();
|
|
38
|
-
_this.acceleration = new util_1.Point();
|
|
39
|
-
_this.accelerationVariance = new util_1.Point();
|
|
40
|
-
_this.init = function (particle) {
|
|
41
|
-
if (!_this.enabled)
|
|
42
|
-
return;
|
|
43
|
-
if (_this.spawnType === 'Rectangle') {
|
|
44
|
-
particle.movement.x = _this.calculate(_this.position.x, _this.positionVariance.x);
|
|
45
|
-
particle.movement.y = _this.calculate(_this.position.y, _this.positionVariance.y);
|
|
46
|
-
}
|
|
47
|
-
else if (_this.spawnType === 'Ring') {
|
|
48
|
-
var angle = Math.random() * Math.PI * 2;
|
|
49
|
-
particle.movement.x = _this.calculate(_this.position.x, _this.positionVariance.x) + Math.cos(angle) * _this.radius;
|
|
50
|
-
particle.movement.y = _this.calculate(_this.position.y, _this.positionVariance.y) + Math.sin(angle) * _this.radius;
|
|
51
|
-
}
|
|
52
|
-
else if (_this.spawnType === 'Frame') {
|
|
53
|
-
var w = _this.radius;
|
|
54
|
-
var h = _this.radius;
|
|
55
|
-
if (Math.random() < w / (w + h)) {
|
|
56
|
-
particle.movement.x = Math.random() * w + particle.movement.x;
|
|
57
|
-
particle.movement.y = Math.random() < 0.5 ? particle.movement.y : particle.movement.y + h - 1;
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
particle.movement.y = Math.random() * h + particle.movement.y;
|
|
61
|
-
particle.movement.x = Math.random() < 0.5 ? particle.movement.x : particle.movement.x + w - 1;
|
|
62
|
-
}
|
|
63
|
-
particle.movement.x += _this.calculate(_this.position.x, _this.positionVariance.x);
|
|
64
|
-
particle.movement.y += _this.calculate(_this.position.y, _this.positionVariance.y);
|
|
65
|
-
}
|
|
66
|
-
particle.velocity.x = _this.calculate(_this.velocity.x, _this.velocityVariance.x);
|
|
67
|
-
particle.velocity.y = _this.calculate(_this.velocity.y, _this.velocityVariance.y);
|
|
68
|
-
particle.acceleration.x = _this.calculate(_this.acceleration.x, _this.accelerationVariance.x);
|
|
69
|
-
particle.acceleration.y = _this.calculate(_this.acceleration.y, _this.accelerationVariance.y);
|
|
70
|
-
particle.sinXVal.x = _this.calculate(_this.sinXVal.x, _this.sinXValVariance.x);
|
|
71
|
-
particle.sinXVal.y = _this.calculate(_this.sinXVal.y, _this.sinXValVariance.y);
|
|
72
|
-
particle.sinYVal.x = _this.calculate(_this.sinYVal.x, _this.sinYValVariance.x);
|
|
73
|
-
particle.sinYVal.y = _this.calculate(_this.sinYVal.y, _this.sinYValVariance.y);
|
|
74
|
-
particle.x = particle.movement.x;
|
|
75
|
-
particle.y = particle.movement.y;
|
|
76
|
-
};
|
|
77
|
-
_this.calculate = function (value, variance) {
|
|
78
|
-
return value + _this.varianceFrom(variance);
|
|
79
|
-
};
|
|
80
|
-
_this.apply = function (particle, deltaTime) {
|
|
81
|
-
if (!_this.enabled)
|
|
82
|
-
return;
|
|
83
|
-
particle.velocity.x += particle.acceleration.x * deltaTime;
|
|
84
|
-
particle.velocity.y += particle.acceleration.y * deltaTime;
|
|
85
|
-
particle.movement.x += particle.velocity.x * deltaTime;
|
|
86
|
-
particle.movement.y += particle.velocity.y * deltaTime;
|
|
87
|
-
if (_this.sinX) {
|
|
88
|
-
particle.x = particle.movement.x + Math.sin(Math.PI * (particle.movement.y / particle.sinXVal.x)) * particle.sinXVal.y;
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
particle.x = particle.movement.x;
|
|
92
|
-
}
|
|
93
|
-
if (_this.sinY) {
|
|
94
|
-
particle.y = particle.movement.y + Math.sin(Math.PI * (particle.movement.x / particle.sinYVal.x)) * particle.sinYVal.y;
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
particle.y = particle.movement.y;
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
return _this;
|
|
101
|
-
}
|
|
102
|
-
PositionBehaviour.prototype.getName = function () {
|
|
103
|
-
return index_1.BehaviourNames.POSITION_BEHAVIOUR;
|
|
104
|
-
};
|
|
105
|
-
PositionBehaviour.prototype.getProps = function () {
|
|
106
|
-
return {
|
|
107
|
-
enabled: this.enabled,
|
|
108
|
-
priority: this.priority,
|
|
109
|
-
spawnType: this.spawnType,
|
|
110
|
-
radius: this.radius,
|
|
111
|
-
sinX: this.sinX,
|
|
112
|
-
sinY: this.sinY,
|
|
113
|
-
sinXVal: this.sinXVal,
|
|
114
|
-
sinYVal: this.sinYVal,
|
|
115
|
-
sinXValVariance: this.sinXValVariance,
|
|
116
|
-
sinYValVariance: this.sinYValVariance,
|
|
117
|
-
position: {
|
|
118
|
-
x: this.position.x,
|
|
119
|
-
y: this.position.y,
|
|
120
|
-
},
|
|
121
|
-
positionVariance: {
|
|
122
|
-
x: this.position.x,
|
|
123
|
-
y: this.position.y,
|
|
124
|
-
},
|
|
125
|
-
velocity: {
|
|
126
|
-
x: this.position.x,
|
|
127
|
-
y: this.position.y,
|
|
128
|
-
},
|
|
129
|
-
velocityVariance: {
|
|
130
|
-
x: this.position.x,
|
|
131
|
-
y: this.position.y,
|
|
132
|
-
},
|
|
133
|
-
acceleration: {
|
|
134
|
-
x: this.position.x,
|
|
135
|
-
y: this.position.y,
|
|
136
|
-
},
|
|
137
|
-
accelerationVariance: {
|
|
138
|
-
x: this.position.x,
|
|
139
|
-
y: this.position.y,
|
|
140
|
-
},
|
|
141
|
-
name: this.getName(),
|
|
142
|
-
};
|
|
143
|
-
};
|
|
144
|
-
return PositionBehaviour;
|
|
145
|
-
}(index_1.Behaviour));
|
|
146
|
-
exports.default = PositionBehaviour;
|
|
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 util_1 = require("../util");
|
|
19
|
+
var index_1 = require("./index");
|
|
20
|
+
var PositionBehaviour = /** @class */ (function (_super) {
|
|
21
|
+
__extends(PositionBehaviour, _super);
|
|
22
|
+
function PositionBehaviour() {
|
|
23
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
24
|
+
_this.enabled = false;
|
|
25
|
+
_this.priority = 100;
|
|
26
|
+
_this.spawnType = 'Rectangle';
|
|
27
|
+
_this.radius = 0;
|
|
28
|
+
_this.sinX = false;
|
|
29
|
+
_this.sinY = false;
|
|
30
|
+
_this.sinXVal = new util_1.Point();
|
|
31
|
+
_this.sinYVal = new util_1.Point();
|
|
32
|
+
_this.sinXValVariance = new util_1.Point();
|
|
33
|
+
_this.sinYValVariance = new util_1.Point();
|
|
34
|
+
_this.position = new util_1.Point();
|
|
35
|
+
_this.positionVariance = new util_1.Point();
|
|
36
|
+
_this.velocity = new util_1.Point();
|
|
37
|
+
_this.velocityVariance = new util_1.Point();
|
|
38
|
+
_this.acceleration = new util_1.Point();
|
|
39
|
+
_this.accelerationVariance = new util_1.Point();
|
|
40
|
+
_this.init = function (particle) {
|
|
41
|
+
if (!_this.enabled)
|
|
42
|
+
return;
|
|
43
|
+
if (_this.spawnType === 'Rectangle') {
|
|
44
|
+
particle.movement.x = _this.calculate(_this.position.x, _this.positionVariance.x);
|
|
45
|
+
particle.movement.y = _this.calculate(_this.position.y, _this.positionVariance.y);
|
|
46
|
+
}
|
|
47
|
+
else if (_this.spawnType === 'Ring') {
|
|
48
|
+
var angle = Math.random() * Math.PI * 2;
|
|
49
|
+
particle.movement.x = _this.calculate(_this.position.x, _this.positionVariance.x) + Math.cos(angle) * _this.radius;
|
|
50
|
+
particle.movement.y = _this.calculate(_this.position.y, _this.positionVariance.y) + Math.sin(angle) * _this.radius;
|
|
51
|
+
}
|
|
52
|
+
else if (_this.spawnType === 'Frame') {
|
|
53
|
+
var w = _this.radius;
|
|
54
|
+
var h = _this.radius;
|
|
55
|
+
if (Math.random() < w / (w + h)) {
|
|
56
|
+
particle.movement.x = Math.random() * w + particle.movement.x;
|
|
57
|
+
particle.movement.y = Math.random() < 0.5 ? particle.movement.y : particle.movement.y + h - 1;
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
particle.movement.y = Math.random() * h + particle.movement.y;
|
|
61
|
+
particle.movement.x = Math.random() < 0.5 ? particle.movement.x : particle.movement.x + w - 1;
|
|
62
|
+
}
|
|
63
|
+
particle.movement.x += _this.calculate(_this.position.x, _this.positionVariance.x);
|
|
64
|
+
particle.movement.y += _this.calculate(_this.position.y, _this.positionVariance.y);
|
|
65
|
+
}
|
|
66
|
+
particle.velocity.x = _this.calculate(_this.velocity.x, _this.velocityVariance.x);
|
|
67
|
+
particle.velocity.y = _this.calculate(_this.velocity.y, _this.velocityVariance.y);
|
|
68
|
+
particle.acceleration.x = _this.calculate(_this.acceleration.x, _this.accelerationVariance.x);
|
|
69
|
+
particle.acceleration.y = _this.calculate(_this.acceleration.y, _this.accelerationVariance.y);
|
|
70
|
+
particle.sinXVal.x = _this.calculate(_this.sinXVal.x, _this.sinXValVariance.x);
|
|
71
|
+
particle.sinXVal.y = _this.calculate(_this.sinXVal.y, _this.sinXValVariance.y);
|
|
72
|
+
particle.sinYVal.x = _this.calculate(_this.sinYVal.x, _this.sinYValVariance.x);
|
|
73
|
+
particle.sinYVal.y = _this.calculate(_this.sinYVal.y, _this.sinYValVariance.y);
|
|
74
|
+
particle.x = particle.movement.x;
|
|
75
|
+
particle.y = particle.movement.y;
|
|
76
|
+
};
|
|
77
|
+
_this.calculate = function (value, variance) {
|
|
78
|
+
return value + _this.varianceFrom(variance);
|
|
79
|
+
};
|
|
80
|
+
_this.apply = function (particle, deltaTime) {
|
|
81
|
+
if (!_this.enabled)
|
|
82
|
+
return;
|
|
83
|
+
particle.velocity.x += particle.acceleration.x * deltaTime;
|
|
84
|
+
particle.velocity.y += particle.acceleration.y * deltaTime;
|
|
85
|
+
particle.movement.x += particle.velocity.x * deltaTime;
|
|
86
|
+
particle.movement.y += particle.velocity.y * deltaTime;
|
|
87
|
+
if (_this.sinX) {
|
|
88
|
+
particle.x = particle.movement.x + Math.sin(Math.PI * (particle.movement.y / particle.sinXVal.x)) * particle.sinXVal.y;
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
particle.x = particle.movement.x;
|
|
92
|
+
}
|
|
93
|
+
if (_this.sinY) {
|
|
94
|
+
particle.y = particle.movement.y + Math.sin(Math.PI * (particle.movement.x / particle.sinYVal.x)) * particle.sinYVal.y;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
particle.y = particle.movement.y;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
return _this;
|
|
101
|
+
}
|
|
102
|
+
PositionBehaviour.prototype.getName = function () {
|
|
103
|
+
return index_1.BehaviourNames.POSITION_BEHAVIOUR;
|
|
104
|
+
};
|
|
105
|
+
PositionBehaviour.prototype.getProps = function () {
|
|
106
|
+
return {
|
|
107
|
+
enabled: this.enabled,
|
|
108
|
+
priority: this.priority,
|
|
109
|
+
spawnType: this.spawnType,
|
|
110
|
+
radius: this.radius,
|
|
111
|
+
sinX: this.sinX,
|
|
112
|
+
sinY: this.sinY,
|
|
113
|
+
sinXVal: this.sinXVal,
|
|
114
|
+
sinYVal: this.sinYVal,
|
|
115
|
+
sinXValVariance: this.sinXValVariance,
|
|
116
|
+
sinYValVariance: this.sinYValVariance,
|
|
117
|
+
position: {
|
|
118
|
+
x: this.position.x,
|
|
119
|
+
y: this.position.y,
|
|
120
|
+
},
|
|
121
|
+
positionVariance: {
|
|
122
|
+
x: this.position.x,
|
|
123
|
+
y: this.position.y,
|
|
124
|
+
},
|
|
125
|
+
velocity: {
|
|
126
|
+
x: this.position.x,
|
|
127
|
+
y: this.position.y,
|
|
128
|
+
},
|
|
129
|
+
velocityVariance: {
|
|
130
|
+
x: this.position.x,
|
|
131
|
+
y: this.position.y,
|
|
132
|
+
},
|
|
133
|
+
acceleration: {
|
|
134
|
+
x: this.position.x,
|
|
135
|
+
y: this.position.y,
|
|
136
|
+
},
|
|
137
|
+
accelerationVariance: {
|
|
138
|
+
x: this.position.x,
|
|
139
|
+
y: this.position.y,
|
|
140
|
+
},
|
|
141
|
+
name: this.getName(),
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
return PositionBehaviour;
|
|
145
|
+
}(index_1.Behaviour));
|
|
146
|
+
exports.default = PositionBehaviour;
|
|
147
147
|
//# sourceMappingURL=PositionBehaviour.js.map
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { Behaviour } from './index';
|
|
2
|
-
import Particle from '../Particle';
|
|
3
|
-
export default class RotationBehaviour extends Behaviour {
|
|
4
|
-
enabled: boolean;
|
|
5
|
-
priority: number;
|
|
6
|
-
rotation: number;
|
|
7
|
-
variance: number;
|
|
8
|
-
init: (particle: Particle) => void;
|
|
9
|
-
apply: (particle: Particle, deltaTime: number) => void;
|
|
10
|
-
getName(): string;
|
|
11
|
-
get rotationInDegrees(): number;
|
|
12
|
-
set rotationInDegrees(value: number);
|
|
13
|
-
get varianceInDegrees(): number;
|
|
14
|
-
set varianceInDegrees(value: number);
|
|
15
|
-
getProps(): {
|
|
16
|
-
enabled: boolean;
|
|
17
|
-
priority: number;
|
|
18
|
-
rotation: number;
|
|
19
|
-
variance: number;
|
|
20
|
-
name: string;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
1
|
+
import { Behaviour } from './index';
|
|
2
|
+
import Particle from '../Particle';
|
|
3
|
+
export default class RotationBehaviour extends Behaviour {
|
|
4
|
+
enabled: boolean;
|
|
5
|
+
priority: number;
|
|
6
|
+
rotation: number;
|
|
7
|
+
variance: number;
|
|
8
|
+
init: (particle: Particle) => void;
|
|
9
|
+
apply: (particle: Particle, deltaTime: number) => void;
|
|
10
|
+
getName(): string;
|
|
11
|
+
get rotationInDegrees(): number;
|
|
12
|
+
set rotationInDegrees(value: number);
|
|
13
|
+
get varianceInDegrees(): number;
|
|
14
|
+
set varianceInDegrees(value: number);
|
|
15
|
+
getProps(): {
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
priority: number;
|
|
18
|
+
rotation: number;
|
|
19
|
+
variance: number;
|
|
20
|
+
name: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -1,78 +1,78 @@
|
|
|
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 index_1 = require("./index");
|
|
22
|
-
var maths_1 = __importDefault(require("../util/maths"));
|
|
23
|
-
var RotationBehaviour = /** @class */ (function (_super) {
|
|
24
|
-
__extends(RotationBehaviour, _super);
|
|
25
|
-
function RotationBehaviour() {
|
|
26
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
27
|
-
_this.enabled = false;
|
|
28
|
-
_this.priority = 0;
|
|
29
|
-
_this.rotation = 0;
|
|
30
|
-
_this.variance = 0;
|
|
31
|
-
_this.init = function (particle) {
|
|
32
|
-
if (!_this.enabled)
|
|
33
|
-
return;
|
|
34
|
-
particle.rotationDelta = _this.rotation + _this.varianceFrom(_this.variance);
|
|
35
|
-
};
|
|
36
|
-
_this.apply = function (particle, deltaTime) {
|
|
37
|
-
if (!_this.enabled)
|
|
38
|
-
return;
|
|
39
|
-
particle.rotation += particle.rotationDelta * deltaTime;
|
|
40
|
-
};
|
|
41
|
-
return _this;
|
|
42
|
-
}
|
|
43
|
-
RotationBehaviour.prototype.getName = function () {
|
|
44
|
-
return index_1.BehaviourNames.ROTATION_BEHAVIOUR;
|
|
45
|
-
};
|
|
46
|
-
Object.defineProperty(RotationBehaviour.prototype, "rotationInDegrees", {
|
|
47
|
-
get: function () {
|
|
48
|
-
return maths_1.default.radiansToDegrees(this.variance);
|
|
49
|
-
},
|
|
50
|
-
set: function (value) {
|
|
51
|
-
this.rotation = maths_1.default.radiansToDegrees(value);
|
|
52
|
-
},
|
|
53
|
-
enumerable: false,
|
|
54
|
-
configurable: true
|
|
55
|
-
});
|
|
56
|
-
Object.defineProperty(RotationBehaviour.prototype, "varianceInDegrees", {
|
|
57
|
-
get: function () {
|
|
58
|
-
return maths_1.default.radiansToDegrees(this.variance);
|
|
59
|
-
},
|
|
60
|
-
set: function (value) {
|
|
61
|
-
this.variance = maths_1.default.radiansToDegrees(value);
|
|
62
|
-
},
|
|
63
|
-
enumerable: false,
|
|
64
|
-
configurable: true
|
|
65
|
-
});
|
|
66
|
-
RotationBehaviour.prototype.getProps = function () {
|
|
67
|
-
return {
|
|
68
|
-
enabled: this.enabled,
|
|
69
|
-
priority: this.priority,
|
|
70
|
-
rotation: this.rotation,
|
|
71
|
-
variance: this.variance,
|
|
72
|
-
name: this.getName(),
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
return RotationBehaviour;
|
|
76
|
-
}(index_1.Behaviour));
|
|
77
|
-
exports.default = RotationBehaviour;
|
|
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 index_1 = require("./index");
|
|
22
|
+
var maths_1 = __importDefault(require("../util/maths"));
|
|
23
|
+
var RotationBehaviour = /** @class */ (function (_super) {
|
|
24
|
+
__extends(RotationBehaviour, _super);
|
|
25
|
+
function RotationBehaviour() {
|
|
26
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
27
|
+
_this.enabled = false;
|
|
28
|
+
_this.priority = 0;
|
|
29
|
+
_this.rotation = 0;
|
|
30
|
+
_this.variance = 0;
|
|
31
|
+
_this.init = function (particle) {
|
|
32
|
+
if (!_this.enabled)
|
|
33
|
+
return;
|
|
34
|
+
particle.rotationDelta = _this.rotation + _this.varianceFrom(_this.variance);
|
|
35
|
+
};
|
|
36
|
+
_this.apply = function (particle, deltaTime) {
|
|
37
|
+
if (!_this.enabled)
|
|
38
|
+
return;
|
|
39
|
+
particle.rotation += particle.rotationDelta * deltaTime;
|
|
40
|
+
};
|
|
41
|
+
return _this;
|
|
42
|
+
}
|
|
43
|
+
RotationBehaviour.prototype.getName = function () {
|
|
44
|
+
return index_1.BehaviourNames.ROTATION_BEHAVIOUR;
|
|
45
|
+
};
|
|
46
|
+
Object.defineProperty(RotationBehaviour.prototype, "rotationInDegrees", {
|
|
47
|
+
get: function () {
|
|
48
|
+
return maths_1.default.radiansToDegrees(this.variance);
|
|
49
|
+
},
|
|
50
|
+
set: function (value) {
|
|
51
|
+
this.rotation = maths_1.default.radiansToDegrees(value);
|
|
52
|
+
},
|
|
53
|
+
enumerable: false,
|
|
54
|
+
configurable: true
|
|
55
|
+
});
|
|
56
|
+
Object.defineProperty(RotationBehaviour.prototype, "varianceInDegrees", {
|
|
57
|
+
get: function () {
|
|
58
|
+
return maths_1.default.radiansToDegrees(this.variance);
|
|
59
|
+
},
|
|
60
|
+
set: function (value) {
|
|
61
|
+
this.variance = maths_1.default.radiansToDegrees(value);
|
|
62
|
+
},
|
|
63
|
+
enumerable: false,
|
|
64
|
+
configurable: true
|
|
65
|
+
});
|
|
66
|
+
RotationBehaviour.prototype.getProps = function () {
|
|
67
|
+
return {
|
|
68
|
+
enabled: this.enabled,
|
|
69
|
+
priority: this.priority,
|
|
70
|
+
rotation: this.rotation,
|
|
71
|
+
variance: this.variance,
|
|
72
|
+
name: this.getName(),
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
return RotationBehaviour;
|
|
76
|
+
}(index_1.Behaviour));
|
|
77
|
+
exports.default = RotationBehaviour;
|
|
78
78
|
//# sourceMappingURL=RotationBehaviour.js.map
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { Point } from '../util';
|
|
2
|
-
import { Behaviour } from './index';
|
|
3
|
-
import Particle from '../Particle';
|
|
4
|
-
export default class SizeBehaviour extends Behaviour {
|
|
5
|
-
enabled: boolean;
|
|
6
|
-
priority: number;
|
|
7
|
-
allowNegativeValues: boolean;
|
|
8
|
-
sizeStart: Point;
|
|
9
|
-
sizeEnd: Point;
|
|
10
|
-
startVariance: number;
|
|
11
|
-
endVariance: number;
|
|
12
|
-
init: (particle: Particle) => void;
|
|
13
|
-
apply: (particle: Particle, deltaTime: number) => void;
|
|
14
|
-
getName(): string;
|
|
15
|
-
getProps(): {
|
|
16
|
-
enabled: boolean;
|
|
17
|
-
priority: number;
|
|
18
|
-
allowNegativeValues: boolean;
|
|
19
|
-
sizeStart: {
|
|
20
|
-
x: number;
|
|
21
|
-
y: number;
|
|
22
|
-
};
|
|
23
|
-
sizeEnd: {
|
|
24
|
-
x: number;
|
|
25
|
-
y: number;
|
|
26
|
-
};
|
|
27
|
-
startVariance: number;
|
|
28
|
-
endVariance: number;
|
|
29
|
-
name: string;
|
|
30
|
-
};
|
|
31
|
-
}
|
|
1
|
+
import { Point } from '../util';
|
|
2
|
+
import { Behaviour } from './index';
|
|
3
|
+
import Particle from '../Particle';
|
|
4
|
+
export default class SizeBehaviour extends Behaviour {
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
priority: number;
|
|
7
|
+
allowNegativeValues: boolean;
|
|
8
|
+
sizeStart: Point;
|
|
9
|
+
sizeEnd: Point;
|
|
10
|
+
startVariance: number;
|
|
11
|
+
endVariance: number;
|
|
12
|
+
init: (particle: Particle) => void;
|
|
13
|
+
apply: (particle: Particle, deltaTime: number) => void;
|
|
14
|
+
getName(): string;
|
|
15
|
+
getProps(): {
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
priority: number;
|
|
18
|
+
allowNegativeValues: boolean;
|
|
19
|
+
sizeStart: {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
};
|
|
23
|
+
sizeEnd: {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
};
|
|
27
|
+
startVariance: number;
|
|
28
|
+
endVariance: number;
|
|
29
|
+
name: string;
|
|
30
|
+
};
|
|
31
|
+
}
|