//---------------------- // GloFlow // Boilerplate p5.js code //---------------------- let x, y; function setup() { createCanvas(720, 400); // starts in the middle x = width / 2; y = height; } function draw() { background(200); for (var i=0;i<5;i++) { element(0.5); element(0.2); element(0.1); element(0.6); element(0.4); } } function element(p_y_random_range) { // Draw a circle stroke(50); fill(100); ellipse(x, y, 24, 24); // Jiggling randomly on the horizontal axis x = x + random(-5, 5); // Moving up at a constant speed y = y - random(0, p_y_random_range); // Reset to the bottom if (y < 0) { y = height; } }
play
save
snap!
flow name: