This commit is contained in:
2026-01-21 09:05:02 -06:00
parent 18ca9e14ba
commit f7be9c3344
30 changed files with 237 additions and 246 deletions

View File

@@ -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