import { preloadImages } from './utils.js'; import { Content } from './content.js'; // Smooth scrolling. let lenis; const initSmoothScrolling = () => { // Smooth scrolling initialization (using Lenis https://github.com/studio-freight/lenis) lenis = new Lenis({ lerp: 0.1, smoothWheel: true, orientation: 'vertical', }); lenis.on('scroll', () => ScrollTrigger.update()); const scrollFn = () => { lenis.raf(); requestAnimationFrame(scrollFn); }; requestAnimationFrame(scrollFn); }; // .content elements const contentElems = [...document.querySelectorAll('.content')]; contentElems.forEach(el => new Content(el)); // smooth scrolling with Lenis initSmoothScrolling(); // Preload images then remove loader (loading class) from body preloadImages('.canvas-wrap').then(() => document.body.classList.remove('loading'));