Slow the turtle down

From JSXGraph Wiki
Revision as of 16:18, 25 February 2009 by A WASSERMANN (talk | contribs)
Jump to navigationJump to search

This is an example, where the turtle runs controlled by the setTimeout() method of JavaScript.

<form><input type="button" value="run" onclick="run(100)"></form>
<jsxgraph width="500" height="500">
var brd = JXG.JSXGraph.initBoard('jxgbox',{unitX:1, unitY:1, originX:250, originY:250});
var t = brd.createElement('turtle');

function run(n) {
   if (n>0) {
     var st = 'run(' + (n-1) + ')';