Difference between revisions of "Turtle spiral"

From JSXGraph Wiki
Jump to: navigation, search
 
Line 28: Line 28:
  
 
===Source code===
 
===Source code===
<source lang="html4strict">
+
<source lang="javascript">
<jsxgraph width="600" height="600">
 
 
var brd = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-300, 300, 300, -300]});
 
var brd = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-300, 300, 300, -300]});
 
var t = brd.create('turtle');
 
var t = brd.create('turtle');
Line 44: Line 43:
 
}
 
}
 
run();
 
run();
</jsxgraph>
 
 
</source>
 
</source>
  

Latest revision as of 09:41, 9 June 2011


Source code

var brd = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-300, 300, 300, -300]});
var t = brd.create('turtle');

function run() {
  brd.suspendUpdate();
  var code = document.getElementById('inputtext').value;
  if (code=='') { return; }
  eval(code);
  brd.unsuspendUpdate();
}
function clearturtle() {
  t.cs();
}
run();

External links