I would like to allow users to see the content by scrolling (using the mouse wheel, without a scrollbar being visible), and when a limit of the stage is reached, to starts in another direction and, in a few steps, it reaches the starting point and continues endlessly.
I was searching on the forum the post related to the scrolling but I haven't found something similar.
Can someone show me a similar post or create a small demo, which I can develop further?
Hello again @h_classen .
This is the model that I was trying to use: React App (desktop only).
I am putting it here as idea, as I think it is a beautiful concept.
Thank you!
Thank you very much.
It's very interesting how again only Firefox interprets differently. This time, Firefox interprets the scroll up as down and the scroll down as up.
Others (Safari, Chrome, Opera) interpret correctly.
// Get the current time in the Main Timeline
let time = hypeDocument.currentTimeInTimelineNamed('Main Timeline');
// Get the duration of the Main Timeline
const duration = hypeDocument.durationForTimelineNamed('Main Timeline');
// Set the step size for incrementing/decrementing the time
const step = 0.05;
// Define the wheel function to handle mouse wheel events
function wheel(event) {
// Prevent the default behavior of the event
event.preventDefault();
// Get the mouse wheel delta value
var delta = event.wheelDelta || event.detail;
// Check if the current time is at the end or the beginning of the timeline
if (time >= duration) {
time = 0;
} else if (time <= 0) {
time = duration - time;
}
// Determine whether the event was triggered by a DOM mouse scroll
if (event.type == "DOMMouseScroll") {
// If the delta is greater than 0, decrement the time by the step size
if (delta > 0) {
time -= step;
} else {
// Otherwise, increment the time by the step size
time += step;
}
} else {
// If the delta is greater than 0, increment the time by the step size
if (delta > 0) {
time += step;
} else {
// Otherwise, decrement the time by the step size
time -= step;
}
}
// Go to the new time in the Main Timeline
hypeDocument.goToTimeInTimelineNamed(time, 'Main Timeline');
}
// Add the wheel function as a listener for mousewheel and DOMMouseScroll events
window.addEventListener("mousewheel", wheel);
window.addEventListener("DOMMouseScroll", wheel);