time = dateObj.getTime() - firstTime; firstTime = dateObj.getTime(); //<---- mouse[0] = e.pageX; mouse[1] = e.pageY;