Kinematics ExampleBe sure the simulation has finished loading before you begin. InstructionsClick on the problem number to initialize the simulation at the top of the page. Answer the question after you have run the simulation. You may should click and drag inside the animation to read the coordinates in order to obtain numerical values. |
An applet's public methods can be called as an event from a button click.
<form name="Control"> <input type="button" value="Start" onclick="document.Animator.start()">
<input type="button" value="Stop" onclick="document.Animator.stop()">
<input type="button" value="Reset" onclick="document.Animator.reset(0.0)">
</form>
More elaborate scripting can be done through JavaScript or VBScript. The usual object "dot" notation is used to invoke the public methods of an applet. Typical JavaScript function can be to control the Animator Physlet would be written:
function prob1() { document.Animator.deleteAll(); document.Animator.reset(0.0); document.Animator.setShapeRGB(255,0,0); document.Animator.add(20,"0","20-10*t*t"); document.Animator.setCaption("Problem 1"); document.Animator.setTimeInterval(0,2); document.Animator.forward();
}
Script functions are often placed in the document HEAD. These functions can then be invoked from within an HTML page using an anchor tag.
<A HREF="JavaScript:prob1()">Problem 1</a><br>