chore: format

This commit is contained in:
cha0s 2022-05-04 03:12:16 -05:00
parent 48ff861b97
commit 43e81ca9fa

View File

@ -112,50 +112,25 @@ export default (flecks) => class Emitter extends decorate(Trait) {
return undefined;
}
const particle = entity.particle();
const position = particle.position
? particle.position
: this.entity.position;
const position = particle.position ? particle.position : this.entity.position;
const initializers = [
new Proton.Body(entity),
new Proton.Position(new Proton.PointZone(
position[0],
position[1],
)),
new Proton.Position(new Proton.PointZone(position[0], position[1])),
new Proton.Mass(particle.mass),
new Proton.Life(particle.ttl),
new Proton.Velocity(
particle.velocity.magnitude,
particle.velocity.angle,
'polar',
),
new Proton.Velocity(particle.velocity.magnitude, particle.velocity.angle, 'polar'),
];
const behaviors = [
new Proton.Alpha(
particle.alpha.start,
particle.alpha.end,
),
new Proton.Force(
particle.force[0],
particle.force[1],
),
new Proton.Rotate(
particle.rotation.start,
particle.rotation.add,
'add',
),
new Proton.Alpha(particle.alpha.start, particle.alpha.end),
new Proton.Force(particle.force[0], particle.force[1]),
new Proton.Rotate(particle.rotation.start, particle.rotation.add, 'add'),
];
if (particle.scale) {
behaviors.push(
new Proton.Scale(
particle.scale.start,
particle.scale.end,
),
new Proton.Scale(particle.scale.start, particle.scale.end),
);
}
const protonParticle = this.$$emitter.createParticle(
initializers,
behaviors,
);
const protonParticle = this.$$emitter.createParticle(initializers, behaviors);
protonParticle.particle = particle;
entity.on('destroyed', () => {
protonParticle.dead = true;