lax javascript code example
Example: lax.js
//Install
$ npm install lax.js
import lax from 'lax.js'
//Add to the html
<script src="lib/lax.min.js" >
// or via CDN
<script src="https://cdn.jsdelivr.net/npm/lax.js" ></script>
//Initialize it
window.onload = function() {
lax.setup() // init
const updateLax = () => {
lax.update(window.scrollY)
window.requestAnimationFrame(updateLax)
}
window.requestAnimationFrame(updateLax)
}
//Add to the class that you want to animate
<p class="lax" data-lax-preset="spin fadeInOut">Look at me goooooo!</p>