Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript canvas mousemove

// on brouser
var canv = document.getElementById('my_canvas');
canv.addEventListener('mousemove', e => {
    console.log({x:e.offsetX, y:e.offsetY, z:e})
});

// for mobile on touch
var canv = document.getElementById('my_canvas');
canv.addEventListener('touchmove', e => {
    ee = e.touches[0];
    console.log({x:ee.clientX, y:ee.clientY, z:e})
});
 
PREVIOUS NEXT
Tagged: #javascript #canvas #mousemove
ADD COMMENT
Topic
Name
7+7 =