Turtle spiral: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 11: Line 11:


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


function run() {
function run() {
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', {originX: 300, originY: 300, unitX: 1, unitY: 1});
var t = brd.create('turtle');
var t = brd.createElement('turtle');


function run() {
function run() {
Line 44: Line 43:
}
}
run();
run();
</jsxgraph>
</source>
</source>



Latest revision as of 07: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