Experiments with ruby-processing (processing-2.2.1) and JRubyArt for processing-3.0

Thursday, 5 November 2009

Lévy curve implemented in ruby-processing context free DSL

NB I modified the context_free.rb to accept :alpha to get this script to work properly, these mods are now included in ruby-processing (since 8th Nov 2009).

# levy.rb ruby-processing NB: :alpha is now implemented ruby-processing
load_library 'context_free'

def setup_the_levy
  @levy = ContextFree.define do
    rule :start do
      levy :brightness => 0.9
    rule :levy do
      square :alpha => 0.1
      split do
        levy  :size => 1/Math.sqrt(2), :rotation => -45, :x => 0.5, :brightness => 0.9
        levy  :size => 1/Math.sqrt(2), :rotation => 45, :x => 0.5, :brightness => 0.9

def setup
  size 400, 400

def draw
  # Do nothing.

def draw_it
  background 255
  @levy.render :start, :size => 250,  :stop_size => 2,
        :start_x => width/4, :start_y => height/2


No comments:

Post a Comment


Blog Archive

About Me

My photo
I have developed JRubyArt and propane new versions of ruby-processing for JRuby- and processing-3.2.2