I used to have a script that moved a div according to the mouse. I also used a timer. I used the following formula to move the div.
new position = ((old position * 9)+ current mouse position)/10
Its particularly effective as you slowly move to the new position. Its recalculated every lets say tenth of a second.
My question is
- how do I move a div every tenth of a second
- How do calculate the current mouse position