Slow the turtle down: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
<html> | |||
<form><input type="button" value="run" onclick="run(10)"></form> | |||
</html> | |||
<jsxgraph width="500" height="500"> | <jsxgraph width="500" height="500"> | ||
var brd = JXG.JSXGraph.initBoard('jxgbox',{unitX:1, unitY:1, originX:250, originY:250}); | var brd = JXG.JSXGraph.initBoard('jxgbox',{unitX:1, unitY:1, originX:250, originY:250}); | ||
var t = brd.createElement('turtle'); | var t = brd.createElement('turtle'); | ||
function run(n) { | |||
if (n>=0) { | |||
t.fd(20); | |||
t.lt(12); | |||
run(n-1); | |||
} | |||
} | |||
</jsxgraph> | </jsxgraph> | ||
[[Category:Examples]] | [[Category:Examples]] | ||
[[Category:Turtle Graphics]] | [[Category:Turtle Graphics]] |
Revision as of 14:13, 25 February 2009