Turtle spiral: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
<html> | <html> | ||
<form><textarea id="inputtext" rows=5 cols=35 wrap="off" style="width:600px;"> | <form><textarea id="inputtext" rows=5 cols=35 wrap="off" style="width:600px;">for (var i=0;i<200;i++){ | ||
for (var i=0;i<200;i++){ | |||
t.forward(i*0.5); | t.forward(i*0.5); | ||
t.left(30); | t.left(30); | ||
Line 30: | Line 29: | ||
===Source code=== | ===Source code=== | ||
<source lang="html4strict"> | <source lang="html4strict"> | ||
< | <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> | |||
</source> | </source> | ||
Revision as of 16:38, 25 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>
- Hints how to "Slow the turtle down"