-
Notifications
You must be signed in to change notification settings - Fork 3
Moving objects by scripts
Aaron Amran edited this page Jul 24, 2023
·
63 revisions
Interactivity legend:
- "Switch": object can be activated or deactivated by double-click.
- "Move": object or it's control points can be dragged around with the mouse.
- "Delete": object can be deleted by double-click (if active)
- "Generate": object can generate "force" or "moment" objects by dragging sample objects with the mouse.
Return value: only relevant for interactive input
JSON data for objects that can be animated now have extra inputs
Note:
- Not all objects are meant to be animated, as it depends on the purpose of their functionalities.
- xdist refers to the x-coordinate distance the objects move
- ydist refers to the y-coordinate distance the objects move
- tms refers to the time in milliseconds the objects are animated
The input for the images in the table are found here
Object | Interactivity | Return value in names
|
Example | moveTo( ) method |
---|---|---|---|---|
"angle", "angle1", "angle2" | label string | 1. [ "angle", "name", [xc, yc], [xs,ys], radius, angle, xdist, ydist, tms] 2. [ "angle", ".", [xc, yc], [xs,ys], radius, (-)90, xdist, ydist, tms ] 3. [ "angle2", "name", [xc, yc], [xs,ys], radius, angle, xdist, ydist, tms ] |
||
"axes" | ||||
"bar" | Switch | "show" or list of load indices if hidden | [ "bar", "labelname", [x1, y1], [x2, y2], xdist, ydist, tms, state] | |
"beam" | Switch | state | ||
"circle" | Switch | state | 1. [ "circle", "name", [xc, yc], [xp,yp] , angle, xdist, ydist, tms, state] 2. [ "circle", "name", [xc, yc], radius , angle, xdist, ydist, tms, state] |
|
"circle2p" | Move | [x1,y1],[x2,y2] | ||
"crosshair" | Move | [x,y] (scaled) | ||
"dashpot" | Switch | "show" or list of load indices if hidden | [ "dashpot", "name", [x1,y1], [x2,y2], r, offset, xdist, ydist, tms, state] | |
"dim" | label string | ["dim", "name", [x1,y1], [x2,y2], off, xdist, ydist, tms] | ||
"dir" | label string | 1. ["dir", "name", [x1,y1], angle, xdist, ydist, tms] 2. ["dir", "name", [x1,y1], angle, xdist, ydist, tms, offset] 3. ["dir", "name", [x1,y1], angle, xdist, ydist, tms, offset, length] |
||
"disp" | label string | [ "disp", "name", [x,y], angle, xdist, ydist, tms, offset, length] | ||
"fix1", "fix12", "fix123", "fix13" | Switch | "show" or list of load indices if hidden | 1. [ "fix1", "name", [x, y], angle, xdist, ydist, tms, state ] 2. [ "fix12", "name", [x, y], angle, xdist, ydist, tms, state ] 3. [ "fix123", "name", [x, y], angle, xdist, ydist, tms, state ] 4. [ "fix13", "name", [x, y], angle, xdist, ydist, tms, state ] |
|
"force" | Move, delete | expression | ||
"forceGen" | Generate | 0 | ||
"frame" | 0 | |||
"grid" | 0 | |||
"label" | 0 | [ "label", "name", [x, y], xdist, ydist, tms, color] | ||
"line" | 0 | ["line", "color", [x1, x2,...], [y1, y2,...] ,dash, th, xdist, ydist, tms] | ||
"line2p" | Move | [x1,y1],[x2,y2] | ||
"mass" | 0 | [ "mass", [x,y], xdist, ydist, tms, r, off,] | ||
"moment" | Move, delete | expression | ||
"momentGen" | Generate | 0 | ||
"node" | label string | [ "node", "name", [x,y], xdist, ydist, tms, off, color ] | ||
"point" | label string | [ "point", "name", [x,y], xdist, ydist, tms, off ] | ||
"polygon" | Switch | state | [ "polygon", "name", [x1, y1], [x2,y2],..., xdist, ydist, tms, state ] | |
"q" | Switch | "show" or list of load indices if hidden | ||
"rope" | Switch | "show" or list of load indices if hidden | ["rope", "name",[x1,y1], r1, [x2,y2],r2, xdist, ydist, tms, state] | |
"rot" | label string | ["rot", "name", [x1, y1], [x2,y2], [x3,y3], xdist, ydist, tms] | ||
"spline" | Move | expression f(x) | ||
"springc" | Switch | "show" or list of load indices if hidden | ||
"springt" | Switch | "show" or list of load indices if hidden | ||
"wall" | Switch | "show" or list of load indices if hidden | [ "wall", "name", [x1, y1], [x2,y2] , angle, xdist, ydist, tms, state ] |
In order to try code snippets in jsfiddle,
- copy the code from the wiki page to the clipboard
- follow the link for the JSXGraph version you want to try
- Replace the code in the HTML section (contents of
<p hidden id="init">
) with the content of the clipboard