Skip to content

Instantly share code, notes, and snippets.

@johnmccole
Last active April 23, 2024 12:54
Show Gist options
  • Save johnmccole/f568c2f23a8a9bff30b481e10ef7be7f to your computer and use it in GitHub Desktop.
Save johnmccole/f568c2f23a8a9bff30b481e10ef7be7f to your computer and use it in GitHub Desktop.
// include Lenis script where appropriate (e.g. enqueued in setup.php).
// https://unpkg.com/[email protected]/dist/lenis.min.js
// Lenis settings
const lenis = new Lenis({
duration: 1.2,
easing: (t) => (t === 1 ? 1 : 1 - Math.pow(2, -10 * t)),
direction: "vertical",
gestureDirection: "vertical",
smooth: true,
smoothTouch: true,
touchMultiplier: 2,
});
function raf(time) {
lenis.raf(time);
requestAnimationFrame(raf);
}
requestAnimationFrame(raf);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment