int rows = 10; //number of rows of squares to draw in the background int cols = 10; //number of columns of squares to draw in the background int flakes = 80; //number of snowflakes to draw in the foreground int[][] aSquare = new int[rows*cols][3]; //array to hold x, y, and shade values for each square int[][] aFlake = new int[flakes][4]; //array to hold starting x, y, and size and speed scale values for each flake Square[] oSquare = new Square[rows*cols]; //array to hold each square object Flake[] oFlake = new Flake[flakes]; //array to hold each flake object void setup() { size(300,300); framerate(30); fillSquareArray(); fillFlakeArray(); makeObjects(); smooth(); } void draw() { for(int i=0;i= 180) { Increment = -2; } } } class Flake { int xPos; int yPos; int Scale; int Speed; int xAdjust; Flake(int _x, int _y, int _s, int _d) { xPos = _x; yPos = _y; Scale = _s; Speed = _d; if(noise(yPos)<.4) { xAdjust = -1; } else if(noise(yPos)>.6) { xAdjust = 1; } else { xAdjust = 0; } } void refresh() { stroke(255,160); fill(255,160); ellipse(xPos, yPos, Scale*4, Scale*4); yPos = yPos+Speed; if((dist(xPos, yPos, mouseX, mouseY) < 60) && (xPos >= mouseX)) { xPos = xPos + 5; } else if((dist(xPos, yPos, mouseX, mouseY) < 60) && (xPos < mouseX)) { xPos = xPos - 5; } if((dist(xPos, yPos, mouseX, mouseY) < 60) && (yPos >= mouseY)) { yPos = yPos + 5; } else if((dist(xPos, yPos, mouseX, mouseY) < 60) && (yPos < mouseY)) { yPos = yPos - 5; } xPos = xPos + xAdjust; if(yPos-Scale*3 >= height) { yPos = -50; xPos = int(random(0, width)); Scale = int(random(3, 9)); Speed = int(random(2, 6)); } } }