const scrollSpeed = 0.2
const startDelay = 5000
const totalScrollDistance = document.documentElement.scrollHeight - window.innerHeight
const scrollDuration = totalScrollDistance / scrollSpeed
let startTime = null
function scrollAnimation(currentTime) {
if (startTime === null) {
startTime = currentTime
}
const elapsedTime = currentTime - startTime
const scrollPosition = (elapsedTime / scrollDuration) * totalScrollDistance
window.scrollTo(0, scrollPosition)
if (elapsedTime < scrollDuration) {
window.requestAnimationFrame(scrollAnimation)
}
}
function startScrolling() {
setTimeout(() => {
window.requestAnimationFrame(scrollAnimation)
}, startDelay)
}
startScrolling()