Turtle spiral: Difference between revisions

From JSXGraph Wiki
No edit summary
Line 7: Line 7:
<input type="button" value="run" onClick="run()">
<input type="button" value="run" onClick="run()">
<input type="button" value="clear" onClick="clearturtle()">
<input type="button" value="clear" onClick="clearturtle()">
<input type="button" value="clear log" onClick="clearlog()">
</form>
</form>
</html>
</html>

Revision as of 07:45, 27 March 2009


Source code

<jsxgraph width="600" height="600">
var brd = JXG.JSXGraph.initBoard('jxgbox', {originX: 300, originY: 300, unitX: 1, unitY: 1});
var t = brd.createElement('turtle');

function run() {
  brd.suspendUpdate();
  var code = $('inputtext').value;
  if (code=='') { return; }
  eval(code);
  brd.unsuspendUpdate();
}
function clearturtle() {
  t.cs();
}
</jsxgraph>

External links