1- require 'ruby-processing'
21
3- class ZoogAsDynamicSketch < Processing ::App
42
5- # Setup runs first one time.
6- # In Ruby-Processing, you never need to call size(),
7- # just set the width and height when you instantiate the sketch,
8- # at the bottom.
9- def setup
10-
11- end
12-
13- # Draw loops continuously until you close the sketch window.
14- def draw
15- # Draw a white background
16- background 255
17-
18- # Set CENTER mode
19- ellipse_mode CENTER
20- rect_mode CENTER
21-
22- # Draw Zoog's body
23- stroke 0
24- fill 150
25- rect 100 , 100 , 20 , 100
26-
27- # Draw Zoog's head
28- fill 255
29- ellipse 100 , 70 , 60 , 60
30-
31- # Draw Zoog's eyes
32- fill 0
33- ellipse 81 , 70 , 16 , 32
34- ellipse 119 , 70 , 16 , 32
35-
36- # Draw Zoog's legs
37- stroke 0
38- line 90 , 150 , 80 , 160
39- line 110 , 150 , 120 , 160
40- end
3+ # Setup runs first one time.
4+ # In Ruby-Processing, you never need to call size(),
5+ # just set the width and height when you instantiate the sketch,
6+ # at the bottom.
7+ def setup
8+ size 200 , 200
9+ end
10+
11+ # Draw loops continuously until you close the sketch window.
12+ def draw
13+ # Draw a white background
14+ background 255
4115
16+ # Set CENTER mode
17+ ellipse_mode CENTER
18+ rect_mode CENTER
19+
20+ # Draw Zoog's body
21+ stroke 0
22+ fill 150
23+ rect 100 , 100 , 20 , 100
24+
25+ # Draw Zoog's head
26+ fill 255
27+ ellipse 100 , 70 , 60 , 60
28+
29+ # Draw Zoog's eyes
30+ fill 0
31+ ellipse 81 , 70 , 16 , 32
32+ ellipse 119 , 70 , 16 , 32
33+
34+ # Draw Zoog's legs
35+ stroke 0
36+ line 90 , 150 , 80 , 160
37+ line 110 , 150 , 120 , 160
4238end
4339
44- ZoogAsDynamicSketch . new :title => "Zoog As Dynamic Sketch" , :width => 200 , :height => 200
40+
0 commit comments