Skip to content

Add createParticles and particles #120

@quinton-ashley

Description

@quinton-ashley

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

Example usage:

let q = await Q5.WebGPU();

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);
}

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

Canvas2D mode would have a polyfill for it.

I'm going to launch q5 v3.0 first before working on this.

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