Moving div according to mouse and timer

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

  1. how do I move a div every tenth of a second
  2. How do calculate the current mouse position

By using setInterval to run a function every 100 milliseconds.

With difficulty. The full details are covered at the event properties page, specifically, in the [url=“”]mouse position section of the page.