A step-by-step guide to building a horizontal parallax image gallery, starting with a pure DOM/CSS/JS implementation using custom smooth scrolling via lerp interpolation and getBoundingClientRect-based parallax transforms, then migrating the same effect to a GPU-accelerated WebGL version using Three.js. The WebGL version covers
Table of contents
The Initial SetupBuilding the 2D VersionAdding the Parallax EffectElevating to WebGLBuilding the WebGL VersionSyncing DOM with WebGL: The GLMedia ClassAchieving object-fit: cover in ShadersParallax in WebGLTweaking Values with lil-gui (Optional)(Optional) Exercise: Adding Touch SupportConclusionSort: