\n c1:<\/label>\n \n f1:<\/label>\n \n c2:<\/label>\n \n f2:<\/label>\n \n <\/p>\n","post":"Dump as SVG image<\/button>\n<\/textarea>\n","numboards":1,"description":"","dimensions":[{"width":"100%","height":"","aspect-ratio":"1 \/ 1"}],"wider":0,"license":{"id":1,"identifier":"CC BY 4.0","title":"Creative Commons Attribution 4.0 International","free":"- Share\r\n- Adapt","restrictions":"- Attribution\r\n- No additional restrictions","with_attribution":1,"link":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/","image":"https:\/\/i.creativecommons.org\/l\/by\/4.0\/88x31.png","rank":0},"timestamp":"2023-02-14 15:24:55","visible":1,"tags":[{"id":100,"alias":"applications","name":"Applications"},{"id":113,"alias":"curves","name":"Curves"}],"tag_ids":[100,113],"refers_to":[{"id":10041,"alias":"epicycloid-circles-rotating-on-circles","name":"Epicycloid: circles rotating on circles","symmetrical":1},{"id":10042,"alias":"epicycloid-circles-rotating-on-circles-in-opposite-direction","name":"Epicycloid: circles rotating on circles in opposite direction","symmetrical":1}],"refers_to_ids":[10041,10042],"authors":[],"authors_ids":[],"unique_ids":["jxgbox-6767696206b2a"],"code_display":"\/\/ Define the id of your board in BOARDID\n\nconst board = JXG.JSXGraph.initBoard(BOARDID, {\n boundingbox: [-2.5, 2.5, 2.5, -2.5],\n keepaspectratio: true\n});\nvar c1 = 0.6;\nvar c2 = 0.0;\nvar f1 = 7;\nvar f2 = 17;\n\nvar cb = board.create('curve', [\n (t) => Math.cos(t) + c1 * Math.cos(f1 * t) + c2 * Math.cos(f2 * t),\n (t) => Math.sin(t) + c1 * Math.sin(f1 * t) + c2 * Math.sin(f2 * t),\n 0, 2.02 * Math.PI\n], {strokeWidth:4, strokeColor: 'blue', shadow: true});\n\nvar cw = board.create('curve', [\n (t) => Math.cos(t) + c1 * Math.cos(f1 * t) + c2 * Math.cos(f2 * t),\n (t) => Math.sin(t) + c1 * Math.sin(f1 * t) + c2 * Math.sin(f2 * t),\n 0, 2.02 * Math.PI\n], {strokeWidth: 2, strokeColor: 'white'});\n\n\/\/ Export to SVG\nvar toSVG = function(board) {\n var svgRoot = board.renderer.svgRoot, \n svg;\n \n svgRoot.setAttribute(\"xmlns\", \"http:\/\/www.w3.org\/2000\/svg\");\n svgRoot.setAttribute(\"width\", board.canvasWidth);\n svgRoot.setAttribute(\"height\", board.canvasHeight);\n svg = new XMLSerializer().serializeToString(svgRoot);\n document.getElementById('svgout').value = svg.replace(\/>\/g, '>\\n');\n}\n","code_execute_html":"<\/div>\n Share Epicycloid: export SVG Show plain example JSFiddle Link QR code Copy QR Download QR iFrame <iframe src="https://jsxgraph.org/share/iframe/epicycloid-export-svg" style="border: 1px solid black; overflow: hidden; width: 550px; aspect-ratio: 55 / 65;" name="JSXGraph example: Epicycloid: export SVG" allowfullscreen ></iframe> <iframe src="https://jsxgraph.org/share/iframe/epicycloid-export-svg" style="border: 1px solid black; overflow: hidden; width: 550px; aspect-ratio: 55 / 65;" name="JSXGraph example: Epicycloid: export SVG" allowfullscreen ></iframe> This code has to HTML <p> <label for="c1">c1:</label> <input type="range" id="c1" style="border:0; color:#f6931f; font-weight:bold;" min="0" max="100" value="60" oninput="c1 = this.value*0.01; board.update();" /><br /> <label for="f1">f1:</label> <input type="range" id="f1" style="border:0; color:#f6931f; font-weight:bold;" min="1" max="100" value="7" oninput="f1 = this.value; board.update();" /><br /> <label for="c2">c2:</label> <input type="range" id="c2" style="border:0; color:#f6931f; font-weight:bold;" min="0" max="100" value="0" oninput="c2 = this.value*0.01; board.updateQuality = board.BOARD_QUALITY_HIGH; board.update();" /><br /> <label for="f2">f2:</label> <input type="range" id="f2" style="border:0; color:#f6931f; font-weight:bold;" min="1" max="100" value="17" oninput="f2 = this.value; board.update();" /> </p> <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> <button onclick="toSVG(board);">Dump as SVG image</button><br> <textarea id="svgout" cols=70 rows=20></textarea> <script type = "text/javascript"> /* This example is licensed under a Creative Commons Attribution 4.0 International License. https://creativecommons.org/licenses/by/4.0/ Please note you have to mention The Center of Mobile Learning with Digital Technology in the credits. */ const BOARDID = 'board-0'; const board = JXG.JSXGraph.initBoard(BOARDID, { boundingbox: [-2.5, 2.5, 2.5, -2.5], keepaspectratio: true }); var c1 = 0.6; var c2 = 0.0; var f1 = 7; var f2 = 17; var cb = board.create('curve', [ (t) => Math.cos(t) + c1 * Math.cos(f1 * t) + c2 * Math.cos(f2 * t), (t) => Math.sin(t) + c1 * Math.sin(f1 * t) + c2 * Math.sin(f2 * t), 0, 2.02 * Math.PI ], {strokeWidth:4, strokeColor: 'blue', shadow: true}); var cw = board.create('curve', [ (t) => Math.cos(t) + c1 * Math.cos(f1 * t) + c2 * Math.cos(f2 * t), (t) => Math.sin(t) + c1 * Math.sin(f1 * t) + c2 * Math.sin(f2 * t), 0, 2.02 * Math.PI ], {strokeWidth: 2, strokeColor: 'white'}); // Export to SVG var toSVG = function(board) { var svgRoot = board.renderer.svgRoot, svg; svgRoot.setAttribute("xmlns", "http://www.w3.org/2000/svg"); svgRoot.setAttribute("width", board.canvasWidth); svgRoot.setAttribute("height", board.canvasHeight); svg = new XMLSerializer().serializeToString(svgRoot); document.getElementById('svgout').value = svg.replace(/>/g, '>\n'); } </script> <p> <label for="c1">c1:</label> <input type="range" id="c1" style="border:0; color:#f6931f; font-weight:bold;" min="0" max="100" value="60" oninput="c1 = this.value*0.01; board.update();" /><br /> <label for="f1">f1:</label> <input type="range" id="f1" style="border:0; color:#f6931f; font-weight:bold;" min="1" max="100" value="7" oninput="f1 = this.value; board.update();" /><br /> <label for="c2">c2:</label> <input type="range" id="c2" style="border:0; color:#f6931f; font-weight:bold;" min="0" max="100" value="0" oninput="c2 = this.value*0.01; board.updateQuality = board.BOARD_QUALITY_HIGH; board.update();" /><br /> <label for="f2">f2:</label> <input type="range" id="f2" style="border:0; color:#f6931f; font-weight:bold;" min="1" max="100" value="17" oninput="f2 = this.value; board.update();" /> </p> <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> <button onclick="toSVG(board);">Dump as SVG image</button><br> <textarea id="svgout" cols=70 rows=20></textarea> <script type = "text/javascript"> /* This example is licensed under a Creative Commons Attribution 4.0 International License. https://creativecommons.org/licenses/by/4.0/ Please note you have to mention The Center of Mobile Learning with Digital Technology in the credits. */ const BOARDID = 'board-0'; const board = JXG.JSXGraph.initBoard(BOARDID, { boundingbox: [-2.5, 2.5, 2.5, -2.5], keepaspectratio: true }); var c1 = 0.6; var c2 = 0.0; var f1 = 7; var f2 = 17; var cb = board.create('curve', [ (t) => Math.cos(t) + c1 * Math.cos(f1 * t) + c2 * Math.cos(f2 * t), (t) => Math.sin(t) + c1 * Math.sin(f1 * t) + c2 * Math.sin(f2 * t), 0, 2.02 * Math.PI ], {strokeWidth:4, strokeColor: 'blue', shadow: true}); var cw = board.create('curve', [ (t) => Math.cos(t) + c1 * Math.cos(f1 * t) + c2 * Math.cos(f2 * t), (t) => Math.sin(t) + c1 * Math.sin(f1 * t) + c2 * Math.sin(f2 * t), 0, 2.02 * Math.PI ], {strokeWidth: 2, strokeColor: 'white'}); // Export to SVG var toSVG = function(board) { var svgRoot = board.renderer.svgRoot, svg; svgRoot.setAttribute("xmlns", "http://www.w3.org/2000/svg"); svgRoot.setAttribute("width", board.canvasWidth); svgRoot.setAttribute("height", board.canvasHeight); svg = new XMLSerializer().serializeToString(svgRoot); document.getElementById('svgout').value = svg.replace(/>/g, '>\n'); } </script> JavaScript /* This example is licensed under a Creative Commons Attribution 4.0 International License. https://creativecommons.org/licenses/by/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! const board = JXG.JSXGraph.initBoard(BOARDID, { boundingbox: [-2.5, 2.5, 2.5, -2.5], keepaspectratio: true }); var c1 = 0.6; var c2 = 0.0; var f1 = 7; var f2 = 17; var cb = board.create('curve', [ (t) => Math.cos(t) + c1 * Math.cos(f1 * t) + c2 * Math.cos(f2 * t), (t) => Math.sin(t) + c1 * Math.sin(f1 * t) + c2 * Math.sin(f2 * t), 0, 2.02 * Math.PI ], {strokeWidth:4, strokeColor: 'blue', shadow: true}); var cw = board.create('curve', [ (t) => Math.cos(t) + c1 * Math.cos(f1 * t) + c2 * Math.cos(f2 * t), (t) => Math.sin(t) + c1 * Math.sin(f1 * t) + c2 * Math.sin(f2 * t), 0, 2.02 * Math.PI ], {strokeWidth: 2, strokeColor: 'white'}); // Export to SVG var toSVG = function(board) { var svgRoot = board.renderer.svgRoot, svg; svgRoot.setAttribute("xmlns", "http://www.w3.org/2000/svg"); svgRoot.setAttribute("width", board.canvasWidth); svgRoot.setAttribute("height", board.canvasHeight); svg = new XMLSerializer().serializeToString(svgRoot); document.getElementById('svgout').value = svg.replace(/>/g, '>\n'); } /* This example is licensed under a Creative Commons Attribution 4.0 International License. https://creativecommons.org/licenses/by/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! const board = JXG.JSXGraph.initBoard(BOARDID, { boundingbox: [-2.5, 2.5, 2.5, -2.5], keepaspectratio: true }); var c1 = 0.6; var c2 = 0.0; var f1 = 7; var f2 = 17; var cb = board.create('curve', [ (t) => Math.cos(t) + c1 * Math.cos(f1 * t) + c2 * Math.cos(f2 * t), (t) => Math.sin(t) + c1 * Math.sin(f1 * t) + c2 * Math.sin(f2 * t), 0, 2.02 * Math.PI ], {strokeWidth:4, strokeColor: 'blue', shadow: true}); var cw = board.create('curve', [ (t) => Math.cos(t) + c1 * Math.cos(f1 * t) + c2 * Math.cos(f2 * t), (t) => Math.sin(t) + c1 * Math.sin(f1 * t) + c2 * Math.sin(f2 * t), 0, 2.02 * Math.PI ], {strokeWidth: 2, strokeColor: 'white'}); // Export to SVG var toSVG = function(board) { var svgRoot = board.renderer.svgRoot, svg; svgRoot.setAttribute("xmlns", "http://www.w3.org/2000/svg"); svgRoot.setAttribute("width", board.canvasWidth); svgRoot.setAttribute("height", board.canvasHeight); svg = new XMLSerializer().serializeToString(svgRoot); document.getElementById('svgout').value = svg.replace(/>/g, '>\n'); } Download Print Epicycloid: export SVG Applications Curves Have also a look at the examples Epicycloid: circles rotating on circles Epicycloid: circles rotating on circles in opposite direction c1: f1: c2: f2: Dump as SVG image <p> <label for="c1">c1:</label> <input type="range" id="c1" style="border:0; color:#f6931f; font-weight:bold;" min="0" max="100" value="60" oninput="c1 = this.value*0.01; board.update();" /><br /> <label for="f1">f1:</label> <input type="range" id="f1" style="border:0; color:#f6931f; font-weight:bold;" min="1" max="100" value="7" oninput="f1 = this.value; board.update();" /><br /> <label for="c2">c2:</label> <input type="range" id="c2" style="border:0; color:#f6931f; font-weight:bold;" min="0" max="100" value="0" oninput="c2 = this.value*0.01; board.updateQuality = board.BOARD_QUALITY_HIGH; board.update();" /><br /> <label for="f2">f2:</label> <input type="range" id="f2" style="border:0; color:#f6931f; font-weight:bold;" min="1" max="100" value="17" oninput="f2 = this.value; board.update();" /> </p> <p> <label for="c1">c1:</label> <input type="range" id="c1" style="border:0; color:#f6931f; font-weight:bold;" min="0" max="100" value="60" oninput="c1 = this.value*0.01; board.update();" /><br /> <label for="f1">f1:</label> <input type="range" id="f1" style="border:0; color:#f6931f; font-weight:bold;" min="1" max="100" value="7" oninput="f1 = this.value; board.update();" /><br /> <label for="c2">c2:</label> <input type="range" id="c2" style="border:0; color:#f6931f; font-weight:bold;" min="0" max="100" value="0" oninput="c2 = this.value*0.01; board.updateQuality = board.BOARD_QUALITY_HIGH; board.update();" /><br /> <label for="f2">f2:</label> <input type="range" id="f2" style="border:0; color:#f6931f; font-weight:bold;" min="1" max="100" value="17" oninput="f2 = this.value; board.update();" /> </p> // Define the id of your board in BOARDID const board = JXG.JSXGraph.initBoard(BOARDID, { boundingbox: [-2.5, 2.5, 2.5, -2.5], keepaspectratio: true }); var c1 = 0.6; var c2 = 0.0; var f1 = 7; var f2 = 17; var cb = board.create('curve', [ (t) => Math.cos(t) + c1 * Math.cos(f1 * t) + c2 * Math.cos(f2 * t), (t) => Math.sin(t) + c1 * Math.sin(f1 * t) + c2 * Math.sin(f2 * t), 0, 2.02 * Math.PI ], {strokeWidth:4, strokeColor: 'blue', shadow: true}); var cw = board.create('curve', [ (t) => Math.cos(t) + c1 * Math.cos(f1 * t) + c2 * Math.cos(f2 * t), (t) => Math.sin(t) + c1 * Math.sin(f1 * t) + c2 * Math.sin(f2 * t), 0, 2.02 * Math.PI ], {strokeWidth: 2, strokeColor: 'white'}); // Export to SVG var toSVG = function(board) { var svgRoot = board.renderer.svgRoot, svg; svgRoot.setAttribute("xmlns", "http://www.w3.org/2000/svg"); svgRoot.setAttribute("width", board.canvasWidth); svgRoot.setAttribute("height", board.canvasHeight); svg = new XMLSerializer().serializeToString(svgRoot); document.getElementById('svgout').value = svg.replace(/>/g, '>\n'); } // Define the id of your board in BOARDID const board = JXG.JSXGraph.initBoard(BOARDID, { boundingbox: [-2.5, 2.5, 2.5, -2.5], keepaspectratio: true }); var c1 = 0.6; var c2 = 0.0; var f1 = 7; var f2 = 17; var cb = board.create('curve', [ (t) => Math.cos(t) + c1 * Math.cos(f1 * t) + c2 * Math.cos(f2 * t), (t) => Math.sin(t) + c1 * Math.sin(f1 * t) + c2 * Math.sin(f2 * t), 0, 2.02 * Math.PI ], {strokeWidth:4, strokeColor: 'blue', shadow: true}); var cw = board.create('curve', [ (t) => Math.cos(t) + c1 * Math.cos(f1 * t) + c2 * Math.cos(f2 * t), (t) => Math.sin(t) + c1 * Math.sin(f1 * t) + c2 * Math.sin(f2 * t), 0, 2.02 * Math.PI ], {strokeWidth: 2, strokeColor: 'white'}); // Export to SVG var toSVG = function(board) { var svgRoot = board.renderer.svgRoot, svg; svgRoot.setAttribute("xmlns", "http://www.w3.org/2000/svg"); svgRoot.setAttribute("width", board.canvasWidth); svgRoot.setAttribute("height", board.canvasHeight); svg = new XMLSerializer().serializeToString(svgRoot); document.getElementById('svgout').value = svg.replace(/>/g, '>\n'); } <button onclick="toSVG(board);">Dump as SVG image</button><br> <textarea id="svgout" cols=70 rows=20></textarea> <button onclick="toSVG(board);">Dump as SVG image</button><br> <textarea id="svgout" cols=70 rows=20></textarea> This example is licensed under a Creative Commons Attribution 4.0 International License. Please note you have to mention The Center of Mobile Learning with Digital Technology in the credits.
<iframe src="https://jsxgraph.org/share/iframe/epicycloid-export-svg" style="border: 1px solid black; overflow: hidden; width: 550px; aspect-ratio: 55 / 65;" name="JSXGraph example: Epicycloid: export SVG" allowfullscreen ></iframe>
<p> <label for="c1">c1:</label> <input type="range" id="c1" style="border:0; color:#f6931f; font-weight:bold;" min="0" max="100" value="60" oninput="c1 = this.value*0.01; board.update();" /><br /> <label for="f1">f1:</label> <input type="range" id="f1" style="border:0; color:#f6931f; font-weight:bold;" min="1" max="100" value="7" oninput="f1 = this.value; board.update();" /><br /> <label for="c2">c2:</label> <input type="range" id="c2" style="border:0; color:#f6931f; font-weight:bold;" min="0" max="100" value="0" oninput="c2 = this.value*0.01; board.updateQuality = board.BOARD_QUALITY_HIGH; board.update();" /><br /> <label for="f2">f2:</label> <input type="range" id="f2" style="border:0; color:#f6931f; font-weight:bold;" min="1" max="100" value="17" oninput="f2 = this.value; board.update();" /> </p> <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> <button onclick="toSVG(board);">Dump as SVG image</button><br> <textarea id="svgout" cols=70 rows=20></textarea> <script type = "text/javascript"> /* This example is licensed under a Creative Commons Attribution 4.0 International License. https://creativecommons.org/licenses/by/4.0/ Please note you have to mention The Center of Mobile Learning with Digital Technology in the credits. */ const BOARDID = 'board-0'; const board = JXG.JSXGraph.initBoard(BOARDID, { boundingbox: [-2.5, 2.5, 2.5, -2.5], keepaspectratio: true }); var c1 = 0.6; var c2 = 0.0; var f1 = 7; var f2 = 17; var cb = board.create('curve', [ (t) => Math.cos(t) + c1 * Math.cos(f1 * t) + c2 * Math.cos(f2 * t), (t) => Math.sin(t) + c1 * Math.sin(f1 * t) + c2 * Math.sin(f2 * t), 0, 2.02 * Math.PI ], {strokeWidth:4, strokeColor: 'blue', shadow: true}); var cw = board.create('curve', [ (t) => Math.cos(t) + c1 * Math.cos(f1 * t) + c2 * Math.cos(f2 * t), (t) => Math.sin(t) + c1 * Math.sin(f1 * t) + c2 * Math.sin(f2 * t), 0, 2.02 * Math.PI ], {strokeWidth: 2, strokeColor: 'white'}); // Export to SVG var toSVG = function(board) { var svgRoot = board.renderer.svgRoot, svg; svgRoot.setAttribute("xmlns", "http://www.w3.org/2000/svg"); svgRoot.setAttribute("width", board.canvasWidth); svgRoot.setAttribute("height", board.canvasHeight); svg = new XMLSerializer().serializeToString(svgRoot); document.getElementById('svgout').value = svg.replace(/>/g, '>\n'); } </script>
/* This example is licensed under a Creative Commons Attribution 4.0 International License. https://creativecommons.org/licenses/by/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! const board = JXG.JSXGraph.initBoard(BOARDID, { boundingbox: [-2.5, 2.5, 2.5, -2.5], keepaspectratio: true }); var c1 = 0.6; var c2 = 0.0; var f1 = 7; var f2 = 17; var cb = board.create('curve', [ (t) => Math.cos(t) + c1 * Math.cos(f1 * t) + c2 * Math.cos(f2 * t), (t) => Math.sin(t) + c1 * Math.sin(f1 * t) + c2 * Math.sin(f2 * t), 0, 2.02 * Math.PI ], {strokeWidth:4, strokeColor: 'blue', shadow: true}); var cw = board.create('curve', [ (t) => Math.cos(t) + c1 * Math.cos(f1 * t) + c2 * Math.cos(f2 * t), (t) => Math.sin(t) + c1 * Math.sin(f1 * t) + c2 * Math.sin(f2 * t), 0, 2.02 * Math.PI ], {strokeWidth: 2, strokeColor: 'white'}); // Export to SVG var toSVG = function(board) { var svgRoot = board.renderer.svgRoot, svg; svgRoot.setAttribute("xmlns", "http://www.w3.org/2000/svg"); svgRoot.setAttribute("width", board.canvasWidth); svgRoot.setAttribute("height", board.canvasHeight); svg = new XMLSerializer().serializeToString(svgRoot); document.getElementById('svgout').value = svg.replace(/>/g, '>\n'); }
c1: f1: c2: f2:
<p> <label for="c1">c1:</label> <input type="range" id="c1" style="border:0; color:#f6931f; font-weight:bold;" min="0" max="100" value="60" oninput="c1 = this.value*0.01; board.update();" /><br /> <label for="f1">f1:</label> <input type="range" id="f1" style="border:0; color:#f6931f; font-weight:bold;" min="1" max="100" value="7" oninput="f1 = this.value; board.update();" /><br /> <label for="c2">c2:</label> <input type="range" id="c2" style="border:0; color:#f6931f; font-weight:bold;" min="0" max="100" value="0" oninput="c2 = this.value*0.01; board.updateQuality = board.BOARD_QUALITY_HIGH; board.update();" /><br /> <label for="f2">f2:</label> <input type="range" id="f2" style="border:0; color:#f6931f; font-weight:bold;" min="1" max="100" value="17" oninput="f2 = this.value; board.update();" /> </p>
// Define the id of your board in BOARDID const board = JXG.JSXGraph.initBoard(BOARDID, { boundingbox: [-2.5, 2.5, 2.5, -2.5], keepaspectratio: true }); var c1 = 0.6; var c2 = 0.0; var f1 = 7; var f2 = 17; var cb = board.create('curve', [ (t) => Math.cos(t) + c1 * Math.cos(f1 * t) + c2 * Math.cos(f2 * t), (t) => Math.sin(t) + c1 * Math.sin(f1 * t) + c2 * Math.sin(f2 * t), 0, 2.02 * Math.PI ], {strokeWidth:4, strokeColor: 'blue', shadow: true}); var cw = board.create('curve', [ (t) => Math.cos(t) + c1 * Math.cos(f1 * t) + c2 * Math.cos(f2 * t), (t) => Math.sin(t) + c1 * Math.sin(f1 * t) + c2 * Math.sin(f2 * t), 0, 2.02 * Math.PI ], {strokeWidth: 2, strokeColor: 'white'}); // Export to SVG var toSVG = function(board) { var svgRoot = board.renderer.svgRoot, svg; svgRoot.setAttribute("xmlns", "http://www.w3.org/2000/svg"); svgRoot.setAttribute("width", board.canvasWidth); svgRoot.setAttribute("height", board.canvasHeight); svg = new XMLSerializer().serializeToString(svgRoot); document.getElementById('svgout').value = svg.replace(/>/g, '>\n'); }
<button onclick="toSVG(board);">Dump as SVG image</button><br> <textarea id="svgout" cols=70 rows=20></textarea>
This example is licensed under a Creative Commons Attribution 4.0 International License. Please note you have to mention The Center of Mobile Learning with Digital Technology in the credits.