KRITSADA

Circle

Dec 16th, 2021
1,323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Demonstrates shapes and colours in Processing
  2. # Copyright 2021 Roland Richter
  3.  
  4. # Creates a 600×450 canvas with "Light sky blue" background
  5. # HINT You can look up colors (e.g. http://latexcolor.com/),
  6. #      but you can also use the Color Selector dialog in the
  7. #      Tools menu above.
  8. size(600, 450)
  9. background("#87CEEB")
  10.  
  11. stroke("#FF4500")     # QUIZ What is the difference between the
  12. fill("#FFCC33")       #      stroke color and the fill color?
  13.  
  14. # QUIZ What happens if you increase the stroke weight?
  15. strokeWeight(1)
  16.  
  17. # QUIZ What does noStroke() do?
  18. # noStroke()
  19.  
  20. # Draw a circle with diameter 42
  21. circle(40, 25, 42)         # Where is it?
  22. circle(400, 25, 42)        # ... and now?
  23. circle(40, 250, 42)        # ... and now?
  24. circle(40, 2500, 42)       # ... and now?
  25. circle(width-40, 25, 42)   # ... now?
  26. circle(40, height-25, 42)  # ... now?
  27. circle(width-40, height+5, 42)  # ... now?
  28. circle(0.5*width, 0.3*height, 42) # ?
  29.  
  30. # QUIZ Above, eight circles are drawn to the canvas.
  31. #      How many can you see? Why?
  32.  
  33. # ----------------------------------------------------------------------
  34. # This program is free software: you can redistribute it and/or modify
  35. # it under the terms of the GNU General Public License as published by
  36. # the Free Software Foundation, either version 3 of the License, or
  37. # (at your option) any later version.
  38. #
  39. # This program is distributed in the hope that it will be useful,
  40. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  41. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  42. # GNU General Public License for more details.
  43. #
  44. # You should have received a copy of the GNU General Public License
  45. # along with this program.  If not, see <https://www.gnu.org/licenses/>.
  46.  
Advertisement
Add Comment
Please, Sign In to add comment