-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.js
40 lines (33 loc) · 985 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
document.addEventListener("DOMContentLoaded", function() {
const easeInOutCirc = t => {
if ((t *= 2) < 1) return -0.5 * (Math.sqrt(1 - t * t) - 1);
return 0.5 * (Math.sqrt(1 - (t -= 2) * t) + 1);
};
const lenis = new Lenis({
ease: easeInOutCirc,
multiplier: 2,
smoothMobile: true,
smoothElements: '[data-scroll]',
smoothWheel: true,
smoothKeys: true,
smoothScrollbar: true,
scrollbarContainer: null,
direction: 'vertical',
snap: true,
snapAlignment: 'start',
snapInterval: '50%',
snapStrict: true,
anchors: '[data-anchor]',
limits: true,
limitTop: 0,
limitBottom: 1
});
lenis.on('scroll', (e) => {
console.log(e);
});
function raf(time) {
lenis.raf(time);
requestAnimationFrame(raf);
}
requestAnimationFrame(raf);
});