This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
Home
context_free
… is a library for Ruby-Processing that allows you to draw context-free sketches using a small declarative DSL. You can define rules which call one another probabilistically. The following block of code is the complete definition for drawing a fractal fern [samples/fern.rb] :
@fern = ContextFree.define do
rule :start do
fern :rotation => 50, :hue => 0.8
end
rule :fern do
circle :size => 0.75, :rotation => -10
split do
fern :size => 0.92, :y => -2, :rotation => -5, :hue => 0.85
rewind
fern :size => 0.5, :y => -2, :rotation => 90
rewind
fern :size => 0.5, :y => -2, :rotation => -90
end
end
end
With a little processing glue, produces:

There are several other samples — tree.rb, city.rb, and vine.rb — if you have one to contribute, please do.










