custom-pixi-particles 2.0.7 → 2.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +6 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/Particle.d.ts +45 -0
- package/dist/lib/Particle.js +69 -0
- package/dist/lib/Particle.js.map +1 -0
- package/dist/lib/ParticlePool.d.ts +9 -0
- package/dist/lib/ParticlePool.js +34 -0
- package/dist/lib/ParticlePool.js.map +1 -0
- package/dist/lib/behaviour/AngularVelocityBehaviour.d.ts +26 -0
- package/dist/lib/behaviour/AngularVelocityBehaviour.js +78 -0
- package/dist/lib/behaviour/AngularVelocityBehaviour.js.map +1 -0
- package/dist/lib/behaviour/Behaviour.d.ts +7 -0
- package/dist/lib/behaviour/Behaviour.js +27 -0
- package/dist/lib/behaviour/Behaviour.js.map +1 -0
- package/dist/lib/behaviour/BehaviourNames.d.ts +11 -0
- package/dist/lib/behaviour/BehaviourNames.js +13 -0
- package/dist/lib/behaviour/BehaviourNames.js.map +1 -0
- package/dist/lib/behaviour/ColorBehaviour.d.ts +45 -0
- package/dist/lib/behaviour/ColorBehaviour.js +104 -0
- package/dist/lib/behaviour/ColorBehaviour.js.map +1 -0
- package/dist/lib/behaviour/EmitDirectionBehaviour.d.ts +22 -0
- package/dist/lib/behaviour/EmitDirectionBehaviour.js +84 -0
- package/dist/lib/behaviour/EmitDirectionBehaviour.js.map +1 -0
- package/dist/lib/behaviour/EmitterBehaviours.d.ts +12 -0
- package/dist/lib/behaviour/EmitterBehaviours.js +60 -0
- package/dist/lib/behaviour/EmitterBehaviours.js.map +1 -0
- package/dist/lib/behaviour/LifeBehaviour.d.ts +18 -0
- package/dist/lib/behaviour/LifeBehaviour.js +56 -0
- package/dist/lib/behaviour/LifeBehaviour.js.map +1 -0
- package/dist/lib/behaviour/PositionBehaviour.d.ts +62 -0
- package/dist/lib/behaviour/PositionBehaviour.js +147 -0
- package/dist/lib/behaviour/PositionBehaviour.js.map +1 -0
- package/dist/lib/behaviour/RotationBehaviour.d.ts +22 -0
- package/dist/lib/behaviour/RotationBehaviour.js +78 -0
- package/dist/lib/behaviour/RotationBehaviour.js.map +1 -0
- package/dist/lib/behaviour/SizeBehaviour.d.ts +31 -0
- package/dist/lib/behaviour/SizeBehaviour.js +85 -0
- package/dist/lib/behaviour/SizeBehaviour.js.map +1 -0
- package/dist/lib/behaviour/TurbulenceBehaviour.d.ts +69 -0
- package/dist/lib/behaviour/TurbulenceBehaviour.js +154 -0
- package/dist/lib/behaviour/TurbulenceBehaviour.js.map +1 -0
- package/dist/lib/behaviour/index.d.ts +12 -0
- package/dist/lib/behaviour/index.js +29 -0
- package/dist/lib/behaviour/index.js.map +1 -0
- package/dist/lib/customPixiParticlesSettingsInterface.d.ts +8 -0
- package/dist/lib/customPixiParticlesSettingsInterface.js +3 -0
- package/dist/lib/customPixiParticlesSettingsInterface.js.map +1 -0
- package/dist/lib/emission/AbstractEmission.d.ts +7 -0
- package/dist/lib/emission/AbstractEmission.js +22 -0
- package/dist/lib/emission/AbstractEmission.js.map +1 -0
- package/dist/lib/emission/EmissionTypes.d.ts +6 -0
- package/dist/lib/emission/EmissionTypes.js +8 -0
- package/dist/lib/emission/EmissionTypes.js.map +1 -0
- package/dist/lib/emission/RandomEmission.d.ts +11 -0
- package/dist/lib/emission/RandomEmission.js +62 -0
- package/dist/lib/emission/RandomEmission.js.map +1 -0
- package/dist/lib/emission/StandardEmission.d.ts +12 -0
- package/dist/lib/emission/StandardEmission.js +66 -0
- package/dist/lib/emission/StandardEmission.js.map +1 -0
- package/dist/lib/emission/UniformEmission.d.ts +14 -0
- package/dist/lib/emission/UniformEmission.js +74 -0
- package/dist/lib/emission/UniformEmission.js.map +1 -0
- package/dist/lib/emission/index.d.ts +6 -0
- package/dist/lib/emission/index.js +17 -0
- package/dist/lib/emission/index.js.map +1 -0
- package/dist/lib/emitter/Duration.d.ts +10 -0
- package/dist/lib/emitter/Duration.js +29 -0
- package/dist/lib/emitter/Duration.js.map +1 -0
- package/dist/lib/emitter/Emitter.d.ts +45 -0
- package/dist/lib/emitter/Emitter.js +215 -0
- package/dist/lib/emitter/Emitter.js.map +1 -0
- package/dist/lib/emitter/index.d.ts +3 -0
- package/dist/lib/emitter/index.js +11 -0
- package/dist/lib/emitter/index.js.map +1 -0
- package/dist/lib/index.d.ts +20 -0
- package/dist/lib/index.js +45 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/parser/BehaviourParser.d.ts +10 -0
- package/dist/lib/parser/BehaviourParser.js +49 -0
- package/dist/lib/parser/BehaviourParser.js.map +1 -0
- package/dist/lib/parser/CompatibilityHelper.d.ts +3 -0
- package/dist/lib/parser/CompatibilityHelper.js +15 -0
- package/dist/lib/parser/CompatibilityHelper.js.map +1 -0
- package/dist/lib/parser/EmitControllerParser.d.ts +6 -0
- package/dist/lib/parser/EmitControllerParser.js +23 -0
- package/dist/lib/parser/EmitControllerParser.js.map +1 -0
- package/dist/lib/parser/EmitterParser.d.ts +12 -0
- package/dist/lib/parser/EmitterParser.js +127 -0
- package/dist/lib/parser/EmitterParser.js.map +1 -0
- package/dist/lib/parser/index.d.ts +5 -0
- package/dist/lib/parser/index.js +15 -0
- package/dist/lib/parser/index.js.map +1 -0
- package/dist/lib/pixi/Renderer.d.ts +49 -0
- package/dist/lib/pixi/Renderer.js +438 -0
- package/dist/lib/pixi/Renderer.js.map +1 -0
- package/dist/lib/util/Color.d.ts +32 -0
- package/dist/lib/util/Color.js +99 -0
- package/dist/lib/util/Color.js.map +1 -0
- package/dist/lib/util/List.d.ts +9 -0
- package/dist/lib/util/List.js +51 -0
- package/dist/lib/util/List.js.map +1 -0
- package/dist/lib/util/Point.d.ts +13 -0
- package/dist/lib/util/Point.js +30 -0
- package/dist/lib/util/Point.js.map +1 -0
- package/dist/lib/util/Random.d.ts +4 -0
- package/dist/lib/util/Random.js +15 -0
- package/dist/lib/util/Random.js.map +1 -0
- package/dist/lib/util/index.d.ts +5 -0
- package/dist/lib/util/index.js +15 -0
- package/dist/lib/util/index.js.map +1 -0
- package/dist/lib/util/maths.d.ts +7 -0
- package/dist/lib/util/maths.js +17 -0
- package/dist/lib/util/maths.js.map +1 -0
- package/dist/lib/util/turbulencePool.d.ts +5 -0
- package/dist/lib/util/turbulencePool.js +10 -0
- package/dist/lib/util/turbulencePool.js.map +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import Renderer from './lib/pixi/Renderer';
|
|
2
|
+
import { ICustomPixiParticlesSettings } from './lib/customPixiParticlesSettingsInterface';
|
|
3
|
+
declare const customPixiParticles: {
|
|
4
|
+
create(settings: ICustomPixiParticlesSettings): Renderer;
|
|
5
|
+
};
|
|
6
|
+
export { Renderer, customPixiParticles, ICustomPixiParticlesSettings };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
exports.customPixiParticles = exports.Renderer = void 0;
|
|
7
|
+
var Renderer_1 = __importDefault(require("./lib/pixi/Renderer"));
|
|
8
|
+
exports.Renderer = Renderer_1.default;
|
|
9
|
+
var customPixiParticles = {
|
|
10
|
+
create: function (settings) {
|
|
11
|
+
var textures = settings.textures, emitterConfig = settings.emitterConfig, _a = settings.finishingTextures, finishingTextures = _a === void 0 ? [] : _a;
|
|
12
|
+
return new Renderer_1.default({ textures: textures, emitterConfig: emitterConfig, finishingTextures: finishingTextures });
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
exports.customPixiParticles = customPixiParticles;
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,iEAA0C;AAYjC,mBAZF,kBAAQ,CAYE;AATjB,IAAM,mBAAmB,GAAG;IAC1B,MAAM,EAAN,UAAO,QAAsC;QAEzC,IAAA,QAAQ,GACN,QAAQ,SADF,EAAE,aAAa,GACrB,QAAQ,cADa,EAAE,KACvB,QAAQ,kBADqC,EAAtB,iBAAiB,mBAAG,EAAE,KAAA,CACrC;QACZ,OAAO,IAAI,kBAAQ,CAAC,EAAC,QAAQ,UAAA,EAAE,aAAa,eAAA,EAAE,iBAAiB,mBAAA,EAAC,CAAC,CAAA;IACnE,CAAC;CACF,CAAA;AAEkB,kDAAmB"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Sprite } from 'pixi.js';
|
|
2
|
+
import { Color, Point } from './util';
|
|
3
|
+
export default class Particle {
|
|
4
|
+
static _UID: {
|
|
5
|
+
value: number;
|
|
6
|
+
};
|
|
7
|
+
next: null;
|
|
8
|
+
prev: null;
|
|
9
|
+
uid: number;
|
|
10
|
+
movement: Point;
|
|
11
|
+
acceleration: Point;
|
|
12
|
+
velocity: Point;
|
|
13
|
+
size: Point;
|
|
14
|
+
sizeStart: Point;
|
|
15
|
+
sizeEnd: Point;
|
|
16
|
+
sinXVal: Point;
|
|
17
|
+
sinYVal: Point;
|
|
18
|
+
color: Color;
|
|
19
|
+
colorStart: Color;
|
|
20
|
+
colorEnd: Color;
|
|
21
|
+
maxLifeTime: number;
|
|
22
|
+
lifeTime: number;
|
|
23
|
+
lifeProgress: number;
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
velocityAngle: number;
|
|
27
|
+
radiansPerSecond: number;
|
|
28
|
+
radius: number;
|
|
29
|
+
radiusStart: number;
|
|
30
|
+
radiusEnd: number;
|
|
31
|
+
directionCos: number;
|
|
32
|
+
directionSin: number;
|
|
33
|
+
rotation: number;
|
|
34
|
+
rotationDelta: number;
|
|
35
|
+
angle: number;
|
|
36
|
+
sprite: Sprite;
|
|
37
|
+
showVortices: boolean;
|
|
38
|
+
turbulence: boolean;
|
|
39
|
+
finishingTexture: number;
|
|
40
|
+
constructor();
|
|
41
|
+
reset(): void;
|
|
42
|
+
isAlmostDead(): boolean;
|
|
43
|
+
isDead(): boolean;
|
|
44
|
+
hide(): void;
|
|
45
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var util_1 = require("./util");
|
|
4
|
+
var Particle = /** @class */ (function () {
|
|
5
|
+
function Particle() {
|
|
6
|
+
this.next = null;
|
|
7
|
+
this.prev = null;
|
|
8
|
+
this.uid = Particle._UID.value++;
|
|
9
|
+
this.movement = new util_1.Point();
|
|
10
|
+
this.acceleration = new util_1.Point();
|
|
11
|
+
this.velocity = new util_1.Point();
|
|
12
|
+
this.size = new util_1.Point();
|
|
13
|
+
this.sizeStart = new util_1.Point();
|
|
14
|
+
this.sizeEnd = new util_1.Point();
|
|
15
|
+
this.sinXVal = new util_1.Point();
|
|
16
|
+
this.sinYVal = new util_1.Point();
|
|
17
|
+
this.color = new util_1.Color();
|
|
18
|
+
this.colorStart = new util_1.Color();
|
|
19
|
+
this.colorEnd = new util_1.Color();
|
|
20
|
+
this.reset();
|
|
21
|
+
}
|
|
22
|
+
Particle.prototype.reset = function () {
|
|
23
|
+
this.maxLifeTime = 0;
|
|
24
|
+
this.lifeTime = 0;
|
|
25
|
+
this.lifeProgress = 0;
|
|
26
|
+
this.x = 0;
|
|
27
|
+
this.y = 0;
|
|
28
|
+
this.movement.set(0, 0);
|
|
29
|
+
this.acceleration.set(0, 0);
|
|
30
|
+
this.velocity.set(0, 0);
|
|
31
|
+
this.sinXVal.set(0, 0);
|
|
32
|
+
this.sinYVal.set(0, 0);
|
|
33
|
+
this.velocityAngle = 0;
|
|
34
|
+
this.radiansPerSecond = 0;
|
|
35
|
+
this.radius = 0;
|
|
36
|
+
this.radiusStart = 0;
|
|
37
|
+
this.radiusEnd = 0;
|
|
38
|
+
this.directionCos = 1;
|
|
39
|
+
this.directionSin = 0;
|
|
40
|
+
this.finishingTexture = 0;
|
|
41
|
+
this.showVortices = false;
|
|
42
|
+
this.turbulence = false;
|
|
43
|
+
this.rotation = 0;
|
|
44
|
+
this.rotationDelta = 0;
|
|
45
|
+
this.size.set(1, 1);
|
|
46
|
+
this.sizeStart.set(0, 0);
|
|
47
|
+
this.sizeEnd.set(0, 0);
|
|
48
|
+
this.color.set(255, 255, 255, 1);
|
|
49
|
+
this.colorStart.set(0, 0, 0, 1);
|
|
50
|
+
this.colorEnd.set(0, 0, 0, 1);
|
|
51
|
+
};
|
|
52
|
+
Particle.prototype.isAlmostDead = function () {
|
|
53
|
+
return this.lifeTime >= this.maxLifeTime - 0.1;
|
|
54
|
+
};
|
|
55
|
+
Particle.prototype.isDead = function () {
|
|
56
|
+
return this.lifeTime >= this.maxLifeTime;
|
|
57
|
+
};
|
|
58
|
+
Particle.prototype.hide = function () {
|
|
59
|
+
if (!this.sprite)
|
|
60
|
+
return;
|
|
61
|
+
if (!this.sprite.visible)
|
|
62
|
+
return;
|
|
63
|
+
this.sprite.visible = false;
|
|
64
|
+
};
|
|
65
|
+
Particle._UID = { value: 0 };
|
|
66
|
+
return Particle;
|
|
67
|
+
}());
|
|
68
|
+
exports.default = Particle;
|
|
69
|
+
//# sourceMappingURL=Particle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Particle.js","sourceRoot":"","sources":["../../src/lib/Particle.ts"],"names":[],"mappings":";;AACA,+BAAqC;AAErC;IAoCE;QAlCA,SAAI,GAAG,IAAI,CAAA;QACX,SAAI,GAAG,IAAI,CAAA;QACX,QAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,CAAA;QAC3B,aAAQ,GAAG,IAAI,YAAK,EAAE,CAAA;QACtB,iBAAY,GAAG,IAAI,YAAK,EAAE,CAAA;QAC1B,aAA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,KAAK,EAAE,CAAC,EAAE,CAAA;IA2F/C,eAAC;CAAA,AA5FD,IA4FC;kBA5FoB,QAAQ"}
|
|
@@ -0,0 +1,34 @@
|
|
|
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 Particle_1 = __importDefault(require("./Particle"));
|
|
7
|
+
var ParticlePool = /** @class */ (function () {
|
|
8
|
+
function ParticlePool() {
|
|
9
|
+
this.first = null;
|
|
10
|
+
}
|
|
11
|
+
ParticlePool.prototype.pop = function () {
|
|
12
|
+
if (!this.first)
|
|
13
|
+
return this.create();
|
|
14
|
+
var current = this.first;
|
|
15
|
+
this.first = current.next;
|
|
16
|
+
current.next = null;
|
|
17
|
+
return current;
|
|
18
|
+
};
|
|
19
|
+
ParticlePool.prototype.create = function () {
|
|
20
|
+
return new Particle_1.default();
|
|
21
|
+
};
|
|
22
|
+
ParticlePool.prototype.push = function (particle) {
|
|
23
|
+
particle.next = this.first;
|
|
24
|
+
this.first = particle;
|
|
25
|
+
};
|
|
26
|
+
ParticlePool.prototype.reset = function () {
|
|
27
|
+
this.first = null;
|
|
28
|
+
ParticlePool.global = new ParticlePool();
|
|
29
|
+
};
|
|
30
|
+
ParticlePool.global = new ParticlePool();
|
|
31
|
+
return ParticlePool;
|
|
32
|
+
}());
|
|
33
|
+
exports.default = ParticlePool;
|
|
34
|
+
//# sourceMappingURL=ParticlePool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParticlePool.js","sourceRoot":"","sources":["../../src/lib/ParticlePool.ts"],"names":[],"mappings":";;;;;AAAA,wDAAiC;AAEjC;IAAA;QAEE,UAAK,GAAQ,IAAI,CAAA;IAwBnB,CAAC;IAtBC,0BAAG,GAAH;QACE,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC,MAAM,EAAE,CAAA;QAErC,IAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAA;QAC1B,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,CAAA;QACzB,OAAO,CAAC,IAAI,GAAG,IAAI,CAAA;QACnB,OAAO,OAAO,CAAA;IAChB,CAAC;IAED,6BAAM,GAAN;QACE,OAAO,IAAI,kBAAQ,EAAE,CAAA;IACvB,CAAC;IAED,2BAAI,GAAJ,UAAK,QAAkB;QACrB,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAA;QAC1B,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAA;IACvB,CAAC;IAED,4BAAK,GAAL;QACE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QACjB,YAAY,CAAC,MAAM,GAAG,IAAI,YAAY,EAAE,CAAA;IAC1C,CAAC;IAxBM,mBAAM,GAAG,IAAI,YAAY,EAAE,CAAA;IAyBpC,mBAAC;CAAA,AA1BD,IA0BC;kBA1BoB,YAAY"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Behaviour from './Behaviour';
|
|
2
|
+
import Particle from '../Particle';
|
|
3
|
+
export default class AngularVelocityBehaviour extends Behaviour {
|
|
4
|
+
private enabled;
|
|
5
|
+
private degrees;
|
|
6
|
+
private degreesVariance;
|
|
7
|
+
private maxRadius;
|
|
8
|
+
private maxRadiusVariance;
|
|
9
|
+
private minRadius;
|
|
10
|
+
private minRadiusVariance;
|
|
11
|
+
protected priority: number;
|
|
12
|
+
init: (particle: Particle) => void;
|
|
13
|
+
apply: (particle: Particle, deltaTime: number) => void;
|
|
14
|
+
getName(): string;
|
|
15
|
+
getProps(): {
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
degrees: number;
|
|
18
|
+
degreesVariance: number;
|
|
19
|
+
maxRadius: number;
|
|
20
|
+
maxRadiusVariance: number;
|
|
21
|
+
minRadius: number;
|
|
22
|
+
minRadiusVariance: number;
|
|
23
|
+
priority: number;
|
|
24
|
+
name: string;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -0,0 +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;
|
|
78
|
+
//# sourceMappingURL=AngularVelocityBehaviour.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AngularVelocityBehaviour.js","sourceRoot":"","sources":["../../../src/lib/behaviour/AngularVelocityBehaviour.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,0DAAmC;AACnC,wDAAgC;AAChC,oEAA6C;AAG7C;IAAsD,4CAAS;IAA/D;QAAA,qEAmDC;QAlDS,aAAO,GAAY,KAAK,CAAA;QACxB,aAAO,GAAW,CAAC,CAAA;QACnB,qBAAe,GAAW,CAAC,CAAA;QAC3B,eAAS,GAAW,CAAC,CAAA;QACrB,uBAAiB,GAAW,CAAC,CAAA;QAC7B,eAAS,GAAW,CAAC,CAAA;QACrB,uBAAiB,GAAW,CAAC,CAAA;QAC3B,cAAQ,GAAW,GAAG,CAAA;QAEhC,UAAI,GAAG,UAAC,QAAkB;YACxB,IAAI,CAAC,KAAI,CAAC,OAAO;gBAAE,OAAM;YACzB,QAAQ,CAAC,gBAAgB,GAAG,eAAI,CAAC,gBAAgB,CAAC,KAAI,CAAC,OAAO,GAAG,KAAI,CAAC,YAAY,CAAC,KAAI,CAAC,eAAe,CAAC,CAAC,CAAA;YACzG,QAAQ,CAAC,WAAW,GAAG,KAAI,CAAC,SAAS,GAAG,KAAI,CAAC,YAAY,CAAC,KAAI,CAAC,iBAAiB,CAAC,CAAA;YACjF,QAAQ,CAAC,SAAS,GAAG,KAAI,CAAC,SAAS,GAAG,KAAI,CAAC,YAAY,CAAC,KAAI,CAAC,iBAAiB,CAAC,CAAA;YAE/E,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAA;YACd,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAA;YAC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AI,CAAC,QAAQ;YACvB,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE;SACrB,CAAA;IACH,CAAC;IACH,+BAAC;AAAD,CAAC,AAnDD,CAAsD,mBAAS,GAmD9D"}
|
|
@@ -0,0 +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;
|
|
27
|
+
//# sourceMappingURL=Behaviour.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Behaviour.js","sourceRoot":"","sources":["../../../src/lib/behaviour/Behaviour.ts"],"names":[],"mappings":";;;;;AAAA,8EAAuD;AACvD,gCAAgC;AAEhC;IAAA;QAAA,iBAeC;QAdW,aAAQ,GAAG,CAAC,CAAA;QAEtB,iBAAY,GAAG,UAAC,KAAa;YAC3B,IAAI,KAAK,KAAK,CAAC;gBAAE,OAAO,CAAC,CAAA;YACzB,OAAO,aAAM,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,KAAK,CAAA;QAC1C,CAAC,CAAA;QAMD,cAAS,GAAG;YACV,OAAO,IAAI,yBAAe,CAAC,KAAI,CAAC,CAAA;QAClC,CAAC,CAAA;IACH,CAAC;IAPC,2BAAO,GAAP;QACE,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAA;IACjE,CAAC;IAKH,gBAAC;AAAD,CAAC,AAfD,IAeC"}
|
|
@@ -0,0 +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;
|
|
@@ -0,0 +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
|
+
};
|
|
13
|
+
//# sourceMappingURL=BehaviourNames.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BehaviourNames.js","sourceRoot":"","sources":["../../../src/lib/behaviour/BehaviourNames.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACb,iBAAiB,EAAE,0BAA0B;IAC7C,cAAc,EAAE,eAAe;IAC/B,eAAe,EAAE,gBAAgB;IACjC,kBAAkB,EAAE,mBAAmB;IACvC,cAAc,EAAE,eAAe;IAC/B,cAAc,EAAE,wBAAwB;IACxC,kBAAkB,EAAE,mBAAmB;IACvC,oBAAoB,EAAE,qBAAqB;CAC5C,CAAA"}
|
|
@@ -0,0 +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
|
+
}
|
|
@@ -0,0 +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;
|
|
104
|
+
//# sourceMappingURL=ColorBehaviour.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorBehaviour.js","sourceRoot":"","sources":["../../../src/lib/behaviour/ColorBehaviour.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,gCAA+B;AAC/B,0DAAmC;AACnC,oEAA6C;AAG7C;IAA4C,kCAAS;IAArD;QAAA,qEA6EC;QA5EC,aAAO,GAAG,KAAK,CAAA;QACf,cAAQ,GAAG,CAAC,CAAA;QACZ,WAAK,GAAG,IAAI,YAAK,EAAE,CAAA;QACnB,SAAG,GAAG,IAAI,YAAK,EAAE,CAAA;QACjB,mBAAa,G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le';
|
|
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
|
+
}
|
|
@@ -0,0 +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;
|
|
84
|
+
//# sourceMappingURL=EmitDirectionBehaviour.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmitDirectionBehaviour.js","sourceRoot":"","sources":["../../../src/lib/behaviour/EmitDirectionBehaviour.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,0DAAmC;AACnC,oEAA6C;AAC7C,wDAAgC;AAGhC,IAAI,IAAI,GAAG,CAAC,CAAA;AAEZ;IAAoD,0CAAS;IAA7D;QAAA,qEAiDC;QAhDC,aAAO,GAAG,IAAI,CAAA;QACd,cAAQ,GAAG,CAAC,CAAA;QACZ,WAAK,GAAG,CAAC,CAAA;QACT,cAAQ,GAAG,CAAC,CAAA;QAEZ,UAAI,GAAG,UAAC,QAAkB;YACxB,IAAI,CAAC,KAAI,CAAC,OAAO;gBAAE,OAAM;YACzB,IAAM,cAAc,GAAG,KAAI,CAAC,KAAK,GAAG,KAAI,CAAC,YAAY,CAAC,KAAI,CAAC,QAAQ,CAAC,CAAA;YACpE,QAAQ,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;YAChD,QAAQ,CAAC,YA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