function to execute
Optional
opt_purpose: stringDescribes what this GenericMemo does, for developers
Private
purpose_Describes what this GenericMemo does, for developers
Returns a minimal string representation of this object, usually giving just identity information like the class name and name of the object.
For an object whose main purpose is to represent another Printable object, it is
recommended to include the result of calling toStringShort
on that other object.
For example, calling toStringShort()
on a DisplayShape might return something like
this:
DisplayShape{polygon:Polygon{'chain3'}}
a minimal string representation of this object.
Generated using TypeDoc
A generic Memorizable object that calls a JavaScript function.
Example 1
Make a GenericMemo that prints the angle variable of a simulation into the Terminal output area. Here
simRun
is an instance of SimRunner.This code can be entered as Terminal commands in Pendulum.
Use the following to turn off the GenericMemo:
Example 2
This sets the color of a spring depending on how much it is stretched.
This script can be entered as Terminal commands in Cart + Pendulum with Physics Engine.
Example 3
This stops a simulation after 2 seconds. Clicking the "play" button will then continue the simulation, because
once
has been set false. To re-enable the behavior, setonce
to true.This script can be entered as Terminal commands in any simulation.