Skip to content

Add createParticles and particles #120

Description

@quinton-ashley

Add GPU accelerated particle system support to q5 WebGPU, similar to ParticleContainer in Pixi.js.

Example usage:

await Canvas();

let starImg = loadImage('star.png');

let stars = createParticles(100, starImg);

for (let star of stars) {
  star.x = jit(10);
  star.y = jit(10);
  star.vx = jit(1);
  star.vy = jit(1);
  star.tint = color(random(), 1, 1);
}

q5.draw = () => {
  particles(stars);
};

Canvas2D mode would have a polyfill for it.

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions