float[] x = new float[10]; float[] y = new float[10]; float[] vx = new float[10]; float[] vy = new float[10]; void setup() { size(200, 100); stroke(255); background(0); smooth(); for (int i = 0; i < 10; i++) { x[i] = random(width); y[i] = random(height); vx[i] = random(-2, 2); vy[i] = random(-2, 2); } } void draw() { background(0); for (int i = 0; i < 10; i++) { ellipse(x[i], y[i], 10, 10); x[i] = x[i] + vx[i]; y[i] = y[i] + vy[i]; if (x[i] > width) { vx[i] = -vx[i]; } if (x[i] < 0) { vx[i] = -vx[i]; } if (y[i] > height) { vy[i] = -vy[i]; } if (y[i] < 0) { vy[i] = -vy[i]; } } }