I want to calculate the angle of the mouse in degrees. Although I know that you do not need to move the mouse in a straight line, I just tried to calculate it based on the start and end points to create a good right angle.
log("ANGLE: " + getAngle(x1, y1, x2, y2)); gives strange results:
ANGLE: 0.24035975832980774 mouse has stopped ANGLE: 1.334887709726425 mouse has stopped ANGLE: 0.2722859857950508 mouse has stopped ANGLE: 0.3715485780567732 mouse has stopped
the code:
$("canvas").mousemove(function(e) { getDirection(e); if (!set) { x1 = e.pageX,
javascript math html geometry
Growler
source share