Here's another ruby-processing context-free DSL example:-
# tunnel.rb ruby-processing
load_library 'context_free'
def setup_the_tunnel
@tunnel = ContextFree.define do
rule :start do
body :brightness => 1.0
end
rule :body do
square :brightness => 0.6
square :size => 0.996, :brightness => 0.3
body :size => 0.994, :rotation => 0.12
end
end
end
def setup
size 500, 500
setup_the_tunnel
color_mode HSB, 360, 1, 1
smooth
draw_it
save_frame("tunnel.png")
end
def draw
# Do nothing.
end
def draw_it
background 0
@tunnel.render :start, :size => height, :stop_size => 2,
:start_x => width/2, :start_y => height/2
end
Experiments with ruby-processing (processing-2.2.1) and JRubyArt for processing-3.0
Wednesday, 23 September 2009
Subscribe to:
Post Comments (Atom)
Followers
Blog Archive
-
▼
2009
(50)
-
▼
September
(9)
- Real Menger Sponge in Ruby Processing
- A Simple Rotating Cube using PVector and splat
- Tunnel a popular theme in context free
- Fake Menger Sponge
- Using Multidimensional Data Arrays
- Another of Lazydogs Little Gems translated to ruby...
- A More Complicated Sierpinski
- An Advanced Pretzel
- Non cfdg DSL Sierpinski triangle using ruby proces...
-
▼
September
(9)
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