I am trying to develop a HTML5 white board. I want the users viewing the board to know where exactly the presenter is pointing within the screen. I am able to collect the mouse movements using this jquery function.
But even if i succeed to pass this values to other clients using php, how can I emulate it? Is it possible to move a small pointer image, based on the co-ordinates obtained from the presenter?
Well you can move the image using .css
such as:
$(window).mousemove(function(event) {
$("#image").css({"left" : event.pageX, "top" : event.pageY});
});
just set #image
to fixed or absolute
above
This is not very hardware intensive at all. As long as you use .css
and not .animate
This is probably the easiest and most robust solution
This has actually been done with tutorial included with Node.js and websockets. (note, you may not actually see any other cursors as that post is quite old, but you may be able to see yourself by using another computer/browser).
You say you want to use PHP, and you can probably port his node.js code to php. Here is a library to help with websockets in php.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With