Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var anim;
- var elem = document.getElementById('animacionAirPods')
- var animData = {
- container: elem,
- renderer: 'canvas',
- loop: false,
- autoplay: false,
- rendererSettings: {
- progressiveLoad: false,
- preserveAspectRatio: 'xMidYMid slice'
- },
- path: 'ENLACE_JSON_AQUI'
- };
- anim = bodymovin.loadAnimation(animData);
- jQuery(document).ready(function( $ ) {
- $(window).scroll(function() {
- // calculate the percentage the user has scrolled down the page
- var scrollPercent = 100 * $(window).scrollTop() / ($(document).height() - $(window).height());
- console.log(anim.currentRawFrame);
- scrollPercentRounded = Math.round(scrollPercent);
- /*console.log( (scrollPercentRounded / 100) * anim.totalFrames );*/
- anim.goToAndStop( (scrollPercentRounded / 100) * 4000)
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement