Permalink
Browse files

adding a todo list and a fern example

  • Loading branch information...
1 parent 9f822bd commit 06e1d62ca67ea5041567e1300d62ce3dd10537c5 @jashkenas committed Jun 1, 2009
Showing with 77 additions and 2 deletions.
  1. +25 −1 README
  2. +50 −0 samples/fern.rb
  3. +2 −1 samples/tree.rb
View
@@ -7,4 +7,28 @@
/ | \ |
S '+' S 'a'
| |
- '1' '1'
+ '1' '1'
+
+
+CONTEXT_FREE:
+A library for context free art in Ruby-Processing.
+
+
+RECOMMENDED READING:
+contextfreeart.org
+wikipedia.org/wiki/Chomsky_hierarchy
+wikipedia.org/wiki/L-system
+
+
+HOW TO:
+For now, check out the samples.
+
+TO DO:
+* Make the drawings run in a separate thread so you can watch 'em go.
+* Determine if we can run the rules iteratively without needing to parse them.
+* Settle on a more compact vocabulary of options (although not as cryptic
+ as ContextFree.app's).
+* Comment the examples with helpful pointers.
+* Write a real README.
+* Stick up a GitHub wiki that's just a page full of images of all the examples.
+* Try some neat integrations of context_free + control_panel.
View
@@ -0,0 +1,50 @@
+load_library 'context_free'
+
+def setup_the_fern
+
+ @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
+end
+
+
+def setup
+ size 600, 600
+ setup_the_fern
+ no_stroke
+ color_mode HSB, 1.0
+ smooth
+ draw_it
+end
+
+
+def draw
+ # Do nothing.
+end
+
+
+def draw_it
+ background 0.33, 0.25, 0.2
+ @fern.render :start, :size => height/23, :color => [0.35, 0.4, 0.9, 0.55], :stop_size => 1,
+ :start_x => width/2.5, :start_y => height/1.285
+end
+
+
+def mouse_clicked
+ draw_it
+end
View
@@ -85,7 +85,8 @@ def draw_the_background
def draw_it
Kernel::srand(@srand) if @srand
draw_the_background
- @tree.render :seed, :start_x => width/2, :start_y => height+20, :size => height/60, :color => [0.7, 0.15, 0.8]
+ @tree.render :seed, :start_x => width/2, :start_y => height+20,
+ :size => height/60, :color => [0.7, 0.15, 0.8]
end
def mouse_clicked

0 comments on commit 06e1d62

Please sign in to comment.