Dragable Spring

<html>
<head>
<script LANGUAGE="JavaScript">
mid=0;

function initApplet(){ 
	document.animator2.setDefault(); 
	document.animator2.pause(); 
	document.animator2.reset();
	fid=document.animator2.addObject("rectangle", "x=-14, y=0, width=30, height=20");
	mid=document.animator2.addObject("rectangle", "x=5, y=0, width=20, height=20");
	document.animator2.addConnectorSpring(fid,mid);
	document.animator2.setRGB(fid, 0, 0, 0);      
	document.animator2.setRGB(mid, 0, 0, 196);
	document.animator2.setDragable(mid, true);
	document.animator2.setConstrainY(mid, 0, -10, 15);
	x = document.animator2.getX(mid);
	document.animator2.setMass(mid, 1);
	document.animator2.setVX(mid, 10);
	document.animator2.setForce(mid, "(5-x)*10", "0", x, 0, 0,0);	
	document.animator2.setTimeContinuous();
}

</script>
<title>Dragable Spring</title>
</head>
<body onload="initApplet()" >
<h2 align="left">Dragable Spring</h2>
<form name=myform>
  <center>

        <applet code="animator4.Animator.class" codebase="../classes" id="Animator"
        archive="Animator4_.jar,STools4.jar" name="animator2" width="300" height="200"
        hspace="0" vspace="0" align="Middle" mayscript>
          <param name="FPS" value="10">
          <param name="ShowControls" value="false">
          <param name="dt" value="0.05">
          <param name="PixPerUnit" value="10">
          <param name="GridUnit" value="1.0">
        </applet>
<p>
<table border=0 align=center><tr align=center><td>
<input type="BUTTON"  value="Play animation" onclick="document.animator2.startClock()"></td><td>
<td>
<input type="BUTTON"  value="Pause animation" onclick="document.animator2.stopClock()"></td><td>
<input type="BUTTON"  value="Reset time" onclick="document.animator2.reset();"></td></tr>
</TABLE>
</form>
</body>
</html>