nrkno / core-components

Accessible and lightweight Javascript components
https://static.nrk.no/core-components/latest/
MIT License
117 stars 10 forks source link

Changed core-scrolls's animation to be time based #761

Closed Celsiusss closed 7 months ago

Celsiusss commented 11 months ago

The scroll animation of the core-scroll component is tied to the screen refresh rate. This PR changes this to be tied to time instead, making the scroll speed consistent across different devices.

This PR replaces the friction attribute with a new duration attribute. The duration attribute takes a number in milliseconds representing how long the scroll animation should last.

I used an exponential easing function with a default duration of 500ms to match the previous default scroll animation as close as possible.

I know this is a breaking change, but I hope that this change is welcome :)

skjalgepalg commented 7 months ago

NRK is no longer actively maintaining and developing Core-components.

We recommend looking into u-elements as a possible replacement.