diff --git a/app/particles/emitter.js b/app/particles/emitter.js index 7f8e115..bb3a192 100644 --- a/app/particles/emitter.js +++ b/app/particles/emitter.js @@ -1,6 +1,7 @@ import K from 'kefir'; import * as easings from '@/util/easing.js'; +import {TAU} from '@/util/math.js'; export default class Emitter { constructor(ecs) { @@ -11,6 +12,18 @@ export default class Emitter { const allocated = this.ecs.get(await this.ecs.create(entity)); if (shape) { switch (shape.type) { + case 'circle': { + const r = Math.random() * TAU; + allocated.Position.x += Math.cos(r) * shape.payload.radius; + allocated.Position.y += Math.sin(r) * shape.payload.radius; + break; + } + case 'filledCircle': { + const r = Math.random() * TAU; + allocated.Position.x += Math.cos(r) * Math.random() * shape.payload.radius; + allocated.Position.y += Math.sin(r) * Math.random() * shape.payload.radius; + break; + } case 'filledRect': { allocated.Position.x += Math.random() * shape.payload.width - (shape.payload.width / 2); allocated.Position.y += Math.random() * shape.payload.height - (shape.payload.height / 2);