lottie npm

lottie npm

// Lottie is a mobile library for Android and iOS that parses Adobe After Effects animations exported as json with bodymovin and renders them natively on mobile!

// You can install lottie using npm 
npm install lottie-web --save 

// Once it is installed, you can use a library like React-Lottie to render the animation in a React component.

// To render an animation using lottie, you need to pass the animation data (in JSON format) and a callback function to the lottie.loadAnimation method. 

var animationData = {/* Animation Data */};

lottie.loadAnimation({
  container: document.getElementById('lottie'), // the dom element that will contain the animation
  renderer: 'svg',
  loop: true,
  autoplay: true,
  animationData: animationData // the path to the animation json
});
    

Subscribe to The Poor Coder | Algorithm Solutions

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
[email protected]
Subscribe