From 236d03825f0760c1b7b84baef5f9dbfcb10bd599 Mon Sep 17 00:00:00 2001 From: Yuval Adam Date: Fri, 18 May 2012 20:52:35 +0300 Subject: removing index.html from master --- index.html | 117 ------------------------------------------------------------- 1 file changed, 117 deletions(-) delete mode 100644 index.html diff --git a/index.html b/index.html deleted file mode 100644 index d0e4189..0000000 --- a/index.html +++ /dev/null @@ -1,117 +0,0 @@ - - - Wishing Tree Playground - - - - - - -

L-Systems.js Playground

-
- - - -- cgit v1.3.1 From 87d7b6eca56cfac6e7d55364a817e7f777c8e3a4 Mon Sep 17 00:00:00 2001 From: Yuval Adam Date: Mon, 21 May 2012 13:40:40 +0300 Subject: API change, all functions now return this, added print() --- lsys.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lsys.js b/lsys.js index b102107..ffa4479 100644 --- a/lsys.js +++ b/lsys.js @@ -9,6 +9,10 @@ function LSystem(axiom, rules) { return rules[c] || c; }); } + return this; + }; + + this.print = function() { return this.tree; }; @@ -125,7 +129,7 @@ function LSystem(axiom, rules) { this.reset = function() { this.tree = axiom; - return this.tree; + return this; }; this.debug = function() { -- cgit v1.3.1 From 007b3be9d09121d9fe0ffb7303bf5438e821fb61 Mon Sep 17 00:00:00 2001 From: Yuval Adam Date: Mon, 21 May 2012 13:41:38 +0300 Subject: updated README with API change --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 44a6749..769289d 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,8 @@ Usage ----- ```js -var lsys = new LSystem('F', { 'F' : 'F-F+FF' }); -var tree = lsys.iterate(2); +var lsys = new LSystem('F', { 'F' : 'F-F+FF' }).iterate(2); +var tree = lsys.print(); console.log(tree); // F-F+FF-F-F+FF+F-F+FFF-F+FF var coords = lsys.draw(Math.PI / 2); // draw tree with alpha as 90 degrees console.log(coords); // [[0,0,0], [0,1,0], [1,1,0], ... -- cgit v1.3.1