Using the Processing API
All of the Processing methods, as explained in the Processing Language API, are available as instance methods on your Processing::App. (frame_rate, ellipse, and the 158 others.) This makes it easy as pie to use them within your sketch.
require 'ruby-processing'
class Sketch < Processing::App
def setup
color_mode RGB, 1.0
frame_rate 30
fill 0.8
end
def draw
triangle(rand(width), rand(height), rand(width), rand(height), rand(width), rand(height))
end
end
P = Sketch.new(:width => 600, :height => 600, :title => "Triangles Gone Wild")
Because of this method madness, Processing::Apps have a convenience method for searching through them. app.find_method("ellipse") will return a list of the method names that may match what you’re looking for: “ellipse”, “ellipseMode”, and “ellipse_mode”.
Last edited by jashkenas, 3 months ago
Versions:
