Always amazing to see what sort of playful and visually attractive experience you can spark with just a few lines of code! Starting a series here titled “Fun With Arrays” in Processing.
The code:
int num =150; int[] x = new int[num]; int[] y = new int[num]; void setup() { size(600, 400); noStroke(); fill(255, 102); } void draw() { background(0); // Shift the values to the right for (int i = num-1; i > 0; i--) { x[i] = x[i-1]; y[i] = y[i-1]; } // Add the new values to the beginning of the array x[0] = mouseX; y[0] = mouseY; // Draw the circles for (int i = 0; i < num; i++) { ellipse(x[i], y[i], i/2.0, i/2.0); } }