fix(BOOK-496): Slowed down the MarqueeText component animation

Approved-by: Matilda Landström
This commit is contained in:
Erik Tiekstra
2025-11-04 10:29:20 +00:00
parent 59143b4023
commit fa10abbe78
2 changed files with 19 additions and 26 deletions

View File

@@ -52,17 +52,16 @@ export function MarqueeText({
// Calculate dynamic animation duration based on scroll distance
// This is done to avoid long scrolling durations for small distances and vice versa
// Base formula: minimum 2s, add 50ms per pixel of scroll distance
const baseDuration = 2
const durationPerPixel = 0.05
const calculatedDuration = Math.max(
baseDuration,
// Base formula: minimum 4000ms, add 60ms per pixel of scroll distance. The duration
// includes start and end pauses.
const baseDuration = 4000
const durationPerPixel = 60
const calculatedDuration =
baseDuration + scrollDistance * durationPerPixel
)
parentElement.style.setProperty(
"--animation-duration",
`${calculatedDuration}s`
`${calculatedDuration}ms`
)
}
})