diff options
| author | Yuval Adam <yuv.adm@gmail.com> | 2012-05-23 13:26:56 +0300 |
|---|---|---|
| committer | Yuval Adam <yuv.adm@gmail.com> | 2012-05-23 13:26:56 +0300 |
| commit | 70e56aa2b9ce7f4b1a0ec4aedef34fc78573f5c1 (patch) | |
| tree | 3b5f37e6d6065d2de380899d41113cdc3e235881 | |
| parent | de6c00867092f86967660a8d43d230162e87024b (diff) | |
added custom lsys form
| -rw-r--r-- | index.html | 24 |
1 files changed, 20 insertions, 4 deletions
@@ -89,10 +89,12 @@ for (var i=0; i<coords.length; i++) { <div class="span9"> <div id="render-container"></div> <br/> - <form class="well form-inline"> - <input type="text" class="input-small" placeholder="Axiom"> - <input type="text" class="input-small" placeholder="Rules"> - <button type="submit" class="btn">Draw</button> + <form id="custom-form" class="well form-inline"> + <input id="custom-axiom" type="text" class="input-small" placeholder="Axiom"> + <input id="custom-rules" type="text" class="input-large" placeholder="Rules"> + <input id="custom-iterations" type="text" class="input-small" placeholder="Iterations"> + <input id="custom-angle" type="text" class="input-small" placeholder="Angle"> + <button id="custom-draw" type="submit" class="btn">Draw</button> </form> </div> </div> @@ -226,6 +228,20 @@ for (var i=0; i<coords.length; i++) { return false; }); + $('#custom-draw').click(function(e) { + var axiom = $('#custom-axiom').val(); + var rules = eval('(' + $('#custom-rules').val() + ')'); + var iterations = $('#custom-iterations').val(); + var angle = $('#custom-angle').val(); + + if (lsys_tree) { + scene.remove(lsys_tree); + } + var custom_lsys = new LSystem(axiom, rules).iterate(iterations).draw(angle * (Math.PI / 180)); + draw_lsys(custom_lsys); + return false; + }); + </script> </body> </html> |
