fix(BOOK-496): Slowed down the MarqueeText component animation
Approved-by: Matilda Landström
This commit is contained in:
@@ -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`
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user