Skip to content

Commit 3825466

Browse files
committed
23.3.15, Compatible with Pixi v7.2.0
1 parent f06fa72 commit 3825466

File tree

7 files changed

+128
-79
lines changed

7 files changed

+128
-79
lines changed

demo/app.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,10 @@ backdrop.height = app.view.height;
1818
backdrop.anchor = { x: 0, y: 0 };
1919
app.stage.addChild(backdrop);
2020

21-
const emitter = PIXI.Particles.from('/demo/assets/star.png', 250, {
22-
life: app.view.width * 0.7071067812,
23-
direction: Math.PI * 1.5,
24-
spread: Math.PI,
21+
const emitter = PIXI.Particles.from('/demo/assets/star.png', 32, {
22+
life: 256,
23+
spread: Math.PI * 2,
2524
});
26-
emitter.x = app.view.width * 0.5;
27-
emitter.y = app.view.height;
2825
app.stage.addChild(emitter);
2926

3027
let planet = new PIXI.Sprite(tex.planet);
@@ -58,6 +55,7 @@ app.ticker.add((deltaTime) => {
5855
let h = Math.hypot(x, y) / player.speedMult + 1;
5956
player.vec.x = player.vec.x * 0.995 + 0.005 * (x / h) * deltaTime;
6057
player.vec.y = player.vec.y * 0.995 + 0.005 * (y / h) * deltaTime;
61-
player.x += player.vec.x;
58+
emitter.spawn.x = player.x += player.vec.x;
6259
player.y += player.vec.y;
60+
emitter.spawn.y = player.y - player.scale.y * player.height * 0.5;
6361
});

documentation.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ <h2 id="PIXI.Particles">PIXI.Particles</h2>
102102
<br>.direction = specifies the direction (in radians) that the particles will move (default 0)
103103
<br>.spread = the angle (in radians) of how closely particles should follow the direction. 0 is no
104104
deviation, 2 PI is in a full circle (default is 2 PI)
105+
<br><span class="nightly">.spawn</span> = {x, y} object that indicates where particles will be created
105106
<br>.step() = a shared function that moves and updates all particles
106107
</dd>
107108
</dl>

documentation/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<br>.direction = specifies the direction (in radians) that the particles will move (default 0)
1818
<br>.spread = the angle (in radians) of how closely particles should follow the direction. 0 is no
1919
deviation, 2 PI is in a full circle (default is 2 PI)
20+
<br><span class="nightly">.spawn</span> = {x, y} object that indicates where particles will be created
2021
<br>.step() = a shared function that moves and updates all particles
2122
</dd> </dl> <h2>PIXI.collision</h2> <dl> <dt>PIXI.collision.aabb(Sprite, Sprite)</dt> <dd>Checks if the two provided Sprites are colliding with the aabb algorithm - NOTE: Both a and b are
2223
formatted

nightly/pixi.js

Lines changed: 107 additions & 62 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nightly/pixi.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nightly/zephyr.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ PIXI.Particles = {};
77
// ZEPHYR FUNCTIONALITY //
88

99
PIXI.Zephyr = {
10-
version: "ZephyrJS 23.2.20",
11-
compatible: "PixiJS v7.1.3",
10+
version: "ZephyrJS 23.3.15",
11+
compatible: "PixiJS v7.2.0",
1212
_spriteFix: (s) => { // Returns the actual x/y width/height of a scaled and anchored Sprite
1313
let w = s.width * (s.scale ? s.scale.x : 1);
1414
let h = s.height * (s.scale ? s.scale.y : 1);
@@ -153,13 +153,14 @@ PIXI.Zephyr = {
153153
const init = (p) => {
154154
let r = (Math.random() - 0.5) * this.spread + this.direction;
155155
p.move = { x: this.speed * Math.cos(r), y: this.speed * Math.sin(r) };
156-
p.x = p.y = 0;
156+
p.x = this.spawn.x;
157+
p.y = this.spawn.y;
157158
p.life = this.life;
158159
}
159-
if (this.children.length < this.size) {
160+
if (this.children.length < this.maxCount) {
160161
this._spawnTimer -= deltaTime;
161162
if (this._spawnTimer <= 0) {
162-
this._spawnTimer = this.life / this.size;
163+
this._spawnTimer = this.life / this.maxCount;
163164
let p = new PIXI.Sprite(this.baseTexture);
164165
p.anchor = { x: 0.5, y: 0.5 }
165166
init(p);
@@ -173,17 +174,21 @@ PIXI.Zephyr = {
173174
init(p);
174175
});
175176
},
176-
from: (src, size, options) => {
177+
from: (src, maxCount, options) => {
177178
if (!options) options = {};
178-
let res = new PIXI.ParticleContainer(size);
179+
let res = new PIXI.ParticleContainer(maxCount);
179180
res._spawnTimer = 0;
180-
res.size = size;
181+
res.maxCount = maxCount;
181182
res.baseTexture = PIXI.Texture.from(src);
182183
res.life = (options.life ? options.life : 128);
183184
res.speed = (options.speed ? options.speed : 1);
184185
res.direction = (options.direction ? options.direction : 0);
185186
res.spread = (options.spread ? options.spread : 6.2831853072);
186187
res.step = PIXI.Particles._step;
188+
res.spawn = {
189+
x: options.x ? options.x : 1,
190+
y: options.y ? options.y : 1
191+
}
187192
return res;
188193
}
189194
}

style.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ header {
6363
}
6464

6565
#gameShowcase {
66-
cursor: none;
6766
overflow: hidden;
6867
z-index: 0;
6968
position: relative;

0 commit comments

Comments
 (0)