Interactive JessieScript: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
 
(17 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<jsxgraph width="600" height="450" box="box">
<jsxgraph width="600" height="450" box="box" modules="JessieScript">
var board, construction = [];
var board, construction = [];
board = JXG.JSXGraph.initBoard('box', {grid:true, boundingbox:[-1,6,11,-3], keepaspectratio:true, axis:true});
board = JXG.JSXGraph.initBoard('box', {grid:false, boundingbox:[-1,6,11,-3], keepaspectratio:true, axis:true});


function construct() {
function construct() {
Line 11: Line 11:
function clearAll() {
function clearAll() {
     JXG.JSXGraph.freeBoard(board);
     JXG.JSXGraph.freeBoard(board);
     board = JXG.JSXGraph.initBoard('box', {boundingbox:[-5,8,8,-5], axis:true});
     board = JXG.JSXGraph.initBoard('box', {grid:true, boundingbox:[-1,6,11,-3], keepaspectratio:true, axis:true});
}
}
</jsxgraph>
</jsxgraph>


Line 27: Line 26:
</html>
</html>


===Possible elements:===
===Available commands===
{| cellpadding="8" cellspacing="0" border="1"
See our [http://jsxgraph.org/distrib/jessiescript_ref_en.pdf documentation page] for a list of commands.
! Construction !! Description
 
|-
==The JavaScript code==
| A(1,1)    || Point with name 'A' at position (1,1)
JessieScript is not longer actively delevoped. Instead, the focus is on the programming language
|-
[https://github.com/jsxgraph/JessieCode JessieCode].
| ZY(0.5<nowiki>|</nowiki>1)    || Point with name 'ZY' at position (0.5,1)
As a consequence, JessieScript is not contained in jsxgraphcore.js anymore. If you want to use JessieScript, you have to load the file jessiescript.js from the JSXGraph sources or the file
|-
https://jsxgraph.org/distrib/JessieScript.js after loading jsxgraphcore.js
| ]AB[    || straight line through points A and B
|-
| [AB[    || ray through points A and B, stopping at A
|-
| ]AB]    || ray through points A and B, stopping at B
|-
| [AB]    || segment through points A and B
|-
| g=[AB]    || segment through points A and B, named by 'g'
|-
| k(A,1)    || circle with midpoint A and radius 1
|-
| k(A,B)    || circle with midpoint A through point B on the circle line
|-
| k(A,[BC])    || circle with midpoint A and radius defined by the length of the (not necessarily existing) segement [BC]
|-
| k_1=k(A,1)    || circle with midpoint A and radius 1, named by 'k_1'
|}
The different elements have to be separated by semicolon.


===The JavaScript code===
<source lang="javascript">
<source lang="javascript">
var board, construction = [];
var board, construction = [];
Line 65: Line 44:
     construction.push(board.construct(t));
     construction.push(board.construct(t));
     board.unsuspendUpdate();
     board.unsuspendUpdate();
}
function clearAll() {
    JXG.JSXGraph.freeBoard(board);
    board = JXG.JSXGraph.initBoard('box', {grid:true, boundingbox:[-1,6,11,-3], keepaspectratio:true, axis:true});
}
}
</source>
</source>

Latest revision as of 13:57, 4 January 2021



Available commands

See our documentation page for a list of commands.

The JavaScript code

JessieScript is not longer actively delevoped. Instead, the focus is on the programming language JessieCode. As a consequence, JessieScript is not contained in jsxgraphcore.js anymore. If you want to use JessieScript, you have to load the file jessiescript.js from the JSXGraph sources or the file https://jsxgraph.org/distrib/JessieScript.js after loading jsxgraphcore.js

var board, construction = [];
board = JXG.JSXGraph.initBoard('box', {grid:true, boundingbox:[-1,6,11,-3], keepaspectratio:true, axis:true});

function construct() {
    var t = document.getElementById('input').value;
    board.suspendUpdate();
    construction.push(board.construct(t));
    board.unsuspendUpdate();
}

function clearAll() {
    JXG.JSXGraph.freeBoard(board);
    board = JXG.JSXGraph.initBoard('box', {grid:true, boundingbox:[-1,6,11,-3], keepaspectratio:true, axis:true});
}