push
This commit is contained in:
@@ -18,7 +18,7 @@ var particles2d_proto = {
|
||||
var emitters = {
|
||||
// Spawn a particle for an emitter
|
||||
spawn: function(emitter) {
|
||||
emitter.particles.push({
|
||||
push(emitter.particles, {
|
||||
pos: {
|
||||
x: emitter.pos.x + (random() - 0.5) * emitter.spawn_area.width,
|
||||
y: emitter.pos.y + (random() - 0.5) * emitter.spawn_area.height
|
||||
@@ -76,17 +76,13 @@ var emitters = {
|
||||
alpha = 1 - (p.time - p.life * 0.7) / (p.life * 0.3)
|
||||
}
|
||||
p.color.a = alpha
|
||||
|
||||
// Remove dead particles
|
||||
if (p.time >= p.life) {
|
||||
emitter.particles.splice(i, 1)
|
||||
}
|
||||
}
|
||||
|
||||
emitter.particles = filter(emitter.particles, p => p.time < p.life)
|
||||
|
||||
// Sync to film2d if handle provided
|
||||
if (emitter.handle) {
|
||||
if (emitter.handle)
|
||||
emitter.handle.particles = emitter.particles
|
||||
}
|
||||
},
|
||||
|
||||
// Create an emitter config
|
||||
|
||||
Reference in New Issue
Block a user