Skip to content

Commit c0ca0cf

Browse files
committed
Documentation
1 parent bfa4892 commit c0ca0cf

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

documentation.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ <h2>PIXI.Zephyr</h2>
3131
<dd>Sets up the WebAudio API for Pixi-style usage</dd>
3232
<dt>PIXI.Zephyr.useFile()</dt>
3333
<dd>Sets up the File reading/writing system</dd>
34+
<dt class="nightly">PIXI.Zephyr.useParticles()</dt>
35+
<dd>Sets up the Particle Emitter backend for Pixi-Style usage</dd>
3436
</dl>
3537
<br>
3638
<h2>PIXI.Keys</h2>
@@ -89,20 +91,18 @@ <h2>PIXI.File</h2>
8991
<dd class="return">Object</dd>
9092
</dl>
9193
<br>
92-
<h2>PIXI.Particles</h2>
94+
<h2 class="nightly">PIXI.Particles</h2>
9395
<dl>
9496
<dt>PIXI.Particles.from(src, maxParticleCount)</dt>
9597
<dd>Returns a "PIXI Particle Emitter" which is a particleContainer with a built-in <strong>step()</strong>
9698
function to progress the animation. The different attributes of the container specify how the particles
9799
are emitted.</dd>
98-
<dd class="return">Pixi Particle Container
99-
<br>{
100-
<br>life: how far the particles can move away from the emitter's location, in pixels (default 128)
101-
<br>speed: quickly the particles move to their end of life distance (default 1)
102-
<br>direction: specifies the direction (in radians) that the particles will move (default 0)
103-
<br>spread: the angle (in radians) of how closely particles should follow the direction. 0 is no deviation, 2 PI is in a full circle (default is 2 PI)
104-
<br>step(): moves and updates all particles
105-
<br>}
100+
<dd class="return">Pixi Particle Emitter</dd>
101+
<dd>.life = how far the particles can move away from the emitter's location, in pixels (default 128)
102+
<br>.speed = quickly the particles move to their end of life distance (default 1)
103+
<br>.direction = specifies the direction (in radians) that the particles will move (default 0)
104+
<br>.spread = the angle (in radians) of how closely particles should follow the direction. 0 is no deviation, 2 PI is in a full circle (default is 2 PI)
105+
<br>.step() = a shared function that moves and updates all particles
106106
</dd>
107107
</dl>
108108
<br>

nightly/zephyr.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@ PIXI.Zephyr = {
154154
p.life = this.life;
155155
}
156156
if (this.children.length < this.size) {
157-
this.spawnTime -= deltaTime;
158-
if (this.spawnTime <= 0) {
159-
this.spawnTime = this.life / this.size;
157+
this._spawnTimer -= deltaTime;
158+
if (this._spawnTimer <= 0) {
159+
this._spawnTimer = this.life / this.size;
160160
let p = new PIXI.Sprite(this.baseTexture);
161161
p.anchor = { x: 0.5, y: 0.5 }
162162
init(p);
@@ -170,15 +170,16 @@ PIXI.Zephyr = {
170170
init(p);
171171
});
172172
},
173-
from: (src, size) => {
173+
from: (src, size, options) => {
174+
if (!options) options = {};
174175
let res = new PIXI.ParticleContainer(size);
176+
res._spawnTimer = 0;
175177
res.size = size;
176178
res.baseTexture = PIXI.Texture.from(src);
177-
res.life = 128;
178-
res.speed = 1;
179-
res.direction = 0;
180-
res.spread = 6.2831853072;
181-
res.spawnTime = 0;
179+
res.life = (options.life ? options.life : 128);
180+
res.speed = (options.speed ? options.speed : 1);
181+
res.direction = (options.direction ? options.direction : 0);
182+
res.spread = (options.spread ? options.spread : 6.2831853072);
182183
res.step = PIXI.Particles._step;
183184
return res;
184185
}

0 commit comments

Comments
 (0)