js Diagonal movement at minute speeds
<p>There are numerous questions on SO similiar to this but not exactly as far as I could tell.</p>

<p>Want to move an object along a path at a slow pace. Here's an example of what I've got.</p>

<pre><code>var moverateX,moverateY;

function setup (){
var opp=targetY-startY;
var adj=targetX-startX;
var hyp=Math.sqrt ((opp*opp)+(adj*adj));
moverateY=10*(opp/hyp);
moverateX=10*(adj/hyp);}

function okgo (){
obj.style.left=currentX+moverateX+'px';
obj.style.top=currentY+moverateY+'px';
setTimeout (function (){okgo ();},50);}
</code></pre>

<p>It works but moves too quickly. If I change the number the ratio is multiplied by to a smaller one, the object misses the end target. eg:</p>

<pre><code>var moverateY=2*(opp/hyp);
var moverateX=2*(adj/hyp);
//moves slower but misses the end mark by a fair margin
</code></pre>

<p>Any ideas?</p>
