Here you can find the current demo:
http://zanate.com.mx/proyectos/alyn/rappi_demo/
The idea is to make the browser to play different videos on the background depending on the scene number.
The thing is that, in order to try to get this to feel as smooth as posible, I trying to disable the scroll while the video on the background is playing and re-enableing it once it the timeline reached the end of the video.
if (hypeDocument.currentSceneName() == '1') {
reverse_video = "reverse_1"
play_video = "foward_2"
}
if (hypeDocument.currentSceneName() == '2') {
reverse_video = "reverse_2"
play_video = "foward_3"
}
if (hypeDocument.currentSceneName() == '3') {
reverse_video = "reverse_3"
play_video = "foward_4"
}
// ====================================== SCROLL ACTIONS
if (scrolltrigger === 'on') {
$('.triggertext').text(scrolltrigger);
if (window.addEventListener) {
window.addEventListener("mousewheel", scrollScene, false);
window.addEventListener("DOMMouseScroll", scrollScene, false);
}
function scrollScene(e) {
var upORdown = Math.max(-1, Math.min(1, (e.wheelDelta || -e.detail)));
if (upORdown === 1) {
hypeDocument.showPreviousScene(hypeDocument.kSceneTransitionPushTopToBottom, 0.5)
hypeDocument.functions().stop_allvideos(hypeDocument, element, event);
hypeDocument.getElementById(reverse_video).style.visibility = "visible"; // PLAY THIS ONE
hypeDocument.getElementById(reverse_video).currentTime = 0;
hypeDocument.getElementById(reverse_video).play();
} else {
hypeDocument.showNextScene(hypeDocument.kSceneTransitionPushBottomToTop, 0.5)
hypeDocument.functions().stop_allvideos(hypeDocument, element, event);
hypeDocument.getElementById(play_video).style.visibility = "visible"; // PLAY THIS ONE
hypeDocument.getElementById(play_video).currentTime = 0;
hypeDocument.getElementById(play_video).play();
hypeDocument.functions().lockscroll(hypeDocument, element, event);
}
}
} else if (scrolltrigger === 'off') {
$('.triggertext').text(scrolltrigger);
window.removeEventListener("mousewheel", scrollScene);
window.removeEventListener("DOMMouseScroll", scrollScene);
}
// ====================================== SCROLL ACTIONS
This is the code I am currently using. You can download the hype file here:
As soon the new scene loads I am setting scrolltrigger = off;
and it seems to be picking this change correctly, but the removeEventListener doesn’t seems to be doing anything.
https://www.dropbox.com/s/xmvfauk760mfpmf/rappi_test.zip?dl=1