Here is my first go at writing context free rules in ruby (uses a library to support the DSL).
# shell_spiral.rb ruby-processing
load_library 'context_free'
def setup_the_shell
@shell = ContextFree.define do
rule :start do
shell_spiral :rotation => PI, :hue => 41.1,
:sat => 0.573, :brightness => 0.9238, :alpha => 0.5
end
rule :shell_spiral do
circle
shell_spiral :rotation => -0.50, :x => 0.25,
:size => 0.9985
end
end
end
def setup
size 1000, 1000
setup_the_shell
no_stroke
color_mode HSB, 1.0
smooth
draw_it
end
def draw
# Do nothing.
end
def draw_it
background -1.0
@shell.render :start, :size => height/50, :stop_size => 1,
:start_x => width/3, :start_y => height * 0.9
end
def mouse_clicked
draw_it
end
Experiments with ruby-processing (processing-2.2.1) and JRubyArt for processing-3.0
Monday, 17 August 2009
Subscribe to:
Post Comments (Atom)
Followers
Blog Archive
-
▼
2009
(50)
-
▼
August
(8)
- Adjusting your context free DSL variables
- Sierpinski triangle ruby processing (context free ...
- Understanding terminal shapes Context Free
- Triangle now included in Ruby Processing cfdg DSL
- Introducing weighted rules (and randomness)
- Rewind in Ruby Processing cfdg DSL
- Context Free Ruby Processing DSL
- Recursive call with probabalistic endpoint
-
▼
August
(8)
About Me
- monkstone
- I have developed JRubyArt and propane new versions of ruby-processing for JRuby-9.1.5.0 and processing-3.2.2
No comments:
Post a Comment