Advertisement
Guest User

Untitled

a guest
Mar 18th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. int tileCount = 20;
  2. int rectSize = 30;
  3.  
  4. int actRandomSeed = 0;
  5.  
  6. void setup(){
  7. size(600, 600);
  8. }
  9.  
  10.  
  11.  
  12. void draw() {
  13. colorMode(HSB, 360, 100, 100, 100);
  14. background(360);
  15. smooth();
  16. noStroke();
  17.  
  18.  
  19.  
  20. randomSeed(actRandomSeed);
  21.  
  22. for (int gridY=0; gridY<tileCount; gridY++) {
  23. for (int gridX=0; gridX<tileCount; gridX++) {
  24.  
  25. int posX = width/tileCount * gridX;
  26. int posY = height/tileCount * gridY;
  27.  
  28. float shiftX1 = mouseX/20 * random(-1, 1);
  29. float shiftY1 = mouseY/20 * random(-1, 1);
  30. float shiftX2 = mouseX/20 * random(-1, 1);
  31. float shiftY2 = mouseY/20 * random(-1, 1);
  32. float shiftX3 = mouseX/20 * random(-1, 1);
  33. float shiftY3 = mouseY/20 * random(-1, 1);
  34. float shiftX4 = mouseX/20 * random(-1, 1);
  35. float shiftY4 = mouseY/20 * random(-1, 1);
  36. fill(random(0,200),random(0,200),random(0,200),60);
  37. beginShape();
  38. vertex(posX+shiftX1, posY+shiftY1);
  39. vertex(posX+rectSize+shiftX2, posY+shiftY2);
  40. vertex(posX+rectSize+shiftX3, posY+rectSize+shiftY3);
  41. vertex(posX+shiftX4, posY+rectSize+shiftY4);
  42. endShape(CLOSE);
  43. }
  44. }
  45. }
  46.  
  47.  
  48. void mousePressed() {
  49. actRandomSeed = (int) random(100000);
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement