var ps = new ParticleSystem(); var dt = 0.01; function sampleDirection() { var theta = Math.random() * 2 * Math.PI; return new Vector2(Math.cos(theta), Math.sin(theta)); } function step() { ps.emit(new Particle(new Vector2(200, 200), sampleDirection().multiply(100), 1, Color.red, 5)); ps.simulate(dt); clearCanvas(); ps.render(ctx); } start("basicParticleSystemCanvas", step);
Run
Stop