Upgrade Lenis smooth scroll
This commit is contained in:
@@ -10,15 +10,16 @@
|
||||
// Setup smooth scroll
|
||||
if (browser) {
|
||||
$smoothScroll = new Lenis({
|
||||
lerp: 0.1,
|
||||
duration: 1.2,
|
||||
easing: (t) => (t === 1 ? 1 : 1 - Math.pow(2, -10 * t)), // https://easings.net/
|
||||
smooth: true,
|
||||
direction: 'vertical',
|
||||
})
|
||||
}
|
||||
|
||||
// Lenis RAF
|
||||
const update = () => {
|
||||
$smoothScroll.raf()
|
||||
const update = (time: number) => {
|
||||
$smoothScroll.raf(time)
|
||||
smoothScrollRAF = requestAnimationFrame(update)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user