Reputation: 25
Is it possible to control a video with your mouse position on screen?
So for instance, if my cursor is on the left side of my screen, the video will be at the first frame, but when I move my cursor to the right of the screen, the video plays untill the cursor reaches the right side of my screen.
I looked at the .mousemove() section of the jQuery website and think this should be possible. However I can not find any example of this online..
If this does not work, them i'm thinking about using an image sequence instead.
Looking forward hearing your ideas, visions, experience on this!
Upvotes: 1
Views: 3946
Reputation: 736
I did this:
var mouseX;
$(document).mousemove( function(e) {
mouseX = e.pageX;
var timV = $(".mask-video1 video").get(0).duration;
var valV = (timV*mouseX/$(window).width());
$(".mask-video1 video").get(0).currentTime = valV;
});
Upvotes: 2