-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcircle_and_rectangles.rb
28 lines (24 loc) · 1.01 KB
/
circle_and_rectangles.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env jruby
require 'picrate'
# After a sketch by Marc Edwards at Bjango
# https:#github.com/bjango/Processing-SVG-experiments
class CircleRectangle < Processing::App
load_library :svg
def settings
size(250, 250) # Set up a 250×250 canvas.
end
def setup
sketch_title 'Simple Example'
begin_record(SVG, data_path('simple.svg')) # Start recording drawing operations to this file.
no_loop # Only run draw once.
end
def draw
no_stroke # Turn off the border on objects we’re about to draw.
fill(color('#4bbcf6')) # Set the fill colour to light blue.
rect(50, 50, 100, 100) # Draw a rectangle on the canvas and to the SVG file.
fill(color('#5721a5')) # Set the fill colour to purple.
ellipse(150, 150, 100, 100) # Draw a circle on the canvas and to the SVG file.
end_record # Save and close the SVG file recording.
end
end
CircleRectangle.new