Animator is designed to animate shapes and images on the screen. After an object is created, it can be scripted to move along a predefined trajectory or to move in response to forces. The default behavior is for an object to remain fixed at the position were it was created.
In order to move an object according to the analytic functions of time xStr and yStr, the object identifier must be known and the setTrajectory method must be called.
If an object is to become dynamic, that is, it interacts via forces and obeys Newton's Laws, the setForce method must be called.
Since Newton's laws are second order differential equations, the setForce method requires initial values for both position and velocity. Initial values are fixed; they are passed as numbers, not strings. The solution to these equations of motion is calculated using a Runge-Kutta, RK4/5, algorithm with adaptive step size. This algorithm is not foolproof, but it is a general-purpose algorithm that solves most dynamics problems.
Objects cannot rotate.
See the molecular dynamics Physlets package computations with large numbers of particles.
See the EField Physlet for computations with involving potentials and electrostatic fields.
The following examples are not described in the text. Since these examples are designed to demonstrate scripts and not pedogoy, they are presented with minimal comments. Use the view source option available in most browsers to examine the script.