/* built with Studio Sketchpad: * https://sketchpad.cc * * observe the evolution of this sketch: * https://studio.sketchpad.cc/sp/pad/view/ro.rOK3zqH-Yrx/rev.17 * * authors: * GoToLoop * license (unless otherwise specified): * creative commons attribution-share alike 3.0 license. * https://creativecommons.org/licenses/by-sa/3.0/ */ /** * Chase-Shadow Circles (v3.21) * Regular Array Edition (2013/Feb) * * Modded by GoToLoop (2013/Nov) * * forum.processing.org/topic/newbie-question-understandig-problems-with-arrays * studio.processingtogether.com/sp/pad/export/ro.9GTDpA6dp4tH1/latest * www.creativecoding.org/lesson/basics/processing/arrays */ static final int NUM = 0100, NEWEST = NUM - 1; final int[] x = new int[NUM], y = new int[NUM]; void setup() { size(1000, 400, JAVA2D); frameRate(60); smooth(4); noStroke(); noCursor(); ellipseMode(CENTER); fill(0100<<030); mouseX = width>>1; mouseY = height>>1; for ( int i = NUM; i-- != 0; x[i] = mouseX, y[i] = mouseY ); } void draw() { background(-1); for ( int i = 0; i != NEWEST; ellipse(x[i] = x[i + 1], y[i] = y[i + 1], i, i++) ); ellipse(x[NEWEST] = mouseX, y[NEWEST] = mouseY, NEWEST, NEWEST); }