🖱️ Move your mouse • 📜 Scroll to see depth
👆 Try moving your mouse around!
SuperParallax is a lightweight JavaScript library that creates stunning multi-layer parallax effects combining both scroll and mouse movement tracking.
It's inspired by classic 2D video games where different layers move at different speeds to create an illusion of depth.
npm install github:Reyemneirda/super-parallax
Or include it directly in your HTML:
<script src="path/to/super-parallax.js"></script>
// Initialize SuperParallax
const parallax = new SuperParallax('.parallax-container', {
scrollMultiplier: 1,
mouseMultiplier: 0.5,
smoothing: 0.1
});
Then add the data attributes to your HTML elements:
<div data-parallax-layer data-parallax-depth="0.5">
Your content here
</div>
scrollMultiplier: Controls the intensity of scroll effects (default: 1)
mouseMultiplier: Controls the intensity of mouse effects (default: 0.5)
smoothing: How smooth the animation is, 0-1 (default: 0.1)
centerMouse: Center mouse coordinates (default: true)
resetOnMouseLeave: Reset position when mouse leaves (default: true)