L-systems: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 4: Line 4:
<script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraphcore.js"></script>
<script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraphcore.js"></script>
<script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/jsxturtle.js"></script>
<script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/jsxturtle.js"></script>
<form><textarea id="inputtext" rows=3 cols=35 wrap="off" style="width:600px;">
<form><textarea id="inputtext1" rows=3 cols=35 wrap="off" style="width:600px;">
var level = 6;
var level = 6;
var axiom = 'A';
var axiom = 'A';
Line 25: Line 25:
t.rt(90*Math.pow(-1,level));
t.rt(90*Math.pow(-1,level));
</textarea><br />
</textarea><br />
<input type="button" value="run" onClick="run()">
<input type="button" value="run" onClick="run(1)">
<input type="button" value="clear" onClick="clearturtle()">
<input type="button" value="clear" onClick="clearturtle()">
</form>
</form>
Line 91: Line 91:
   }
   }


function run() {
function run(nr) {
   brd.suspendUpdate();
   brd.suspendUpdate();
   var code = $('inputtext').value;
   var code = $('inputtext'+nr).value;
   if (code=='') { return; }
   if (code=='') { return; }
   t.cs();
   t.cs();

Revision as of 19:28, 30 December 2008