1//Install
2$ npm install lax.js
3import lax from 'lax.js'
4
5//Add to the html
6<script src="lib/lax.min.js" >
7// or via CDN
8<script src="https://cdn.jsdelivr.net/npm/lax.js" ></script>
9
10//Initialize it
11window.onload = function() {
12 lax.setup() // init
13
14 const updateLax = () => {
15 lax.update(window.scrollY)
16 window.requestAnimationFrame(updateLax)
17 }
18
19 window.requestAnimationFrame(updateLax)
20}
21
22//Add to the class that you want to animate
23<p class="lax" data-lax-preset="spin fadeInOut">Look at me goooooo!</p>