Turtle spiral: Difference between revisions

From JSXGraph Wiki
No edit summary
Line 1: Line 1:
<html>
<html>
<form><textarea id="inputtext" rows=5 cols=35 wrap="off" style="width:600px;">for (var i=0;i<1000;i++){
<form><textarea id="inputtext" rows=5 cols=35 wrap="off" style="width:600px;">for (var i=0;i<100;i++){
  t.forward(i*0.5);
  t.forward(i*0.5);
  t.left(71);
  t.left(71);

Revision as of 18:42, 28 April 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();
}
run();
</jsxgraph>

External links