Difference between revisions of "Template:Jscad"
Jump to navigation
Jump to search
Line 59: | Line 59: | ||
<h1>{{{title|}}}</h1> | <h1>{{{title|}}}</h1> | ||
<div id="jscadviewer"></div> | <div id="jscadviewer"></div> | ||
− | + | <h2>Playground</h2> | |
+ | You can try out modifications of the source code right here. | ||
+ | <textarea id='jscadcode' style="height: 500px">{{{code|}}}</textarea> | ||
+ | <input type="submit" value="Update" onclick="updateSolid(); return false;"> | ||
+ | <script> | ||
+ | // call javascript in middle of page | ||
+ | // https://stackoverflow.com/a/19869671/1497139 | ||
+ | renderJscad(); | ||
+ | </script> | ||
+ | }} | ||
= Source code = | = Source code = | ||
{{#tag:source|{{{code|}}}|lang=javascript}} | {{#tag:source|{{{code|}}}|lang=javascript}} | ||
[[Category:OpenJSCAD]] | [[Category:OpenJSCAD]] | ||
</includeonly> | </includeonly> |
Revision as of 15:29, 16 June 2019
Usage
{{jscad|title=OpenJSCAD example|code=function main() { return CSG.cube(); } }}
Example
OpenJSCAD example
Playground
You can try out modifications of the source code right here.
Source code
function main() {
return CSG.cube();
}