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,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 Behaviour_1 = __importDefault(require("./Behaviour"));
|
|
22
|
-
var maths_1 = __importDefault(require("../util/maths"));
|
|
23
|
-
var BehaviourNames_1 = __importDefault(require("./BehaviourNames"));
|
|
24
|
-
var AngularVelocityBehaviour = /** @class */ (function (_super) {
|
|
25
|
-
__extends(AngularVelocityBehaviour, _super);
|
|
26
|
-
function AngularVelocityBehaviour() {
|
|
27
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
28
|
-
_this.enabled = false;
|
|
29
|
-
_this.degrees = 0;
|
|
30
|
-
_this.degreesVariance = 0;
|
|
31
|
-
_this.maxRadius = 0;
|
|
32
|
-
_this.maxRadiusVariance = 0;
|
|
33
|
-
_this.minRadius = 0;
|
|
34
|
-
_this.minRadiusVariance = 0;
|
|
35
|
-
_this.priority = 100;
|
|
36
|
-
_this.init = function (particle) {
|
|
37
|
-
if (!_this.enabled)
|
|
38
|
-
return;
|
|
39
|
-
particle.radiansPerSecond = maths_1.default.degreesToRadians(_this.degrees + _this.varianceFrom(_this.degreesVariance));
|
|
40
|
-
particle.radiusStart = _this.maxRadius + _this.varianceFrom(_this.maxRadiusVariance);
|
|
41
|
-
particle.radiusEnd = _this.minRadius + _this.varianceFrom(_this.minRadiusVariance);
|
|
42
|
-
particle.x = 0;
|
|
43
|
-
particle.y = 0;
|
|
44
|
-
particle.radius = particle.radiusStart;
|
|
45
|
-
particle.angle = 0;
|
|
46
|
-
};
|
|
47
|
-
_this.apply = function (particle, deltaTime) {
|
|
48
|
-
if (!_this.enabled)
|
|
49
|
-
return;
|
|
50
|
-
particle.velocityAngle += particle.radiansPerSecond * deltaTime;
|
|
51
|
-
particle.radius = particle.radiusStart + (particle.radiusEnd - particle.radiusStart) * particle.lifeProgress;
|
|
52
|
-
particle.movement.x = Math.cos(particle.velocityAngle) * particle.radius;
|
|
53
|
-
particle.movement.y = Math.sin(particle.velocityAngle) * particle.radius;
|
|
54
|
-
particle.x = particle.movement.x;
|
|
55
|
-
particle.y = particle.movement.y;
|
|
56
|
-
};
|
|
57
|
-
return _this;
|
|
58
|
-
}
|
|
59
|
-
AngularVelocityBehaviour.prototype.getName = function () {
|
|
60
|
-
return BehaviourNames_1.default.ANGULAR_BEHAVIOUR;
|
|
61
|
-
};
|
|
62
|
-
AngularVelocityBehaviour.prototype.getProps = function () {
|
|
63
|
-
return {
|
|
64
|
-
enabled: this.enabled,
|
|
65
|
-
degrees: this.degrees,
|
|
66
|
-
degreesVariance: this.degreesVariance,
|
|
67
|
-
maxRadius: this.maxRadius,
|
|
68
|
-
maxRadiusVariance: this.maxRadiusVariance,
|
|
69
|
-
minRadius: this.minRadius,
|
|
70
|
-
minRadiusVariance: this.minRadiusVariance,
|
|
71
|
-
priority: this.priority,
|
|
72
|
-
name: this.getName(),
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
return AngularVelocityBehaviour;
|
|
76
|
-
}(Behaviour_1.default));
|
|
77
|
-
exports.default = AngularVelocityBehaviour;
|
|
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 maths_1 = __importDefault(require("../util/maths"));
|
|
23
|
+
var BehaviourNames_1 = __importDefault(require("./BehaviourNames"));
|
|
24
|
+
var AngularVelocityBehaviour = /** @class */ (function (_super) {
|
|
25
|
+
__extends(AngularVelocityBehaviour, _super);
|
|
26
|
+
function AngularVelocityBehaviour() {
|
|
27
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
28
|
+
_this.enabled = false;
|
|
29
|
+
_this.degrees = 0;
|
|
30
|
+
_this.degreesVariance = 0;
|
|
31
|
+
_this.maxRadius = 0;
|
|
32
|
+
_this.maxRadiusVariance = 0;
|
|
33
|
+
_this.minRadius = 0;
|
|
34
|
+
_this.minRadiusVariance = 0;
|
|
35
|
+
_this.priority = 100;
|
|
36
|
+
_this.init = function (particle) {
|
|
37
|
+
if (!_this.enabled)
|
|
38
|
+
return;
|
|
39
|
+
particle.radiansPerSecond = maths_1.default.degreesToRadians(_this.degrees + _this.varianceFrom(_this.degreesVariance));
|
|
40
|
+
particle.radiusStart = _this.maxRadius + _this.varianceFrom(_this.maxRadiusVariance);
|
|
41
|
+
particle.radiusEnd = _this.minRadius + _this.varianceFrom(_this.minRadiusVariance);
|
|
42
|
+
particle.x = 0;
|
|
43
|
+
particle.y = 0;
|
|
44
|
+
particle.radius = particle.radiusStart;
|
|
45
|
+
particle.angle = 0;
|
|
46
|
+
};
|
|
47
|
+
_this.apply = function (particle, deltaTime) {
|
|
48
|
+
if (!_this.enabled)
|
|
49
|
+
return;
|
|
50
|
+
particle.velocityAngle += particle.radiansPerSecond * deltaTime;
|
|
51
|
+
particle.radius = particle.radiusStart + (particle.radiusEnd - particle.radiusStart) * particle.lifeProgress;
|
|
52
|
+
particle.movement.x = Math.cos(particle.velocityAngle) * particle.radius;
|
|
53
|
+
particle.movement.y = Math.sin(particle.velocityAngle) * particle.radius;
|
|
54
|
+
particle.x = particle.movement.x;
|
|
55
|
+
particle.y = particle.movement.y;
|
|
56
|
+
};
|
|
57
|
+
return _this;
|
|
58
|
+
}
|
|
59
|
+
AngularVelocityBehaviour.prototype.getName = function () {
|
|
60
|
+
return BehaviourNames_1.default.ANGULAR_BEHAVIOUR;
|
|
61
|
+
};
|
|
62
|
+
AngularVelocityBehaviour.prototype.getProps = function () {
|
|
63
|
+
return {
|
|
64
|
+
enabled: this.enabled,
|
|
65
|
+
degrees: this.degrees,
|
|
66
|
+
degreesVariance: this.degreesVariance,
|
|
67
|
+
maxRadius: this.maxRadius,
|
|
68
|
+
maxRadiusVariance: this.maxRadiusVariance,
|
|
69
|
+
minRadius: this.minRadius,
|
|
70
|
+
minRadiusVariance: this.minRadiusVariance,
|
|
71
|
+
priority: this.priority,
|
|
72
|
+
name: this.getName(),
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
return AngularVelocityBehaviour;
|
|
76
|
+
}(Behaviour_1.default));
|
|
77
|
+
exports.default = AngularVelocityBehaviour;
|
|
78
78
|
//# sourceMappingURL=AngularVelocityBehaviour.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import BehaviourParser from '../parser/BehaviourParser';
|
|
2
|
-
export default class Behaviour {
|
|
3
|
-
protected priority: number;
|
|
4
|
-
varianceFrom: (value: number) => number;
|
|
5
|
-
getName(): void;
|
|
6
|
-
getParser: () => BehaviourParser;
|
|
7
|
-
}
|
|
1
|
+
import BehaviourParser from '../parser/BehaviourParser';
|
|
2
|
+
export default class Behaviour {
|
|
3
|
+
protected priority: number;
|
|
4
|
+
varianceFrom: (value: number) => number;
|
|
5
|
+
getName(): void;
|
|
6
|
+
getParser: () => BehaviourParser;
|
|
7
|
+
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var BehaviourParser_1 = __importDefault(require("../parser/BehaviourParser"));
|
|
7
|
-
var util_1 = require("../util");
|
|
8
|
-
var Behaviour = /** @class */ (function () {
|
|
9
|
-
function Behaviour() {
|
|
10
|
-
var _this = this;
|
|
11
|
-
this.priority = 0;
|
|
12
|
-
this.varianceFrom = function (value) {
|
|
13
|
-
if (value === 0)
|
|
14
|
-
return 0;
|
|
15
|
-
return util_1.Random.uniform(-1.0, 1.0) * value;
|
|
16
|
-
};
|
|
17
|
-
this.getParser = function () {
|
|
18
|
-
return new BehaviourParser_1.default(_this);
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
Behaviour.prototype.getName = function () {
|
|
22
|
-
throw new Error('This method has to be overridden in subclass');
|
|
23
|
-
};
|
|
24
|
-
return Behaviour;
|
|
25
|
-
}());
|
|
26
|
-
exports.default = Behaviour;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var BehaviourParser_1 = __importDefault(require("../parser/BehaviourParser"));
|
|
7
|
+
var util_1 = require("../util");
|
|
8
|
+
var Behaviour = /** @class */ (function () {
|
|
9
|
+
function Behaviour() {
|
|
10
|
+
var _this = this;
|
|
11
|
+
this.priority = 0;
|
|
12
|
+
this.varianceFrom = function (value) {
|
|
13
|
+
if (value === 0)
|
|
14
|
+
return 0;
|
|
15
|
+
return util_1.Random.uniform(-1.0, 1.0) * value;
|
|
16
|
+
};
|
|
17
|
+
this.getParser = function () {
|
|
18
|
+
return new BehaviourParser_1.default(_this);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
Behaviour.prototype.getName = function () {
|
|
22
|
+
throw new Error('This method has to be overridden in subclass');
|
|
23
|
+
};
|
|
24
|
+
return Behaviour;
|
|
25
|
+
}());
|
|
26
|
+
exports.default = Behaviour;
|
|
27
27
|
//# sourceMappingURL=Behaviour.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
ANGULAR_BEHAVIOUR: string;
|
|
3
|
-
LIFE_BEHAVIOUR: string;
|
|
4
|
-
COLOR_BEHAVIOUR: string;
|
|
5
|
-
POSITION_BEHAVIOUR: string;
|
|
6
|
-
SIZE_BEHAVIOUR: string;
|
|
7
|
-
EMIT_DIRECTION: string;
|
|
8
|
-
ROTATION_BEHAVIOUR: string;
|
|
9
|
-
TURBULENCE_BEHAVIOUR: string;
|
|
10
|
-
};
|
|
11
|
-
export default _default;
|
|
1
|
+
declare const _default: {
|
|
2
|
+
ANGULAR_BEHAVIOUR: string;
|
|
3
|
+
LIFE_BEHAVIOUR: string;
|
|
4
|
+
COLOR_BEHAVIOUR: string;
|
|
5
|
+
POSITION_BEHAVIOUR: string;
|
|
6
|
+
SIZE_BEHAVIOUR: string;
|
|
7
|
+
EMIT_DIRECTION: string;
|
|
8
|
+
ROTATION_BEHAVIOUR: string;
|
|
9
|
+
TURBULENCE_BEHAVIOUR: string;
|
|
10
|
+
};
|
|
11
|
+
export default _default;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = {
|
|
4
|
-
ANGULAR_BEHAVIOUR: 'AngularVelocityBehaviour',
|
|
5
|
-
LIFE_BEHAVIOUR: 'LifeBehaviour',
|
|
6
|
-
COLOR_BEHAVIOUR: 'ColorBehaviour',
|
|
7
|
-
POSITION_BEHAVIOUR: 'PositionBehaviour',
|
|
8
|
-
SIZE_BEHAVIOUR: 'SizeBehaviour',
|
|
9
|
-
EMIT_DIRECTION: 'EmitDirectionBehaviour',
|
|
10
|
-
ROTATION_BEHAVIOUR: 'RotationBehaviour',
|
|
11
|
-
TURBULENCE_BEHAVIOUR: 'TurbulenceBehaviour',
|
|
12
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
ANGULAR_BEHAVIOUR: 'AngularVelocityBehaviour',
|
|
5
|
+
LIFE_BEHAVIOUR: 'LifeBehaviour',
|
|
6
|
+
COLOR_BEHAVIOUR: 'ColorBehaviour',
|
|
7
|
+
POSITION_BEHAVIOUR: 'PositionBehaviour',
|
|
8
|
+
SIZE_BEHAVIOUR: 'SizeBehaviour',
|
|
9
|
+
EMIT_DIRECTION: 'EmitDirectionBehaviour',
|
|
10
|
+
ROTATION_BEHAVIOUR: 'RotationBehaviour',
|
|
11
|
+
TURBULENCE_BEHAVIOUR: 'TurbulenceBehaviour',
|
|
12
|
+
};
|
|
13
13
|
//# sourceMappingURL=BehaviourNames.js.map
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import { Color } from '../util';
|
|
2
|
-
import Behaviour from './Behaviour';
|
|
3
|
-
import Particle from '../Particle';
|
|
4
|
-
export default class ColorBehaviour extends Behaviour {
|
|
5
|
-
enabled: boolean;
|
|
6
|
-
priority: number;
|
|
7
|
-
start: Color;
|
|
8
|
-
end: Color;
|
|
9
|
-
startVariance: Color;
|
|
10
|
-
endVariance: Color;
|
|
11
|
-
sinus: boolean;
|
|
12
|
-
init: (particle: Particle) => void;
|
|
13
|
-
apply: (particle: Particle, deltaTime: number) => void;
|
|
14
|
-
getName(): string;
|
|
15
|
-
getProps(): {
|
|
16
|
-
enabled: boolean;
|
|
17
|
-
priority: number;
|
|
18
|
-
start: {
|
|
19
|
-
_r: number;
|
|
20
|
-
_g: number;
|
|
21
|
-
_b: number;
|
|
22
|
-
_alpha: number;
|
|
23
|
-
};
|
|
24
|
-
end: {
|
|
25
|
-
_r: number;
|
|
26
|
-
_g: number;
|
|
27
|
-
_b: number;
|
|
28
|
-
_alpha: number;
|
|
29
|
-
};
|
|
30
|
-
startVariance: {
|
|
31
|
-
_r: number;
|
|
32
|
-
_g: number;
|
|
33
|
-
_b: number;
|
|
34
|
-
_alpha: number;
|
|
35
|
-
};
|
|
36
|
-
endVariance: {
|
|
37
|
-
_r: number;
|
|
38
|
-
_g: number;
|
|
39
|
-
_b: number;
|
|
40
|
-
_alpha: number;
|
|
41
|
-
};
|
|
42
|
-
sinus: boolean;
|
|
43
|
-
name: string;
|
|
44
|
-
};
|
|
45
|
-
}
|
|
1
|
+
import { Color } from '../util';
|
|
2
|
+
import Behaviour from './Behaviour';
|
|
3
|
+
import Particle from '../Particle';
|
|
4
|
+
export default class ColorBehaviour extends Behaviour {
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
priority: number;
|
|
7
|
+
start: Color;
|
|
8
|
+
end: Color;
|
|
9
|
+
startVariance: Color;
|
|
10
|
+
endVariance: Color;
|
|
11
|
+
sinus: boolean;
|
|
12
|
+
init: (particle: Particle) => void;
|
|
13
|
+
apply: (particle: Particle, deltaTime: number) => void;
|
|
14
|
+
getName(): string;
|
|
15
|
+
getProps(): {
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
priority: number;
|
|
18
|
+
start: {
|
|
19
|
+
_r: number;
|
|
20
|
+
_g: number;
|
|
21
|
+
_b: number;
|
|
22
|
+
_alpha: number;
|
|
23
|
+
};
|
|
24
|
+
end: {
|
|
25
|
+
_r: number;
|
|
26
|
+
_g: number;
|
|
27
|
+
_b: number;
|
|
28
|
+
_alpha: number;
|
|
29
|
+
};
|
|
30
|
+
startVariance: {
|
|
31
|
+
_r: number;
|
|
32
|
+
_g: number;
|
|
33
|
+
_b: number;
|
|
34
|
+
_alpha: number;
|
|
35
|
+
};
|
|
36
|
+
endVariance: {
|
|
37
|
+
_r: number;
|
|
38
|
+
_g: number;
|
|
39
|
+
_b: number;
|
|
40
|
+
_alpha: number;
|
|
41
|
+
};
|
|
42
|
+
sinus: boolean;
|
|
43
|
+
name: string;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -1,104 +1,104 @@
|
|
|
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 util_1 = require("../util");
|
|
22
|
-
var Behaviour_1 = __importDefault(require("./Behaviour"));
|
|
23
|
-
var BehaviourNames_1 = __importDefault(require("./BehaviourNames"));
|
|
24
|
-
var ColorBehaviour = /** @class */ (function (_super) {
|
|
25
|
-
__extends(ColorBehaviour, _super);
|
|
26
|
-
function ColorBehaviour() {
|
|
27
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
28
|
-
_this.enabled = false;
|
|
29
|
-
_this.priority = 0;
|
|
30
|
-
_this.start = new util_1.Color();
|
|
31
|
-
_this.end = new util_1.Color();
|
|
32
|
-
_this.startVariance = new util_1.Color(0, 0, 0, 0);
|
|
33
|
-
_this.endVariance = new util_1.Color(0, 0, 0, 0);
|
|
34
|
-
_this.sinus = false;
|
|
35
|
-
_this.init = function (particle) {
|
|
36
|
-
if (!_this.enabled)
|
|
37
|
-
return;
|
|
38
|
-
particle.colorStart.copyFrom(_this.start);
|
|
39
|
-
particle.colorStart.r += _this.varianceFrom(_this.startVariance.r);
|
|
40
|
-
particle.colorStart.g += _this.varianceFrom(_this.startVariance.g);
|
|
41
|
-
particle.colorStart.b += _this.varianceFrom(_this.startVariance.b);
|
|
42
|
-
particle.colorStart.alpha += _this.varianceFrom(_this.startVariance.alpha);
|
|
43
|
-
particle.colorEnd.copyFrom(_this.end);
|
|
44
|
-
particle.colorEnd.r += _this.varianceFrom(_this.endVariance.r);
|
|
45
|
-
particle.colorEnd.g += _this.varianceFrom(_this.endVariance.g);
|
|
46
|
-
particle.colorEnd.b += _this.varianceFrom(_this.endVariance.b);
|
|
47
|
-
particle.colorEnd.alpha += _this.varianceFrom(_this.endVariance.alpha);
|
|
48
|
-
particle.color.copyFrom(particle.colorStart);
|
|
49
|
-
};
|
|
50
|
-
_this.apply = function (particle, deltaTime) {
|
|
51
|
-
if (!_this.enabled)
|
|
52
|
-
return;
|
|
53
|
-
particle.color.copyFrom(particle.colorStart);
|
|
54
|
-
particle.color.r += (particle.colorEnd.r - particle.colorStart.r) * particle.lifeProgress;
|
|
55
|
-
particle.color.g += (particle.colorEnd.g - particle.colorStart.g) * particle.lifeProgress;
|
|
56
|
-
particle.color.b += (particle.colorEnd.b - particle.colorStart.b) * particle.lifeProgress;
|
|
57
|
-
if (!_this.sinus) {
|
|
58
|
-
particle.color.alpha += (particle.colorEnd.alpha - particle.colorStart.alpha) * particle.lifeProgress;
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
particle.color.alpha = Math.sin(particle.lifeProgress * 3.1);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
return _this;
|
|
65
|
-
}
|
|
66
|
-
ColorBehaviour.prototype.getName = function () {
|
|
67
|
-
return BehaviourNames_1.default.COLOR_BEHAVIOUR;
|
|
68
|
-
};
|
|
69
|
-
ColorBehaviour.prototype.getProps = function () {
|
|
70
|
-
return {
|
|
71
|
-
enabled: this.enabled,
|
|
72
|
-
priority: this.priority,
|
|
73
|
-
start: {
|
|
74
|
-
_r: this.start.r,
|
|
75
|
-
_g: this.start.g,
|
|
76
|
-
_b: this.start.b,
|
|
77
|
-
_alpha: this.start.alpha,
|
|
78
|
-
},
|
|
79
|
-
end: {
|
|
80
|
-
_r: this.start.r,
|
|
81
|
-
_g: this.start.g,
|
|
82
|
-
_b: this.start.b,
|
|
83
|
-
_alpha: this.start.alpha,
|
|
84
|
-
},
|
|
85
|
-
startVariance: {
|
|
86
|
-
_r: this.start.r,
|
|
87
|
-
_g: this.start.g,
|
|
88
|
-
_b: this.start.b,
|
|
89
|
-
_alpha: this.start.alpha,
|
|
90
|
-
},
|
|
91
|
-
endVariance: {
|
|
92
|
-
_r: this.start.r,
|
|
93
|
-
_g: this.start.g,
|
|
94
|
-
_b: this.start.b,
|
|
95
|
-
_alpha: this.start.alpha,
|
|
96
|
-
},
|
|
97
|
-
sinus: this.sinus,
|
|
98
|
-
name: this.getName(),
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
|
-
return ColorBehaviour;
|
|
102
|
-
}(Behaviour_1.default));
|
|
103
|
-
exports.default = ColorBehaviour;
|
|
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 util_1 = require("../util");
|
|
22
|
+
var Behaviour_1 = __importDefault(require("./Behaviour"));
|
|
23
|
+
var BehaviourNames_1 = __importDefault(require("./BehaviourNames"));
|
|
24
|
+
var ColorBehaviour = /** @class */ (function (_super) {
|
|
25
|
+
__extends(ColorBehaviour, _super);
|
|
26
|
+
function ColorBehaviour() {
|
|
27
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
28
|
+
_this.enabled = false;
|
|
29
|
+
_this.priority = 0;
|
|
30
|
+
_this.start = new util_1.Color();
|
|
31
|
+
_this.end = new util_1.Color();
|
|
32
|
+
_this.startVariance = new util_1.Color(0, 0, 0, 0);
|
|
33
|
+
_this.endVariance = new util_1.Color(0, 0, 0, 0);
|
|
34
|
+
_this.sinus = false;
|
|
35
|
+
_this.init = function (particle) {
|
|
36
|
+
if (!_this.enabled)
|
|
37
|
+
return;
|
|
38
|
+
particle.colorStart.copyFrom(_this.start);
|
|
39
|
+
particle.colorStart.r += _this.varianceFrom(_this.startVariance.r);
|
|
40
|
+
particle.colorStart.g += _this.varianceFrom(_this.startVariance.g);
|
|
41
|
+
particle.colorStart.b += _this.varianceFrom(_this.startVariance.b);
|
|
42
|
+
particle.colorStart.alpha += _this.varianceFrom(_this.startVariance.alpha);
|
|
43
|
+
particle.colorEnd.copyFrom(_this.end);
|
|
44
|
+
particle.colorEnd.r += _this.varianceFrom(_this.endVariance.r);
|
|
45
|
+
particle.colorEnd.g += _this.varianceFrom(_this.endVariance.g);
|
|
46
|
+
particle.colorEnd.b += _this.varianceFrom(_this.endVariance.b);
|
|
47
|
+
particle.colorEnd.alpha += _this.varianceFrom(_this.endVariance.alpha);
|
|
48
|
+
particle.color.copyFrom(particle.colorStart);
|
|
49
|
+
};
|
|
50
|
+
_this.apply = function (particle, deltaTime) {
|
|
51
|
+
if (!_this.enabled)
|
|
52
|
+
return;
|
|
53
|
+
particle.color.copyFrom(particle.colorStart);
|
|
54
|
+
particle.color.r += (particle.colorEnd.r - particle.colorStart.r) * particle.lifeProgress;
|
|
55
|
+
particle.color.g += (particle.colorEnd.g - particle.colorStart.g) * particle.lifeProgress;
|
|
56
|
+
particle.color.b += (particle.colorEnd.b - particle.colorStart.b) * particle.lifeProgress;
|
|
57
|
+
if (!_this.sinus) {
|
|
58
|
+
particle.color.alpha += (particle.colorEnd.alpha - particle.colorStart.alpha) * particle.lifeProgress;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
particle.color.alpha = Math.sin(particle.lifeProgress * 3.1);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
return _this;
|
|
65
|
+
}
|
|
66
|
+
ColorBehaviour.prototype.getName = function () {
|
|
67
|
+
return BehaviourNames_1.default.COLOR_BEHAVIOUR;
|
|
68
|
+
};
|
|
69
|
+
ColorBehaviour.prototype.getProps = function () {
|
|
70
|
+
return {
|
|
71
|
+
enabled: this.enabled,
|
|
72
|
+
priority: this.priority,
|
|
73
|
+
start: {
|
|
74
|
+
_r: this.start.r,
|
|
75
|
+
_g: this.start.g,
|
|
76
|
+
_b: this.start.b,
|
|
77
|
+
_alpha: this.start.alpha,
|
|
78
|
+
},
|
|
79
|
+
end: {
|
|
80
|
+
_r: this.start.r,
|
|
81
|
+
_g: this.start.g,
|
|
82
|
+
_b: this.start.b,
|
|
83
|
+
_alpha: this.start.alpha,
|
|
84
|
+
},
|
|
85
|
+
startVariance: {
|
|
86
|
+
_r: this.start.r,
|
|
87
|
+
_g: this.start.g,
|
|
88
|
+
_b: this.start.b,
|
|
89
|
+
_alpha: this.start.alpha,
|
|
90
|
+
},
|
|
91
|
+
endVariance: {
|
|
92
|
+
_r: this.start.r,
|
|
93
|
+
_g: this.start.g,
|
|
94
|
+
_b: this.start.b,
|
|
95
|
+
_alpha: this.start.alpha,
|
|
96
|
+
},
|
|
97
|
+
sinus: this.sinus,
|
|
98
|
+
name: this.getName(),
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
return ColorBehaviour;
|
|
102
|
+
}(Behaviour_1.default));
|
|
103
|
+
exports.default = ColorBehaviour;
|
|
104
104
|
//# sourceMappingURL=ColorBehaviour.js.map
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import Behaviour from './Behaviour';
|
|
2
|
-
import Particle from '../Particle';
|
|
3
|
-
export default class EmitDirectionBehaviour extends Behaviour {
|
|
4
|
-
enabled: boolean;
|
|
5
|
-
priority: number;
|
|
6
|
-
angle: number;
|
|
7
|
-
variance: number;
|
|
8
|
-
init: (particle: Particle) => void;
|
|
9
|
-
apply: (particle: Particle, deltaTime: number) => void;
|
|
10
|
-
getName(): string;
|
|
11
|
-
get angleInDegrees(): number;
|
|
12
|
-
set angleInDegrees(value: number);
|
|
13
|
-
get varianceInDegrees(): number;
|
|
14
|
-
set varianceInDegrees(value: number);
|
|
15
|
-
getProps(): {
|
|
16
|
-
enabled: boolean;
|
|
17
|
-
priority: number;
|
|
18
|
-
angle: number;
|
|
19
|
-
variance: number;
|
|
20
|
-
name: string;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
1
|
+
import Behaviour from './Behaviour';
|
|
2
|
+
import Particle from '../Particle';
|
|
3
|
+
export default class EmitDirectionBehaviour extends Behaviour {
|
|
4
|
+
enabled: boolean;
|
|
5
|
+
priority: number;
|
|
6
|
+
angle: number;
|
|
7
|
+
variance: number;
|
|
8
|
+
init: (particle: Particle) => void;
|
|
9
|
+
apply: (particle: Particle, deltaTime: number) => void;
|
|
10
|
+
getName(): string;
|
|
11
|
+
get angleInDegrees(): number;
|
|
12
|
+
set angleInDegrees(value: number);
|
|
13
|
+
get varianceInDegrees(): number;
|
|
14
|
+
set varianceInDegrees(value: number);
|
|
15
|
+
getProps(): {
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
priority: number;
|
|
18
|
+
angle: number;
|
|
19
|
+
variance: number;
|
|
20
|
+
name: string;
|
|
21
|
+
};
|
|
22
|
+
}
|