Socket
Socket
Sign inDemoInstall

lottie-web

Package Overview
Dependencies
Maintainers
1
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lottie-web

After Effects plugin for exporting animations to SVG + JavaScript or canvas + JavaScript


Version published
Weekly downloads
2M
increased by1.14%
Maintainers
1
Weekly downloads
 
Created

What is lottie-web?

The lottie-web npm package is a library that parses Adobe After Effects animations exported as json with Bodymovin and renders them natively on the web. It is widely used for adding high-quality animations to web applications without the need for traditional image or video files, resulting in smaller file sizes and smoother playback.

What are lottie-web's main functionalities?

Loading Animations

This feature allows you to load and play animations on a web page. You can specify the container element, whether to loop the animation, whether to autoplay, and the path to the animation JSON file.

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

Controlling Animation Playback

This feature provides control over the playback of the animation. You can play, stop, pause, adjust the speed, and change the direction of the animation.

var animation = lottie.loadAnimation({ /* ... */ });
animation.play();
animation.stop();
animation.pause();
animation.setSpeed(0.5); // Half speed
animation.setDirection(-1); // Reverse playback

Manipulating Animation

This feature allows you to manipulate the animation by jumping to specific points in time and controlling whether to use subframes for smoother animations or whole frames for performance.

var animation = lottie.loadAnimation({ /* ... */ });
animation.goToAndStop(500, true); // Go to 500ms and stop
animation.setSubframe(false); // Use whole frames only

Responding to Events

This feature enables you to respond to various events in the animation lifecycle, such as when the animation is complete, looped, or destroyed.

var animation = lottie.loadAnimation({ /* ... */ });
animation.addEventListener('complete', function() {
  console.log('Animation completed');
});

Other packages similar to lottie-web

Keywords

FAQs

Package last updated on 13 Jun 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc