Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #!/usr/bin/env jruby
  2. # frozen_string_literal: false
  3. require 'propane'
  4.  
  5. # the bounds of a circle
  6. # propane graffiti by 8mana
  7. # based on code by Casey Reas and Ben Fry
  8.  
  9. class CircleBounds < Propane::App
  10. def settings
  11. size 240, 120
  12. end
  13.  
  14. def setup
  15. sketch_title 'the bounds of a circle'
  16. $x = 120
  17. $y = 60
  18. $radius = 12
  19. ellipseMode RADIUS
  20. end
  21.  
  22. def draw
  23. background 204
  24. d = dist mouseX, mouseY, $x, $y
  25. if d < $radius
  26. $radius += 1
  27. fill 0
  28. else
  29. fill 255
  30. end
  31. ellipse $x, $y, $radius, $radius
  32. end
  33. end
  34.  
  35. CircleBounds.new
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement