Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //(255, 152, 204)
- //(153, 153, 255)
- //(255, 178, 102)
- //color[] colors= new color[3];
- //int colorCount = int(random(3));
- void setup(){
- size (500 , 500);
- rectMode(CORNER);
- noStroke();
- frameRate(5);
- //colors[0] = color(255, 152, 204, 100);
- //colors[1] = color(153, 153, 255, 100);
- //colors[2] = color(255, 178, 102, 100);
- }
- //they are all the same size
- //there are 25 of them
- //5x5
- //size of squares are static, but not placement
- //needs to randomnly be placed everytime load scene
- //needs to randomnly assign color to square everytime load scene
- void draw(){
- background(180);
- //fill(255, 0, 0, 50);
- color[] colors= new color[3];
- int colorCount = int(random(3));
- colors[0] = color(255, 152, 204);
- colors[1] = color(153, 153, 255);
- colors[2] = color(255, 178, 102);
- int gapsize = 10;
- float cellsize = (width - (5 + 1) * gapsize) / 5;
- for (int i=0; i<5; i++){
- for (int j=0; j<5; j++){
- //rect(r + 150*i, 450, (int) random(-100, 100) (int) random (-100,100)); //the gridSize var makes it run through 5 times (each time, it multiplies)
- //rect(150 + (110*i) * gapsize, 150 + (110*j) *gapsize, 100, 100); //just one rect, multipled 25x (not one giant with spacing)
- fill(colors[colorCount], 180);
- rect(gapsize * (i+1) + cellsize * i + random(-5, 10), gapsize + (j+1) + cellsize * j + random (-10, 10), cellsize, cellsize);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement