I'm making this mini-game in HTML5 canvas using javascript's requestAnimationFrame.
function animate() {
frame = requestAnimationFrame( animate );
render();
}
It's destined to be a Cordova application, so I have to record touch input. The game starts when the screen is pressed
document.addEventListener('touchstart',run);
It stops when the finger is removed.
I'm now looking for a way to record the touch's x and y coordinates, in order to display the finger's position smoothly on the screen.
So I was thinking about getting the x and y coordinates, and making an arc on this place in the render() function
But how could I permanently get these coordinates, or is there another way of doing this?
Thanks!!