October 15, 2011

Turtle Graphics Fern with jQuery

Here is another classic turtle graphics example:

<script src="/lib/jq.js"></script> <style>b { display: inline-block; }</style> <b id="t">t</b> <script> t = $('#t'); t.moveto(300, 300).pen('green'); function fern(size) { if (size < 1) return; t.todo(function() { t.move(size).turn(5); fern(size * .9); t.turn(90); fern(size * .4); t.turn(-180); fern(size * .4); }); } fern(50); </script>

Click here to see a demo.

Posted by David at October 15, 2011 10:03 AM

Comments

Nice!

Posted by: Jesus Zazueta at May 12, 2012 05:12 PM
Post a comment









Remember personal info?