custom-pixi-particles 8.16.0 → 8.17.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/README.md CHANGED
@@ -57,7 +57,7 @@ If you find **custom-pixi-particles** useful and would like to support my work,
57
57
  ---
58
58
 
59
59
  ## 🎮 Demo
60
- Try it out here: [custom-pixi-particles Live Editor](https://okuniewicz.eu/)
60
+ Try it out here: [custom-pixi-particles Live Editor](https://particle-editor.okuniewicz.eu/)
61
61
 
62
62
  ---
63
63
 
@@ -1015,7 +1015,7 @@ Defines where and how particles spawn. Supports multiple spawn types.
1015
1015
  - `Path` - Custom path defined by points
1016
1016
  - `Oval` - Elliptical distributions
1017
1017
 
1018
- **Additional behaviours** (see the [editor](https://okuniewicz.eu/) for full documentation): Aizawa Attractor, Beat Phase Lock, Bezier Flow Tube, Boids Flocking, Bounce, Color Cycle, Constrain To Shape, Conversion Cascade, Curvature Flow, Damage Flash Ripple, Emitter Attractor Link, Flicker, Float Up, Form Pattern, Gravity Well, Homing, Jacobian Curl-Field, Kelvin Wake, Lissajous Harmonic Lattice, Limit Cycle, Magnet, Near Miss Dispersion, Obstacle SDF Steer, Orbit, Phase Coherence, Phase Field Flow, Proximity State, Proximity Triggered Phase, Pulse, Ripple, RVO Avoidance, Screen Space Flow Map, Shear Flow, Toroidal Wrap, Trail, Toroidal Flow, Vortex, Wobble.
1018
+ **Additional behaviours** (see the [editor](https://particle-editor.okuniewicz.eu/) for full documentation): Aizawa Attractor, Beat Phase Lock, Bezier Flow Tube, Boids Flocking, Bounce, Color Cycle, Constrain To Shape, Conversion Cascade, Curvature Flow, Damage Flash Ripple, Emitter Attractor Link, Flicker, Float Up, Form Pattern, Gravity Well, Homing, Jacobian Curl-Field, Kelvin Wake, Lissajous Harmonic Lattice, Limit Cycle, Magnet, Near Miss Dispersion, Obstacle SDF Steer, Orbit, Phase Coherence, Phase Field Flow, Proximity State, Proximity Triggered Phase, Pulse, Ripple, RVO Avoidance, Screen Space Flow Map, Shear Flow, Toroidal Wrap, Trail, Toroidal Flow, Vortex, Wobble.
1019
1019
 
1020
1020
  #### Size Behaviour
1021
1021
  Controls particle size over time.
@@ -1050,18 +1050,22 @@ Controls particle color and alpha over time.
1050
1050
  ```
1051
1051
 
1052
1052
  #### Rotation Behaviour
1053
- Controls particle rotation.
1053
+ Controls particle rotation at spawn and over time.
1054
1054
 
1055
1055
  ```javascript
1056
1056
  {
1057
1057
  priority: 0,
1058
1058
  enabled: true,
1059
- rotation: 0, // Initial rotation in radians
1060
- variance: 0.2, // Rotation randomness
1059
+ startRotation: 0, // Initial sprite angle at spawn (radians)
1060
+ startRotationVariance: Math.PI, // Random spread on spawn (±variance)
1061
+ rotation: 0, // Spin speed (radians per second)
1062
+ variance: 0.2, // Random variance on spin speed
1061
1063
  name: 'RotationBehaviour',
1062
1064
  }
1063
1065
  ```
1064
1066
 
1067
+ For a uniform random angle on spawn with no spin, use `startRotation: Math.PI`, `startRotationVariance: Math.PI`, and `rotation: 0`.
1068
+
1065
1069
  #### Angular Velocity Behaviour
1066
1070
  Controls particle spin speed and orbital motion.
1067
1071
 
@@ -1545,9 +1549,7 @@ Design and fine-tune particle effects visually with the **custom-pixi-particles-
1545
1549
  - Export/import of emitter configurations as JSON
1546
1550
  - Built-in descriptions for every behaviour and property
1547
1551
 
1548
- **Run locally:** Clone the [custom-pixi-particles-editor](https://github.com/lukasz-okuniewicz/custom-pixi-particles-editor) repository and run `npm install` then `npm run dev` from the editor folder.
1549
-
1550
- **Try online:** [custom-pixi-particles Live Editor](https://okuniewicz.eu/)
1552
+ **Try online:** [custom-pixi-particles Live Editor](https://particle-editor.okuniewicz.eu/)
1551
1553
 
1552
1554
  ---
1553
1555
 
@@ -9,6 +9,8 @@ export default class RotationBehaviour extends Behaviour {
9
9
  priority: number;
10
10
  rotation: number;
11
11
  variance: number;
12
+ startRotation: number;
13
+ startRotationVariance: number;
12
14
  oscillate: boolean;
13
15
  oscillationSpeed: number;
14
16
  oscillationAmplitude: number;
@@ -47,6 +49,8 @@ export default class RotationBehaviour extends Behaviour {
47
49
  priority: number;
48
50
  rotation: number;
49
51
  variance: number;
52
+ startRotation: number;
53
+ startRotationVariance: number;
50
54
  oscillate: boolean;
51
55
  oscillationSpeed: number;
52
56
  oscillationAmplitude: number;
@@ -9,8 +9,10 @@ export default class RotationBehaviour extends Behaviour {
9
9
  super(...arguments);
10
10
  this.enabled = false;
11
11
  this.priority = 0;
12
- this.rotation = 0; // Base rotation speed
12
+ this.rotation = 0; // Base rotation speed (radians per second)
13
13
  this.variance = 0; // Variance in rotation speed
14
+ this.startRotation = 0; // Initial sprite rotation at spawn (radians)
15
+ this.startRotationVariance = 0; // Random variance applied to startRotation at spawn
14
16
  this.oscillate = false; // Enable oscillation
15
17
  this.oscillationSpeed = 1; // Speed of oscillation
16
18
  this.oscillationAmplitude = 0; // Amplitude of oscillation
@@ -25,10 +27,9 @@ export default class RotationBehaviour extends Behaviour {
25
27
  this.init = (particle) => {
26
28
  if (!this.enabled)
27
29
  return;
28
- // Set base rotation delta with variance
30
+ particle.rotation = this.startRotation + this.varianceFrom(this.startRotationVariance);
29
31
  const baseRotation = this.rotation + this.varianceFrom(this.variance);
30
32
  particle.rotationDelta = this.clockwise ? baseRotation : -baseRotation;
31
- // Initialize acceleration if enabled
32
33
  particle.rotationAcceleration = this.acceleration;
33
34
  };
34
35
  /**
@@ -87,6 +88,8 @@ export default class RotationBehaviour extends Behaviour {
87
88
  priority: this.priority,
88
89
  rotation: this.rotation,
89
90
  variance: this.variance,
91
+ startRotation: this.startRotation,
92
+ startRotationVariance: this.startRotationVariance,
90
93
  oscillate: this.oscillate,
91
94
  oscillationSpeed: this.oscillationSpeed,
92
95
  oscillationAmplitude: this.oscillationAmplitude,
@@ -1 +1 @@
1
- {"version":3,"file":"RotationBehaviour.js","sourceRoot":"","sources":["../../../src/lib/behaviour/RotationBehaviour.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,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