<iframe src="https://jsxgraph.uni-bayreuth.de/share/iframe/turtle-spiral" style="border: 1px solid black; overflow: hidden; width: 550px; aspect-ratio: 55 / 65;" name="JSXGraph example: Turtle spiral" allowfullscreen ></iframe>
<textarea id="inputtext" rows=5 cols=35 wrap="off" style="width:600px;">for (var i=0;i<100;i++){ t.forward(i*3); t.left(71); } </textarea> <input type="button" value="run" onClick="run()"> <input type="button" value="clear" onClick="clearturtle()"> <div id="board-0-wrapper" class="jxgbox-wrapper " style="width: 100%; "> <div id="board-0" class="jxgbox" style="aspect-ratio: 1 / 1; width: 100%;" data-ar="1 / 1"></div> </div> <script type = "text/javascript"> /* This example is licensed under a Creative Commons Attribution ShareAlike 4.0 International License. https://creativecommons.org/licenses/by-sa/4.0/ Please note you have to mention The Center of Mobile Learning with Digital Technology in the credits. */ const BOARDID = 'board-0'; var board = JXG.JSXGraph.initBoard(BOARDID, { boundingbox: [-300, 300, 300, -300], keepaspectratio: true }); var t = board.create('turtle'); function run() { board.suspendUpdate(); var code = document.getElementById('inputtext').value; if (code == '') { return; } eval(code); board.unsuspendUpdate(); } function clearturtle() { t.cs(); } run(); </script>
/* This example is licensed under a Creative Commons Attribution ShareAlike 4.0 International License. https://creativecommons.org/licenses/by-sa/4.0/ Please note you have to mention The Center of Mobile Learning with Digital Technology in the credits. */ const BOARDID = 'your_div_id'; // Insert your id here! var board = JXG.JSXGraph.initBoard(BOARDID, { boundingbox: [-300, 300, 300, -300], keepaspectratio: true }); var t = board.create('turtle'); function run() { board.suspendUpdate(); var code = document.getElementById('inputtext').value; if (code == '') { return; } eval(code); board.unsuspendUpdate(); } function clearturtle() { t.cs(); } run();
<textarea id="inputtext" rows=5 cols=35 wrap="off" style="width:600px;">for (var i=0;i<100;i++){ t.forward(i*3); t.left(71); } </textarea> <input type="button" value="run" onClick="run()"> <input type="button" value="clear" onClick="clearturtle()">
// Define the id of your board in BOARDID var board = JXG.JSXGraph.initBoard(BOARDID, { boundingbox: [-300, 300, 300, -300], keepaspectratio: true }); var t = board.create('turtle'); function run() { board.suspendUpdate(); var code = document.getElementById('inputtext').value; if (code == '') { return; } eval(code); board.unsuspendUpdate(); } function clearturtle() { t.cs(); } run();
This example is licensed under a Creative Commons Attribution ShareAlike 4.0 International License. Please note you have to mention The Center of Mobile Learning with Digital Technology in the credits.