Advertisement
Guest User

Untitled

a guest
May 23rd, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. //(255, 152, 204)
  2. //(153, 153, 255)
  3. //(255, 178, 102)
  4. //color[] colors= new color[3];
  5. //int colorCount = int(random(3));
  6. void setup(){
  7. size (500 , 500);
  8. rectMode(CORNER);
  9. noStroke();
  10. frameRate(5);
  11. //colors[0] = color(255, 152, 204, 100);
  12. //colors[1] = color(153, 153, 255, 100);
  13. //colors[2] = color(255, 178, 102, 100);
  14. }
  15.  
  16. //they are all the same size
  17. //there are 25 of them
  18. //5x5
  19. //size of squares are static, but not placement
  20. //needs to randomnly be placed everytime load scene
  21. //needs to randomnly assign color to square everytime load scene
  22. void draw(){
  23. background(180);
  24. //fill(255, 0, 0, 50);
  25. color[] colors= new color[3];
  26. int colorCount = int(random(3));
  27. colors[0] = color(255, 152, 204);
  28. colors[1] = color(153, 153, 255);
  29. colors[2] = color(255, 178, 102);
  30.  
  31. int gapsize = 10;
  32. float cellsize = (width - (5 + 1) * gapsize) / 5;
  33. for (int i=0; i<5; i++){
  34. for (int j=0; j<5; j++){
  35. //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)
  36. //rect(150 + (110*i) * gapsize, 150 + (110*j) *gapsize, 100, 100); //just one rect, multipled 25x (not one giant with spacing)
  37. fill(colors[colorCount], 180);
  38. rect(gapsize * (i+1) + cellsize * i + random(-5, 10), gapsize + (j+1) + cellsize * j + random (-10, 10), cellsize, cellsize);
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement