/** * grid.pde * version 0.03 * written by d5c * http://littlesecretsrecords.com/d5c/ * d5c@littlesecretsrecords.com * * Flow continues indefinitely. * There is no user interaction. * Colors fade out after change. * Colors fade a little deeper now. **/ // variables for main Board myBoard; void setup() { //size(500, 500); size(800, 600); background(0); loop(); noCursor(); myBoard = new Board(); } void draw() { background(0); myBoard.sequentialChange(); myBoard.draw(); } /******************************************************* ******************Class Definitions******************** *******************************************************/ class Space { // static variables static public final int spaceWidth = 10; // width of one space in pixels static public final int spaceHeight = 10; // height of one space in pixels // local variables private int x; // x location of this space private int y; // y location of this space private int myColor; // color of this space, range 0-9 private int randShift; // tells the Space how to change based on surrounding colors private float timeLastChanged; // Time of last color change - used to fade out colors public Space (int x, int y, int initColor) { this.x = x; this.y = y; this.myColor = initColor; this.randShift = (int)random(999999999); } public void change (int newColor) { // change to a new Color based on surrounding colors and self // newColor is 9 digits