3 ms·
Can you animate it to scroll up and down on loop? It’s a nice visual experience.
by siquick 3y ago
Can you animate it to scroll up and down on loop? It’s a nice visual experience.
- wkat4242 3y agoReminds me a bit of star wars lol
- tetris11 3y agoBest I've got is ``` var speed_x = 50, speed_y = 2, step = 20, stop_after = 60 * 1000; var t = setInterval(function(){ // scrollY faster for larger text let ymod = 1 + (50 * ((scrollY / scrollMaxY)**2)) window.scrollBy(speed_x, speed_y * ymod) if ((scrollX >= scrollMaxX) || (scrollX <= 0)){ speed_x = -speed_x } if ((scrollY >= scrollMaxY) || (scrollY <= 0)){ speed_y = -speed_y } }, step); setTimeout(function(){clearTimeout(t)}, stop_after) ```