Skip to content

Sketch Watching and Live Coding

Martin Prout edited this page Jul 28, 2015 · 41 revisions

Automatically Reload your Sketch with rp5 watch

rp5 watch will keep an eye on the source file of your sketch. Whenever you save a change to it, it'll reload your running code, so you can try out your ideas quickly. rp5 watch is the best way to quickly prototype a sketch.

Live Coding

Ruby-Processing is a playground for live coding. Sketches can be loaded into an interactive code session (pry) using rp5 live. Once your sketch is running, the full powers of Ruby metaprogramming are there for you to use. Methods and classes can be redefined on the fly, arguments passed, values changed and all that.

>> rp5 live samples/jwishy.rb
[1] pry(#<Sketch>)> def bluish    
[2] pry(#<Sketch>)> Math.sin(@y_wiggle)
[3] pry(#<Sketch>)> end 

This opens up the WishyWorm example in a window, and redefines the bluish method to return a function of the y_wiggle. The blue begins to pulse.

jwishy pic

Clone this wiki locally