Guest User

Untitled

a guest
Mar 22nd, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. branch <- function(len) {
  2.  
  3. line(0, 0, 0, -len);
  4. translate(0, -len);
  5.  
  6. len = len * 0.66;
  7.  
  8. if (len > 2) {
  9. pushMatrix();
  10. rotate(PI/6);
  11.  
  12. branch(len);
  13. popMatrix();
  14.  
  15. pushMatrix();
  16. rotate(-PI/6);
  17. branch(len);
  18. popMatrix();
  19. }
  20. }
  21.  
  22. settings <- function(){
  23. size(300, 200)
  24. }
  25.  
  26. draw <- function() {
  27. background(255);
  28.  
  29. theta = map(mouseX,0,width,0,PI/2);
  30.  
  31. translate(width/2, height);
  32. stroke(0);
  33. branch(60);
  34. }
  35.  
  36. settings()
  37. draw()
Add Comment
Please, Sign In to add comment