/** * kenny smith * Created 20 march 2008 */ void setup(){ frameRate(12); size(400, 400); noCursor(); fill (255); noStroke(); for (int i = 0; i < Xsquares; i++){ for (int j = 0; j < Ysquares; j++){ squareX[i][j] = -50; squareY[i][j] = -50; squareXMove[i][j] = 0; squareYMove[i][j] = 0; } } } int Xsquares = 13; int Ysquares = 20; int[][] squareX = new int[Xsquares][Ysquares]; int[][] squareY = new int[Xsquares][Ysquares]; int[][] squareXMove = new int[Xsquares][Ysquares]; int[][] squareYMove = new int[Xsquares][Ysquares]; int row= 0; int place=0; void draw(){ background(0); //for (int up=0; up < 300; up++){ //squareYMove+=1; if (place > 10) { for (int i = 0; i < Xsquares; i++){ squareX[i][row] = i*30; squareY[i][row] = 400; squareXMove[i][row] = int(random(5)-2); squareYMove[i][row] = int(random(5)-1); //fill(row*20); place = 0; row++; if (row >Ysquares-2) { row = 0; } } } place++; for (int j = 0; j < Ysquares; j++){ for (int i = 0; i < Xsquares; i++){ //if (squareY[i][j]<150) //{ // squareY[i][j]+=squareYMove[i][j]; // squareX[i][j]+=squareXMove[i][j]; //} squareX[i][j]-=int(sqrt(height+120-squareY[i][j])/20)*squareXMove[i][j]; //squareX[i][j]+=squareXMove[i][j]*int(squareY[i][j]/400); rect(squareX[i][j]+10, squareY[i][j], 15, 15); squareY[i][j]-=int(sqrt(height+120-squareY[i][j])/18)*squareYMove[i][j]+2; //rect(100, 100, 20, 20); //shape(square[i], square[i]); } } //this.square[1] = new shape(5, 50); //shape(5, 50); } void shape(int x, int y) { //fill (x); //x = int (x *1.1); //y = int (y *1.1); rect(x, y, 20, 20); //rect(x+ 100, y + 100, int(x - 10), int(y - 10)); //shape(x + 10, y - 10); }