Particle #5-- rate example
rate generates groups of particles in a pattern.
by schrodingers
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.4.5/p5.min.js"></script>
<script src="https://rawgit.com/bobcgausa/cook-js/master/p5.particle.js"></script>
JavaScript
var of;
function setup() {
createCanvas(400, 400);
var t =
{ name: "test",
colors: ["blue","green","red"],
lifetime: 200,
angle: [260,280],
size: [2,8],
speed: 2,
speedx: 0.7,
//40 at .1 probability/step
//then 200 steps at 10 particles/step
rate: [40,0.1,200,10],
x: 0.5,
y: 0.8
};
of = new Fountain(null, t);
}
function draw() {
background(51);
blendMode(SCREEN);
of.Draw();
of.CreateN(); //must use CreateN for "rate" control
of.Step();
noStroke();
text(of.length, width/2, 20);
stroke(0);
}