xxxxxxxxxx
<html>
<body>
<div id="bodymovin"></div>
<script src='bodymovin.js'></script>
<script>
// cross-browser but verbose
var xhr = new XMLHttpRequest();
xhr.onload = function () {
start( JSON.parse( xhr.responseText ) );
};
xhr.open( 'GET', 'data.json' );
xhr.send();
// modern and lovely, doesn't work in Safari
// fetch( 'data.json' ).then( r => r.json() ).then( start );
function start ( animationData ) {
var params = {
container: document.getElementById('bodymovin'),
renderer: 'canvas',
loop: true,
autoplay: true,
animationData: animationData
};
var anim;
anim = bodymovin.loadAnimation(params);
}
</script>
</body>
</html>