Guest User

Untitled

a guest
Oct 16th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. //change this sketch so it rotates around the original position of the shape
  2. int x, y;
  3. int size = 100;
  4.  
  5.  
  6. void setup() {
  7. size(600, 600);
  8. rectMode(CENTER);
  9. x = width/2;
  10. y = height/2;
  11.  
  12. }
  13.  
  14. void draw(){
  15. background(255);
  16. rect(width/2, height/2, size, size);
  17.  
  18. pushMatrix();
  19.  
  20. int r = mouseX-mouseY;
  21. translate(x, y);
  22. rotate(radians(r));
  23. rect(width/4, height/4, size, size);
  24. rotate(radians(r));
  25. rect(width/3, height/3, size, size);
  26.  
  27. popMatrix();
  28.  
  29. }
Add Comment
Please, Sign In to add comment