# flower.rb ruby-processing
load_library 'context_free'
ROT = 180*(Math.sqrt(5) - 1)
def setup_the_flower
@flower = ContextFree.define do
@rot = 0
@pet = 0
rule :start do
flower :brightness => 1.0
end
rule :flower do
@rot += ROT
@rot = @rot % 360
split do
petal :brightness => 1.0, :saturation => 0.5
rewind
flower :rotation => @rot, :size => 0.99, :hue => 0.15
rewind
end
end
rule :petal do
@pet += 15
split do
triangle :x => 4.1, :rotation => @pet
rewind
petal :size => 0.995, :alpha => 0.4, :brightness => 0.5
#rewind
end
end
end
end
def setup
size 800, 800
setup_the_flower
smooth
draw_it
save_frame("flower.png")
end
def draw
# Do nothing.
end
def draw_it
background 60, 0, 0
@flower.render :start, :size => width*0.8, :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
Tuesday, 10 November 2009
Subscribe to:
Post Comments (Atom)
Followers
Blog Archive
-
▼
2009
(50)
-
▼
November
(18)
- Koch curve using l-systems
- Towards a forest, or too many matrix calls
- Seaweed using Lindenmayer system on ruby processing
- A basic example of a plant Lindenmayer systems in...
- Pentagonal Fractal
- Minkowski island using L-System in ruby processing
- Sierpinski Fractal Implemented in ruby-processing ...
- Snake Kolam Ruby Processing
- Penrose Snowflake L-Systems using ruby-processing
- Dragon Fractal Using L-Systems and ruby-processing
- Koch Island Using Lindemayer System in Ruby Proces...
- Lindenmayer system in ruby-processing
- Tessellated "curvy" triangles in ruby-processing
- Dynamic rand with ruby-processing context-free DSL
- Flower in ruby-processing DSL
- Heighway Dragon in ruby-processing context free DSL
- Lévy curve implemented in ruby-processing context ...
- jEdit as a cross platform GUI?
-
▼
November
(18)
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