Skip to content

Instantly share code, notes, and snippets.

@Jokanstudio
Created April 22, 2023 15:33
Show Gist options
  • Select an option

  • Save Jokanstudio/54286a481ea79b329942a7a93a27e176 to your computer and use it in GitHub Desktop.

Select an option

Save Jokanstudio/54286a481ea79b329942a7a93a27e176 to your computer and use it in GitHub Desktop.
Webflow-Smooth-Scroll-Lenis /javascript-code
<script src="https://cdn.jsdelivr.net/gh/studio-freight/lenis@0.2.28/bundled/lenis.js"></script>
<script>
const lenis = new Lenis({
duration: 1.2,
easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)), // https://www.desmos.com/calculator/brs54l4xou
direction: 'vertical', // vertical, horizontal
gestureDirection: 'vertical', // vertical, horizontal, both
smooth: true,
mouseMultiplier: 1,
smoothTouch: false,
touchMultiplier: 2,
infinite: false,
})
//get scroll value
lenis.on('scroll', ({ scroll, limit, velocity, direction, progress }) => { console.log({ scroll, limit, velocity, direction, progress })
})
function raf(time) {
lenis.raf(time)
requestAnimationFrame(raf)
}
requestAnimationFrame(raf)
</script>
@mkk360
Copy link

mkk360 commented Nov 28, 2024

why On scroll text and other elements blink

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment