Created
September 23, 2018 00:22
-
-
Save twosky2000/cae005296791af6cf1128867087e29f4 to your computer and use it in GitHub Desktop.
Simple Script that reads if the mouse is down speed is adjust, jumps back when let go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myvid = document.getElementsByTagName('video')[0]; | |
var mouseDown = 0; | |
document.body.onmousedown = function() { | |
mouseDown = 1; | |
} | |
document.body.onmouseup = function() { | |
mouseDown = 0; | |
myvid.playbackRate = 1; | |
myvid.currentTime -= 5; | |
} | |
document.onmousemove = handleMouseMove; | |
function handleMouseMove(event) { | |
if(mouseDown){ | |
var height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; | |
speed = event.pageY/height; | |
console.log(1+(speed)) | |
myvid.playbackRate = 1+(speed); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment