custom-pixi-particles 8.0.1 → 8.1.1
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/README.md +2 -1
- package/package.json +5 -4
- package/dist/index.d.ts +0 -15
- package/dist/index.js +0 -45
- package/dist/index.js.map +0 -1
- package/dist/lib/Model.d.ts +0 -32
- package/dist/lib/Model.js +0 -44
- package/dist/lib/Model.js.map +0 -1
- package/dist/lib/Particle.d.ts +0 -234
- package/dist/lib/Particle.js +0 -201
- package/dist/lib/Particle.js.map +0 -1
- package/dist/lib/ParticlePool.d.ts +0 -37
- package/dist/lib/ParticlePool.js +0 -56
- package/dist/lib/ParticlePool.js.map +0 -1
- package/dist/lib/behaviour/AngularVelocityBehaviour.d.ts +0 -61
- package/dist/lib/behaviour/AngularVelocityBehaviour.js +0 -118
- package/dist/lib/behaviour/AngularVelocityBehaviour.js.map +0 -1
- package/dist/lib/behaviour/AttractionRepulsionBehaviour.d.ts +0 -42
- package/dist/lib/behaviour/AttractionRepulsionBehaviour.js +0 -78
- package/dist/lib/behaviour/AttractionRepulsionBehaviour.js.map +0 -1
- package/dist/lib/behaviour/Behaviour.d.ts +0 -33
- package/dist/lib/behaviour/Behaviour.js +0 -45
- package/dist/lib/behaviour/Behaviour.js.map +0 -1
- package/dist/lib/behaviour/BehaviourNames.d.ts +0 -22
- package/dist/lib/behaviour/BehaviourNames.js +0 -23
- package/dist/lib/behaviour/BehaviourNames.js.map +0 -1
- package/dist/lib/behaviour/CollisionBehaviour.d.ts +0 -86
- package/dist/lib/behaviour/CollisionBehaviour.js +0 -140
- package/dist/lib/behaviour/CollisionBehaviour.js.map +0 -1
- package/dist/lib/behaviour/ColorBehaviour.d.ts +0 -67
- package/dist/lib/behaviour/ColorBehaviour.js +0 -193
- package/dist/lib/behaviour/ColorBehaviour.js.map +0 -1
- package/dist/lib/behaviour/EmitDirectionBehaviour.d.ts +0 -52
- package/dist/lib/behaviour/EmitDirectionBehaviour.js +0 -105
- package/dist/lib/behaviour/EmitDirectionBehaviour.js.map +0 -1
- package/dist/lib/behaviour/EmitterBehaviours.d.ts +0 -69
- package/dist/lib/behaviour/EmitterBehaviours.js +0 -116
- package/dist/lib/behaviour/EmitterBehaviours.js.map +0 -1
- package/dist/lib/behaviour/ForceFieldsBehaviour.d.ts +0 -53
- package/dist/lib/behaviour/ForceFieldsBehaviour.js +0 -80
- package/dist/lib/behaviour/ForceFieldsBehaviour.js.map +0 -1
- package/dist/lib/behaviour/GroupingBehaviour.d.ts +0 -57
- package/dist/lib/behaviour/GroupingBehaviour.js +0 -143
- package/dist/lib/behaviour/GroupingBehaviour.js.map +0 -1
- package/dist/lib/behaviour/LifeBehaviour.d.ts +0 -47
- package/dist/lib/behaviour/LifeBehaviour.js +0 -65
- package/dist/lib/behaviour/LifeBehaviour.js.map +0 -1
- package/dist/lib/behaviour/LightEffectBehaviour.d.ts +0 -59
- package/dist/lib/behaviour/LightEffectBehaviour.js +0 -94
- package/dist/lib/behaviour/LightEffectBehaviour.js.map +0 -1
- package/dist/lib/behaviour/NoiseBasedMotionBehaviour.d.ts +0 -35
- package/dist/lib/behaviour/NoiseBasedMotionBehaviour.js +0 -93
- package/dist/lib/behaviour/NoiseBasedMotionBehaviour.js.map +0 -1
- package/dist/lib/behaviour/PositionBehaviour.d.ts +0 -164
- package/dist/lib/behaviour/PositionBehaviour.js +0 -484
- package/dist/lib/behaviour/PositionBehaviour.js.map +0 -1
- package/dist/lib/behaviour/RotationBehaviour.d.ts +0 -59
- package/dist/lib/behaviour/RotationBehaviour.js +0 -100
- package/dist/lib/behaviour/RotationBehaviour.js.map +0 -1
- package/dist/lib/behaviour/SizeBehaviour.d.ts +0 -61
- package/dist/lib/behaviour/SizeBehaviour.js +0 -156
- package/dist/lib/behaviour/SizeBehaviour.js.map +0 -1
- package/dist/lib/behaviour/SoundReactiveBehaviour.d.ts +0 -58
- package/dist/lib/behaviour/SoundReactiveBehaviour.js +0 -132
- package/dist/lib/behaviour/SoundReactiveBehaviour.js.map +0 -1
- package/dist/lib/behaviour/SpawnBehaviour.d.ts +0 -89
- package/dist/lib/behaviour/SpawnBehaviour.js +0 -705
- package/dist/lib/behaviour/SpawnBehaviour.js.map +0 -1
- package/dist/lib/behaviour/StretchBehaviour.d.ts +0 -30
- package/dist/lib/behaviour/StretchBehaviour.js +0 -59
- package/dist/lib/behaviour/StretchBehaviour.js.map +0 -1
- package/dist/lib/behaviour/TemperatureBehaviour.d.ts +0 -47
- package/dist/lib/behaviour/TemperatureBehaviour.js +0 -64
- package/dist/lib/behaviour/TemperatureBehaviour.js.map +0 -1
- package/dist/lib/behaviour/TimelineBehaviour.d.ts +0 -73
- package/dist/lib/behaviour/TimelineBehaviour.js +0 -100
- package/dist/lib/behaviour/TimelineBehaviour.js.map +0 -1
- package/dist/lib/behaviour/TurbulenceBehaviour.d.ts +0 -73
- package/dist/lib/behaviour/TurbulenceBehaviour.js +0 -133
- package/dist/lib/behaviour/TurbulenceBehaviour.js.map +0 -1
- package/dist/lib/behaviour/index.d.ts +0 -23
- package/dist/lib/behaviour/index.js +0 -24
- package/dist/lib/behaviour/index.js.map +0 -1
- package/dist/lib/customPixiParticlesSettingsInterface.d.ts +0 -19
- package/dist/lib/customPixiParticlesSettingsInterface.js +0 -2
- package/dist/lib/customPixiParticlesSettingsInterface.js.map +0 -1
- package/dist/lib/emission/AbstractEmission.d.ts +0 -30
- package/dist/lib/emission/AbstractEmission.js +0 -39
- package/dist/lib/emission/AbstractEmission.js.map +0 -1
- package/dist/lib/emission/EmissionTypes.d.ts +0 -6
- package/dist/lib/emission/EmissionTypes.js +0 -6
- package/dist/lib/emission/EmissionTypes.js.map +0 -1
- package/dist/lib/emission/RandomEmission.d.ts +0 -44
- package/dist/lib/emission/RandomEmission.js +0 -66
- package/dist/lib/emission/RandomEmission.js.map +0 -1
- package/dist/lib/emission/StandardEmission.d.ts +0 -62
- package/dist/lib/emission/StandardEmission.js +0 -87
- package/dist/lib/emission/StandardEmission.js.map +0 -1
- package/dist/lib/emission/UniformEmission.d.ts +0 -56
- package/dist/lib/emission/UniformEmission.js +0 -83
- package/dist/lib/emission/UniformEmission.js.map +0 -1
- package/dist/lib/emission/index.d.ts +0 -6
- package/dist/lib/emission/index.js +0 -7
- package/dist/lib/emission/index.js.map +0 -1
- package/dist/lib/emitter/Duration.d.ts +0 -27
- package/dist/lib/emitter/Duration.js +0 -41
- package/dist/lib/emitter/Duration.js.map +0 -1
- package/dist/lib/emitter/Emitter.d.ts +0 -116
- package/dist/lib/emitter/Emitter.js +0 -240
- package/dist/lib/emitter/Emitter.js.map +0 -1
- package/dist/lib/emitter/index.d.ts +0 -3
- package/dist/lib/emitter/index.js +0 -4
- package/dist/lib/emitter/index.js.map +0 -1
- package/dist/lib/index.d.ts +0 -20
- package/dist/lib/index.js +0 -21
- package/dist/lib/index.js.map +0 -1
- package/dist/lib/parser/BehaviourParser.d.ts +0 -21
- package/dist/lib/parser/BehaviourParser.js +0 -72
- package/dist/lib/parser/BehaviourParser.js.map +0 -1
- package/dist/lib/parser/CompatibilityHelper.d.ts +0 -12
- package/dist/lib/parser/CompatibilityHelper.js +0 -19
- package/dist/lib/parser/CompatibilityHelper.js.map +0 -1
- package/dist/lib/parser/EmitControllerParser.d.ts +0 -27
- package/dist/lib/parser/EmitControllerParser.js +0 -39
- package/dist/lib/parser/EmitControllerParser.js.map +0 -1
- package/dist/lib/parser/EmitterParser.d.ts +0 -67
- package/dist/lib/parser/EmitterParser.js +0 -168
- package/dist/lib/parser/EmitterParser.js.map +0 -1
- package/dist/lib/parser/index.d.ts +0 -5
- package/dist/lib/parser/index.js +0 -6
- package/dist/lib/parser/index.js.map +0 -1
- package/dist/lib/pixi/Renderer.d.ts +0 -125
- package/dist/lib/pixi/Renderer.js +0 -560
- package/dist/lib/pixi/Renderer.js.map +0 -1
- package/dist/lib/pixi/TestRenderer.d.ts +0 -125
- package/dist/lib/pixi/TestRenderer.js +0 -560
- package/dist/lib/pixi/TestRenderer.js.map +0 -1
- package/dist/lib/util/Color.d.ts +0 -133
- package/dist/lib/util/Color.js +0 -173
- package/dist/lib/util/Color.js.map +0 -1
- package/dist/lib/util/List.d.ts +0 -49
- package/dist/lib/util/List.js +0 -87
- package/dist/lib/util/List.js.map +0 -1
- package/dist/lib/util/MinMax.d.ts +0 -34
- package/dist/lib/util/MinMax.js +0 -46
- package/dist/lib/util/MinMax.js.map +0 -1
- package/dist/lib/util/Point.d.ts +0 -34
- package/dist/lib/util/Point.js +0 -46
- package/dist/lib/util/Point.js.map +0 -1
- package/dist/lib/util/Random.d.ts +0 -24
- package/dist/lib/util/Random.js +0 -30
- package/dist/lib/util/Random.js.map +0 -1
- package/dist/lib/util/ThereBack.d.ts +0 -14
- package/dist/lib/util/ThereBack.js +0 -23
- package/dist/lib/util/ThereBack.js.map +0 -1
- package/dist/lib/util/index.d.ts +0 -5
- package/dist/lib/util/index.js +0 -6
- package/dist/lib/util/index.js.map +0 -1
- package/dist/lib/util/maths.d.ts +0 -10
- package/dist/lib/util/maths.js +0 -13
- package/dist/lib/util/maths.js.map +0 -1
- package/dist/lib/util/turbulencePool.d.ts +0 -4
- package/dist/lib/util/turbulencePool.js +0 -7
- package/dist/lib/util/turbulencePool.js.map +0 -1
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { Behaviour, BehaviourNames } from './index';
|
|
2
|
-
export default class CollisionBehaviour extends Behaviour {
|
|
3
|
-
constructor() {
|
|
4
|
-
super(...arguments);
|
|
5
|
-
this.enabled = false;
|
|
6
|
-
this.skipPositionBehaviourOnCollision = false;
|
|
7
|
-
this.skipAngularVelocityBehaviourOnCollision = false;
|
|
8
|
-
this.skipColorBehaviourOnCollision = false;
|
|
9
|
-
this.skipAttractionRepulsionBehaviourOnCollision = false;
|
|
10
|
-
this.skipEmitDirectionBehaviourOnCollision = false;
|
|
11
|
-
this.skipRotationBehaviourOnCollision = false;
|
|
12
|
-
this.skipSizeBehaviourOnCollision = false;
|
|
13
|
-
this.priority = 10000;
|
|
14
|
-
this.distance = 10;
|
|
15
|
-
this.lines = [
|
|
16
|
-
{ point1: { x: 0, y: 0 }, point2: { x: 0, y: 0 } },
|
|
17
|
-
];
|
|
18
|
-
/**
|
|
19
|
-
* Function that initializes a particle
|
|
20
|
-
* @param {Particle} particle - The particle to be initialized
|
|
21
|
-
* @param {Model} model - The model of the particle
|
|
22
|
-
*/
|
|
23
|
-
this.init = (particle, model) => {
|
|
24
|
-
// do nothing
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Applies the particle's velocity and acceleration to move it and calculate its size, rotation, and position.
|
|
28
|
-
* @param {Particle} particle - The particle to be moved
|
|
29
|
-
* @param {number} deltaTime - The time delta for the movement calculation
|
|
30
|
-
* @param {Model} model - The model containing information about the particle's movement
|
|
31
|
-
*/
|
|
32
|
-
this.apply = (particle, deltaTime, model) => {
|
|
33
|
-
if (!this.enabled)
|
|
34
|
-
return;
|
|
35
|
-
this.checkCollisionAndReflect(particle);
|
|
36
|
-
};
|
|
37
|
-
this.reflectVelocity = (particle, normal) => {
|
|
38
|
-
const dotProduct = particle.velocity.x * normal.x + particle.velocity.y * normal.y;
|
|
39
|
-
particle.velocity.x = particle.velocity.x - 2 * dotProduct * normal.x;
|
|
40
|
-
particle.velocity.y = particle.velocity.y - 2 * dotProduct * normal.y;
|
|
41
|
-
if (this.skipPositionBehaviourOnCollision) {
|
|
42
|
-
particle.skipPositionBehaviour = true;
|
|
43
|
-
}
|
|
44
|
-
if (this.skipAngularVelocityBehaviourOnCollision) {
|
|
45
|
-
particle.skipAngularVelocityBehaviour = true;
|
|
46
|
-
}
|
|
47
|
-
if (this.skipColorBehaviourOnCollision) {
|
|
48
|
-
particle.skipColorBehaviour = true;
|
|
49
|
-
}
|
|
50
|
-
if (this.skipAttractionRepulsionBehaviourOnCollision) {
|
|
51
|
-
particle.skipAttractionRepulsionBehaviour = true;
|
|
52
|
-
}
|
|
53
|
-
if (this.skipEmitDirectionBehaviourOnCollision) {
|
|
54
|
-
particle.skipEmitDirectionBehaviour = true;
|
|
55
|
-
}
|
|
56
|
-
if (this.skipRotationBehaviourOnCollision) {
|
|
57
|
-
particle.skipRotationBehaviour = true;
|
|
58
|
-
}
|
|
59
|
-
if (this.skipSizeBehaviourOnCollision) {
|
|
60
|
-
particle.skipSizeBehaviour = true;
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
this.checkCollisionAndReflect = (particle) => {
|
|
64
|
-
if (this.lines.length === 0)
|
|
65
|
-
return false; // No lines to check collision
|
|
66
|
-
for (const line of this.lines) {
|
|
67
|
-
const { point1, point2 } = line;
|
|
68
|
-
// Check if the particle is near the line segment (using point-line distance)
|
|
69
|
-
const dist = this.pointToLineDistance(particle.x, particle.y, point1.x, point1.y, point2.x, point2.y);
|
|
70
|
-
if (dist <= this.distance) {
|
|
71
|
-
// Reflect velocity based on the line's normal
|
|
72
|
-
const normal = this.calculateNormal(point1, point2);
|
|
73
|
-
this.reflectVelocity(particle, normal);
|
|
74
|
-
return true; // Stop further checks after first collision
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return false;
|
|
78
|
-
};
|
|
79
|
-
this.calculateNormal = (point1, point2) => {
|
|
80
|
-
const dx = point2.x - point1.x;
|
|
81
|
-
const dy = point2.y - point1.y;
|
|
82
|
-
const length = Math.sqrt(dx * dx + dy * dy);
|
|
83
|
-
return { x: -dy / length, y: dx / length }; // Perpendicular vector (normalized)
|
|
84
|
-
};
|
|
85
|
-
this.pointToLineDistance = (x, y, x1, y1, x2, y2) => {
|
|
86
|
-
const A = x - x1;
|
|
87
|
-
const B = y - y1;
|
|
88
|
-
const C = x2 - x1;
|
|
89
|
-
const D = y2 - y1;
|
|
90
|
-
const dot = A * C + B * D;
|
|
91
|
-
const lenSq = C * C + D * D;
|
|
92
|
-
const param = lenSq !== 0 ? dot / lenSq : -1;
|
|
93
|
-
let xx;
|
|
94
|
-
let yy;
|
|
95
|
-
if (param < 0) {
|
|
96
|
-
xx = x1;
|
|
97
|
-
yy = y1;
|
|
98
|
-
}
|
|
99
|
-
else if (param > 1) {
|
|
100
|
-
xx = x2;
|
|
101
|
-
yy = y2;
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
xx = x1 + param * C;
|
|
105
|
-
yy = y1 + param * D;
|
|
106
|
-
}
|
|
107
|
-
const dx = x - xx;
|
|
108
|
-
const dy = y - yy;
|
|
109
|
-
return Math.sqrt(dx * dx + dy * dy);
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Gets the name of the behaviour
|
|
114
|
-
* @return {BehaviourNames} The name of the behaviour
|
|
115
|
-
*/
|
|
116
|
-
getName() {
|
|
117
|
-
return BehaviourNames.COLLISION_BEHAVIOUR;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* @description Retrieves the properties of the object.
|
|
121
|
-
* @returns {Object} The properties of the object.
|
|
122
|
-
*/
|
|
123
|
-
getProps() {
|
|
124
|
-
return {
|
|
125
|
-
enabled: this.enabled,
|
|
126
|
-
skipPositionBehaviourOnCollision: this.skipPositionBehaviourOnCollision,
|
|
127
|
-
skipAngularVelocityBehaviourOnCollision: this.skipAngularVelocityBehaviourOnCollision,
|
|
128
|
-
skipColorBehaviourOnCollision: this.skipColorBehaviourOnCollision,
|
|
129
|
-
skipAttractionRepulsionBehaviourOnCollision: this.skipAttractionRepulsionBehaviourOnCollision,
|
|
130
|
-
skipEmitDirectionBehaviourOnCollision: this.skipEmitDirectionBehaviourOnCollision,
|
|
131
|
-
skipRotationBehaviourOnCollision: this.skipRotationBehaviourOnCollision,
|
|
132
|
-
skipSizeBehaviourOnCollision: this.skipSizeBehaviourOnCollision,
|
|
133
|
-
priority: this.priority,
|
|
134
|
-
lines: this.lines,
|
|
135
|
-
distance: this.distance,
|
|
136
|
-
name: this.getName(),
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
//# sourceMappingURL=CollisionBehaviour.js.map
|
|
@@ -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,EAAE,IAAI,CAAC,6BAA6B;YACjE,2CAA2C,EAAE,IAAI,CAAC,2CAA2C;YAC7F,qCAAqC,EAAE,IAAI,CAAC,qCAAqC;YACjF,gCAAgC,EAAE,IAAI,CAAC,gCAAgC;YACvE,4BAA4B,EAAE,IAAI,CAAC,4BAA4B;YAC/D,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE;SACrB,CAAA;IACH,CAAC;CACF"}
|
|
@@ -1,67 +0,0 @@
|
|
|
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
|
-
colorStops: Color[];
|
|
13
|
-
usePerlin: boolean;
|
|
14
|
-
pulseSpeed: number;
|
|
15
|
-
pulseIntensity: number;
|
|
16
|
-
mirrorTransition: boolean;
|
|
17
|
-
fadeToGray: boolean;
|
|
18
|
-
fadeToTransparent: boolean;
|
|
19
|
-
flickerIntensity: number;
|
|
20
|
-
init: (particle: Particle) => void;
|
|
21
|
-
apply: (particle: Particle) => void;
|
|
22
|
-
applyColorStops: (particle: Particle, lifeProgress: number) => void;
|
|
23
|
-
pseudoRandomNoise(seed: number): number;
|
|
24
|
-
applyPerlinColor: (particle: Particle, lifeProgress: number) => void;
|
|
25
|
-
applyPulseEffect: (particle: Particle, lifeProgress: number) => void;
|
|
26
|
-
applyFadeToGray: (particle: Particle) => void;
|
|
27
|
-
applyFlickering: (particle: Particle) => void;
|
|
28
|
-
getName(): string;
|
|
29
|
-
getProps(): {
|
|
30
|
-
enabled: boolean;
|
|
31
|
-
priority: number;
|
|
32
|
-
start: {
|
|
33
|
-
_r: number;
|
|
34
|
-
_g: number;
|
|
35
|
-
_b: number;
|
|
36
|
-
_alpha: number;
|
|
37
|
-
};
|
|
38
|
-
end: {
|
|
39
|
-
_r: number;
|
|
40
|
-
_g: number;
|
|
41
|
-
_b: number;
|
|
42
|
-
_alpha: number;
|
|
43
|
-
};
|
|
44
|
-
startVariance: {
|
|
45
|
-
_r: number;
|
|
46
|
-
_g: number;
|
|
47
|
-
_b: number;
|
|
48
|
-
_alpha: number;
|
|
49
|
-
};
|
|
50
|
-
endVariance: {
|
|
51
|
-
_r: number;
|
|
52
|
-
_g: number;
|
|
53
|
-
_b: number;
|
|
54
|
-
_alpha: number;
|
|
55
|
-
};
|
|
56
|
-
sinus: boolean;
|
|
57
|
-
colorStops: Color[];
|
|
58
|
-
usePerlin: boolean;
|
|
59
|
-
pulseSpeed: number;
|
|
60
|
-
pulseIntensity: number;
|
|
61
|
-
mirrorTransition: boolean;
|
|
62
|
-
fadeToGray: boolean;
|
|
63
|
-
fadeToTransparent: boolean;
|
|
64
|
-
flickerIntensity: number;
|
|
65
|
-
name: string;
|
|
66
|
-
};
|
|
67
|
-
}
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
import { Color } from '../util';
|
|
2
|
-
import Behaviour from './Behaviour';
|
|
3
|
-
import BehaviourNames from './BehaviourNames';
|
|
4
|
-
export default class ColorBehaviour extends Behaviour {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.enabled = false;
|
|
8
|
-
this.priority = 0;
|
|
9
|
-
this.start = new Color();
|
|
10
|
-
this.end = new Color();
|
|
11
|
-
this.startVariance = new Color(0, 0, 0, 0);
|
|
12
|
-
this.endVariance = new Color(0, 0, 0, 0);
|
|
13
|
-
this.sinus = false;
|
|
14
|
-
// New properties
|
|
15
|
-
this.colorStops = []; // Multi-gradient stops
|
|
16
|
-
this.usePerlin = false; // Enable Perlin noise-based color changes
|
|
17
|
-
this.pulseSpeed = 0; // Speed of the pulse effect
|
|
18
|
-
this.pulseIntensity = 0; // Intensity of the pulse effect
|
|
19
|
-
this.mirrorTransition = false; // Mirror the color transition midway
|
|
20
|
-
this.fadeToGray = false; // Desaturate color over time
|
|
21
|
-
this.fadeToTransparent = false; // Fade alpha over time
|
|
22
|
-
this.flickerIntensity = 0; // Intensity of random flickering
|
|
23
|
-
this.init = (particle) => {
|
|
24
|
-
if (!this.enabled)
|
|
25
|
-
return;
|
|
26
|
-
particle.colorStart.copyFrom(this.start);
|
|
27
|
-
particle.colorStart.r += this.varianceFrom(this.startVariance.r);
|
|
28
|
-
particle.colorStart.g += this.varianceFrom(this.startVariance.g);
|
|
29
|
-
particle.colorStart.b += this.varianceFrom(this.startVariance.b);
|
|
30
|
-
particle.colorStart.alpha += this.varianceFrom(this.startVariance.alpha);
|
|
31
|
-
particle.colorEnd.copyFrom(this.end);
|
|
32
|
-
particle.colorEnd.r += this.varianceFrom(this.endVariance.r);
|
|
33
|
-
particle.colorEnd.g += this.varianceFrom(this.endVariance.g);
|
|
34
|
-
particle.colorEnd.b += this.varianceFrom(this.endVariance.b);
|
|
35
|
-
particle.colorEnd.alpha += this.varianceFrom(this.endVariance.alpha);
|
|
36
|
-
particle.color.copyFrom(particle.colorStart);
|
|
37
|
-
};
|
|
38
|
-
this.apply = (particle) => {
|
|
39
|
-
if (!this.enabled)
|
|
40
|
-
return;
|
|
41
|
-
if (particle.skipColorBehaviour)
|
|
42
|
-
return;
|
|
43
|
-
const { lifeProgress } = particle;
|
|
44
|
-
// Multi-gradient color transitions
|
|
45
|
-
if (this.colorStops.length > 0) {
|
|
46
|
-
this.applyColorStops(particle, lifeProgress);
|
|
47
|
-
if (this.sinus) {
|
|
48
|
-
particle.color.alpha = Math.sin(lifeProgress * 3.1);
|
|
49
|
-
}
|
|
50
|
-
else if (this.fadeToTransparent) {
|
|
51
|
-
particle.color.alpha = (1 - lifeProgress) * this.start.alpha;
|
|
52
|
-
}
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
// Perlin noise color changes
|
|
56
|
-
if (this.usePerlin) {
|
|
57
|
-
this.applyPerlinColor(particle, lifeProgress);
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
// Default linear gradient behavior
|
|
61
|
-
const { colorStart, colorEnd } = particle;
|
|
62
|
-
let effectiveProgress = lifeProgress;
|
|
63
|
-
// Mirror transition if enabled
|
|
64
|
-
if (this.mirrorTransition) {
|
|
65
|
-
effectiveProgress = lifeProgress < 0.5 ? lifeProgress * 2 : (1 - lifeProgress) * 2;
|
|
66
|
-
}
|
|
67
|
-
particle.color.copyFrom(colorStart);
|
|
68
|
-
particle.color.r += (colorEnd.r - colorStart.r) * effectiveProgress;
|
|
69
|
-
particle.color.g += (colorEnd.g - colorStart.g) * effectiveProgress;
|
|
70
|
-
particle.color.b += (colorEnd.b - colorStart.b) * effectiveProgress;
|
|
71
|
-
if (!this.sinus) {
|
|
72
|
-
particle.color.alpha += (colorEnd.alpha - colorStart.alpha) * effectiveProgress;
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
if (!this.fadeToTransparent) {
|
|
76
|
-
particle.color.alpha = Math.sin(effectiveProgress * 3.1);
|
|
77
|
-
if (particle.color.alpha > particle.superColorAlphaEnd) {
|
|
78
|
-
particle.color.alpha = particle.superColorAlphaEnd;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
// Apply pulse effect if enabled
|
|
83
|
-
if (this.pulseIntensity > 0) {
|
|
84
|
-
this.applyPulseEffect(particle, lifeProgress);
|
|
85
|
-
}
|
|
86
|
-
// Desaturation (fade to gray)
|
|
87
|
-
if (this.fadeToGray) {
|
|
88
|
-
this.applyFadeToGray(particle);
|
|
89
|
-
}
|
|
90
|
-
// Alpha fading (fade to transparent)
|
|
91
|
-
if (this.fadeToTransparent && !this.sinus) {
|
|
92
|
-
particle.color.alpha = (1 - lifeProgress) * this.start.alpha;
|
|
93
|
-
}
|
|
94
|
-
// Flickering effect
|
|
95
|
-
if (this.flickerIntensity) {
|
|
96
|
-
this.applyFlickering(particle);
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
this.applyColorStops = (particle, lifeProgress) => {
|
|
100
|
-
const { colorStops } = this;
|
|
101
|
-
// Ensure at least two color stops exist
|
|
102
|
-
if (colorStops.length < 2) {
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
// Clamp segment to valid range
|
|
106
|
-
const segment = Math.floor(lifeProgress * (colorStops.length - 1));
|
|
107
|
-
const nextSegment = Math.min(segment + 1, colorStops.length - 1); // Prevent out-of-bounds access
|
|
108
|
-
const t = lifeProgress * (colorStops.length - 1) - segment;
|
|
109
|
-
const startColor = colorStops[segment];
|
|
110
|
-
const endColor = colorStops[nextSegment]; // Safely access the next color stop
|
|
111
|
-
particle.color.r = startColor.r + (endColor.r - startColor.r) * t;
|
|
112
|
-
particle.color.g = startColor.g + (endColor.g - startColor.g) * t;
|
|
113
|
-
particle.color.b = startColor.b + (endColor.b - startColor.b) * t;
|
|
114
|
-
particle.color.alpha = startColor.alpha + (endColor.alpha - startColor.alpha) * t;
|
|
115
|
-
};
|
|
116
|
-
this.applyPerlinColor = (particle, lifeProgress) => {
|
|
117
|
-
const time = lifeProgress * 10; // Scale time
|
|
118
|
-
particle.color.r = this.pseudoRandomNoise(time) * 255;
|
|
119
|
-
particle.color.g = this.pseudoRandomNoise(time + 1) * 255;
|
|
120
|
-
particle.color.b = this.pseudoRandomNoise(time + 2) * 255;
|
|
121
|
-
particle.color.alpha = this.pseudoRandomNoise(time + 3);
|
|
122
|
-
};
|
|
123
|
-
this.applyPulseEffect = (particle, lifeProgress) => {
|
|
124
|
-
// Compute pulse value based on life progress, speed, and intensity
|
|
125
|
-
const pulse = 1 + Math.sin(lifeProgress * this.pulseSpeed * Math.PI * 2) * this.pulseIntensity;
|
|
126
|
-
// Apply pulse effect to the color
|
|
127
|
-
particle.color.r = Math.max(0, Math.min(255, particle.color.r * pulse));
|
|
128
|
-
particle.color.g = Math.max(0, Math.min(255, particle.color.g * pulse));
|
|
129
|
-
particle.color.b = Math.max(0, Math.min(255, particle.color.b * pulse));
|
|
130
|
-
};
|
|
131
|
-
this.applyFadeToGray = (particle) => {
|
|
132
|
-
const { color } = particle;
|
|
133
|
-
const gray = (color.r + color.g + color.b) / 3;
|
|
134
|
-
particle.color.r = gray;
|
|
135
|
-
particle.color.g = gray;
|
|
136
|
-
particle.color.b = gray;
|
|
137
|
-
};
|
|
138
|
-
this.applyFlickering = (particle) => {
|
|
139
|
-
const flickerAmount = (Math.random() - 0.5) * this.flickerIntensity * 255;
|
|
140
|
-
particle.color.r = Math.max(0, Math.min(255, particle.color.r + flickerAmount));
|
|
141
|
-
particle.color.g = Math.max(0, Math.min(255, particle.color.g + flickerAmount));
|
|
142
|
-
particle.color.b = Math.max(0, Math.min(255, particle.color.b + flickerAmount));
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
pseudoRandomNoise(seed) {
|
|
146
|
-
const x = Math.sin(seed) * 10000;
|
|
147
|
-
return x - Math.floor(x); // Returns a value between 0 and 1
|
|
148
|
-
}
|
|
149
|
-
getName() {
|
|
150
|
-
return BehaviourNames.COLOR_BEHAVIOUR;
|
|
151
|
-
}
|
|
152
|
-
getProps() {
|
|
153
|
-
return {
|
|
154
|
-
enabled: this.enabled,
|
|
155
|
-
priority: this.priority,
|
|
156
|
-
start: {
|
|
157
|
-
_r: this.start.r,
|
|
158
|
-
_g: this.start.g,
|
|
159
|
-
_b: this.start.b,
|
|
160
|
-
_alpha: this.start.alpha,
|
|
161
|
-
},
|
|
162
|
-
end: {
|
|
163
|
-
_r: this.end.r,
|
|
164
|
-
_g: this.end.g,
|
|
165
|
-
_b: this.end.b,
|
|
166
|
-
_alpha: this.end.alpha,
|
|
167
|
-
},
|
|
168
|
-
startVariance: {
|
|
169
|
-
_r: this.startVariance.r,
|
|
170
|
-
_g: this.startVariance.g,
|
|
171
|
-
_b: this.startVariance.b,
|
|
172
|
-
_alpha: this.startVariance.alpha,
|
|
173
|
-
},
|
|
174
|
-
endVariance: {
|
|
175
|
-
_r: this.endVariance.r,
|
|
176
|
-
_g: this.endVariance.g,
|
|
177
|
-
_b: this.endVariance.b,
|
|
178
|
-
_alpha: this.endVariance.alpha,
|
|
179
|
-
},
|
|
180
|
-
sinus: this.sinus,
|
|
181
|
-
colorStops: this.colorStops,
|
|
182
|
-
usePerlin: this.usePerlin,
|
|
183
|
-
pulseSpeed: this.pulseSpeed,
|
|
184
|
-
pulseIntensity: this.pulseIntensity,
|
|
185
|
-
mirrorTransition: this.mirrorTransition,
|
|
186
|
-
fadeToGray: this.fadeToGray,
|
|
187
|
-
fadeToTransparent: this.fadeToTransparent,
|
|
188
|
-
flickerIntensity: this.flickerIntensity,
|
|
189
|
-
name: this.getName(),
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
//# sourceMappingURL=ColorBehaviour.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ColorBehaviour.js","sourceRoot":"","sources":["../../../src/lib/behaviour/ColorBehaviour.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,SAAS,MAAM,aAAa,CAAA;AACnC,OAAO,cAAc,MAAM,kBAAkB,CAAA;AAG7C,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,SAAS;IAArD;;QACE,YAAO,GAAG,KAAK,CAAA;QACf,aAAQ,GAAG,CAAC,CAAA;QACZ,UAAK,GAAG,IAAI,KAAK,EAAE,CAAA;QACnB,QAAG,GAAG,IAAI,KAAK,EAAE,CAAA;QACjB,kBAAa,GAAG,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;QACrC,gBAAW,GAAG,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC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|
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
|
-
oscillate: boolean;
|
|
9
|
-
oscillationSpeed: number;
|
|
10
|
-
oscillationAmplitude: number;
|
|
11
|
-
useNoise: boolean;
|
|
12
|
-
noiseScale: number;
|
|
13
|
-
velocityScaling: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Initializes the particle's direction.
|
|
16
|
-
* @param {Particle} particle - The particle that is being initialized.
|
|
17
|
-
* @memberof EmitDirectionBehaviour
|
|
18
|
-
*/
|
|
19
|
-
init: (particle: Particle) => void;
|
|
20
|
-
/**
|
|
21
|
-
* Applies the behavior to the particle.
|
|
22
|
-
* @param {Particle} particle - The particle to which the behavior is being applied.
|
|
23
|
-
* @param {number} deltaTime - The amount of time since the behavior was last applied.
|
|
24
|
-
* @memberof EmitDirectionBehaviour
|
|
25
|
-
*/
|
|
26
|
-
apply: (particle: Particle, deltaTime: number) => void;
|
|
27
|
-
pseudoRandomNoise(seed: number): number;
|
|
28
|
-
/**
|
|
29
|
-
* Gets the name of the behavior.
|
|
30
|
-
* @returns {BehaviourNames.EMIT_DIRECTION}
|
|
31
|
-
* @memberof EmitDirectionBehaviour
|
|
32
|
-
*/
|
|
33
|
-
getName(): string;
|
|
34
|
-
/**
|
|
35
|
-
* Gets the properties of the behavior.
|
|
36
|
-
* @returns {object} - The properties of the behavior.
|
|
37
|
-
* @memberof EmitDirectionBehaviour
|
|
38
|
-
*/
|
|
39
|
-
getProps(): {
|
|
40
|
-
enabled: boolean;
|
|
41
|
-
priority: number;
|
|
42
|
-
angle: number;
|
|
43
|
-
variance: number;
|
|
44
|
-
oscillate: boolean;
|
|
45
|
-
oscillationSpeed: number;
|
|
46
|
-
oscillationAmplitude: number;
|
|
47
|
-
useNoise: boolean;
|
|
48
|
-
noiseScale: number;
|
|
49
|
-
velocityScaling: boolean;
|
|
50
|
-
name: string;
|
|
51
|
-
};
|
|
52
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import Behaviour from './Behaviour';
|
|
2
|
-
import BehaviourNames from './BehaviourNames';
|
|
3
|
-
let _tmp = 0;
|
|
4
|
-
export default class EmitDirectionBehaviour extends Behaviour {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.enabled = true;
|
|
8
|
-
this.priority = 0;
|
|
9
|
-
this.angle = 0;
|
|
10
|
-
this.variance = 0;
|
|
11
|
-
// New properties
|
|
12
|
-
this.oscillate = false; // Enable directional oscillation
|
|
13
|
-
this.oscillationSpeed = 1; // Speed of oscillation
|
|
14
|
-
this.oscillationAmplitude = 0; // Amplitude of oscillation
|
|
15
|
-
this.useNoise = false; // Use Perlin noise for direction changes
|
|
16
|
-
this.noiseScale = 0.1; // Scale of the noise effect
|
|
17
|
-
this.velocityScaling = false; // Scale velocity based on life progress
|
|
18
|
-
/**
|
|
19
|
-
* Initializes the particle's direction.
|
|
20
|
-
* @param {Particle} particle - The particle that is being initialized.
|
|
21
|
-
* @memberof EmitDirectionBehaviour
|
|
22
|
-
*/
|
|
23
|
-
this.init = (particle) => {
|
|
24
|
-
if (!this.enabled)
|
|
25
|
-
return;
|
|
26
|
-
const baseAngle = this.angle + this.varianceFrom(this.variance);
|
|
27
|
-
particle.initialDirectionCos = Math.cos(baseAngle);
|
|
28
|
-
particle.initialDirectionSin = Math.sin(baseAngle);
|
|
29
|
-
particle.directionCos = particle.initialDirectionCos;
|
|
30
|
-
particle.directionSin = particle.initialDirectionSin;
|
|
31
|
-
particle.velocityScale = 1;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Applies the behavior to the particle.
|
|
35
|
-
* @param {Particle} particle - The particle to which the behavior is being applied.
|
|
36
|
-
* @param {number} deltaTime - The amount of time since the behavior was last applied.
|
|
37
|
-
* @memberof EmitDirectionBehaviour
|
|
38
|
-
*/
|
|
39
|
-
this.apply = (particle, deltaTime) => {
|
|
40
|
-
if (!this.enabled)
|
|
41
|
-
return;
|
|
42
|
-
if (particle.skipEmitDirectionBehaviour)
|
|
43
|
-
return;
|
|
44
|
-
const { x, y, directionSin, directionCos, lifeProgress } = particle;
|
|
45
|
-
// Apply directional oscillation
|
|
46
|
-
if (this.oscillate) {
|
|
47
|
-
const oscillation = Math.sin(particle.lifeTime * this.oscillationSpeed) * this.oscillationAmplitude;
|
|
48
|
-
particle.directionCos = Math.cos(oscillation);
|
|
49
|
-
particle.directionSin = Math.sin(oscillation);
|
|
50
|
-
}
|
|
51
|
-
// Apply Perlin noise-based direction changes
|
|
52
|
-
if (this.useNoise) {
|
|
53
|
-
const noiseValue = this.pseudoRandomNoise(particle.lifeTime * this.noiseScale);
|
|
54
|
-
const noiseAngle = noiseValue * 2 * Math.PI; // Map noise to full circle
|
|
55
|
-
particle.directionCos = Math.cos(noiseAngle);
|
|
56
|
-
particle.directionSin = Math.sin(noiseAngle);
|
|
57
|
-
}
|
|
58
|
-
// Scale velocity based on life progress
|
|
59
|
-
if (this.velocityScaling) {
|
|
60
|
-
particle.velocityScale = lifeProgress;
|
|
61
|
-
}
|
|
62
|
-
// Apply directional movement
|
|
63
|
-
_tmp = directionCos * x - directionSin * y;
|
|
64
|
-
particle.y = directionSin * x + directionCos * y;
|
|
65
|
-
particle.x = _tmp;
|
|
66
|
-
// Scale movement
|
|
67
|
-
particle.x *= particle.velocityScale;
|
|
68
|
-
particle.y *= particle.velocityScale;
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
pseudoRandomNoise(seed) {
|
|
72
|
-
const prime = 2654435761; // A prime constant
|
|
73
|
-
const x = Math.sin(seed * prime) * 10000; // Scale the randomness
|
|
74
|
-
return x - Math.floor(x); // Ensure result is between 0 and 1
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Gets the name of the behavior.
|
|
78
|
-
* @returns {BehaviourNames.EMIT_DIRECTION}
|
|
79
|
-
* @memberof EmitDirectionBehaviour
|
|
80
|
-
*/
|
|
81
|
-
getName() {
|
|
82
|
-
return BehaviourNames.EMIT_DIRECTION;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Gets the properties of the behavior.
|
|
86
|
-
* @returns {object} - The properties of the behavior.
|
|
87
|
-
* @memberof EmitDirectionBehaviour
|
|
88
|
-
*/
|
|
89
|
-
getProps() {
|
|
90
|
-
return {
|
|
91
|
-
enabled: this.enabled,
|
|
92
|
-
priority: this.priority,
|
|
93
|
-
angle: this.angle,
|
|
94
|
-
variance: this.variance,
|
|
95
|
-
oscillate: this.oscillate,
|
|
96
|
-
oscillationSpeed: this.oscillationSpeed,
|
|
97
|
-
oscillationAmplitude: this.oscillationAmplitude,
|
|
98
|
-
useNoise: this.useNoise,
|
|
99
|
-
noiseScale: this.noiseScale,
|
|
100
|
-
velocityScaling: this.velocityScaling,
|
|
101
|
-
name: this.getName(),
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
//# sourceMappingURL=EmitDirectionBehaviour.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EmitDirectionBehaviour.js","sourceRoot":"","sources":["../../../src/lib/behaviour/EmitDirectionBehaviour.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAA;AACnC,OAAO,cAAc,MAAM,kBAAkB,CAAA;AAG7C,IAAI,IAAI,GAAG,CAAC,CAAA;AAEZ,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,SAAS;IAA7D;;QACE,YAAO,GAAG,IAAI,CAAA;QACd,aAAQ,GAAG,CAAC,CAAA;QACZ,UAAK,GAAG,CAAC,CAAA;QACT,aAAQ,GAAG,CAAC,CAAA;QAEZ,iBAAiB;QACjB,cAAS,GAAG,KAAK,CAAA,CAAC,iCAAiC;QACnD,qBAAgB,GAAG,CAAC,CAAA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,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA,CAAC,mCAAmC;IAC9D,CAAC;IAED;;;;OAIG;IACH,OAAO;QACL,OAAO,cAAc,CAAC,cAAc,CAAA;IACtC,CAAC;IAED;;;;OAIG;IACH,QAAQ;QACN,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,oBAAoB,EAAE,IAAI,CAAC,oBAAoB;YAC/C,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE;SACrB,CAAA;IACH,CAAC;CACF"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import Particle from '../Particle';
|
|
2
|
-
import Model from '../Model';
|
|
3
|
-
import TurbulencePool from '../util/turbulencePool';
|
|
4
|
-
/**
|
|
5
|
-
* EmitterBehaviours class manages the behaviour of particles
|
|
6
|
-
*/
|
|
7
|
-
export default class EmitterBehaviours {
|
|
8
|
-
behaviours: any;
|
|
9
|
-
/**
|
|
10
|
-
* Gets all the enabled behaviours
|
|
11
|
-
*
|
|
12
|
-
* @return {any[]} The enabled behaviours
|
|
13
|
-
*/
|
|
14
|
-
getAll: () => any;
|
|
15
|
-
/**
|
|
16
|
-
* Clears all the stored behaviours
|
|
17
|
-
*/
|
|
18
|
-
clear: () => void;
|
|
19
|
-
/**
|
|
20
|
-
* Adds a behaviour
|
|
21
|
-
*
|
|
22
|
-
* @param {any} behaviour The behaviour to add
|
|
23
|
-
*
|
|
24
|
-
* @return {any} The added behaviour
|
|
25
|
-
*/
|
|
26
|
-
add: (behaviour: any) => any;
|
|
27
|
-
/**
|
|
28
|
-
* Checks if there are no behaviours stored
|
|
29
|
-
*
|
|
30
|
-
* @return {boolean} True if there are no behaviours stored, false otherwise
|
|
31
|
-
*/
|
|
32
|
-
isEmpty: () => boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Gets a behaviour by name
|
|
35
|
-
*
|
|
36
|
-
* @param {string} name The name of the behaviour to get
|
|
37
|
-
*
|
|
38
|
-
* @return {any | null} The behaviour with the given name or null if not found
|
|
39
|
-
*/
|
|
40
|
-
getByName: (name: string) => any;
|
|
41
|
-
/**
|
|
42
|
-
* Removes a behaviour by name
|
|
43
|
-
*
|
|
44
|
-
* @param {string} name The name of the behaviour to remove
|
|
45
|
-
*/
|
|
46
|
-
removeByName: (name: string) => void;
|
|
47
|
-
/**
|
|
48
|
-
* Initialises the behaviours
|
|
49
|
-
*
|
|
50
|
-
* @param {Particle} particle The particle
|
|
51
|
-
* @param {Model} model The model
|
|
52
|
-
* @param {Model} turbulencePool The turbulencePool
|
|
53
|
-
*/
|
|
54
|
-
init: (particle: Particle, model: Model, turbulencePool: TurbulencePool) => void;
|
|
55
|
-
/**
|
|
56
|
-
* Applies the behaviours
|
|
57
|
-
*
|
|
58
|
-
* @param {Particle} particle The particle
|
|
59
|
-
* @param {number} deltaTime The delta time
|
|
60
|
-
* @param {Model} model The model
|
|
61
|
-
*/
|
|
62
|
-
apply: (particle: Particle, deltaTime: number, model: Model) => void;
|
|
63
|
-
/**
|
|
64
|
-
* Update once per frame
|
|
65
|
-
*
|
|
66
|
-
* @param {number} deltaTime The delta time
|
|
67
|
-
*/
|
|
68
|
-
update: (deltaTime: number) => void;
|
|
69
|
-
}
|