react-lottie vs react-lottie-player vs lottie-react-web
React Animation Libraries Comparison
1 Year
react-lottiereact-lottie-playerlottie-react-webSimilar Packages:
What's React Animation Libraries?

These libraries facilitate the integration of Lottie animations into React applications, allowing developers to create rich, interactive animations that enhance user experience. Lottie animations are vector-based and can be scaled without losing quality, making them ideal for responsive designs. Each of these libraries offers unique features and approaches to handling Lottie animations, catering to different developer needs and preferences.

Package Weekly Downloads Trend
Github Stars Ranking
Stat Detail
Package
Downloads
Stars
Size
Issues
Publish
License
react-lottie293,3771,71928 kB1007 months agoMIT
react-lottie-player156,188-120 kB-a year agoMIT
lottie-react-web10,683188-435 years agoMIT
Feature Comparison: react-lottie vs react-lottie-player vs lottie-react-web

Ease of Use

  • react-lottie:

    react-lottie provides a more comprehensive API that includes various props for controlling animation playback, making it slightly more complex but very powerful for detailed control over animations.

  • react-lottie-player:

    react-lottie-player is designed for simplicity and ease of use, allowing developers to quickly set up animations with a clean interface and straightforward props.

  • lottie-react-web:

    lottie-react-web offers a minimalistic API that makes it easy to integrate Lottie animations into your React components without much configuration, ideal for quick implementations.

Animation Control

  • react-lottie:

    react-lottie excels in providing detailed control over animations, including play, pause, stop, and event callbacks, allowing for interactive and dynamic animations based on user actions.

  • react-lottie-player:

    react-lottie-player offers a balance between simplicity and control, enabling developers to easily manage playback and loop settings while still providing customization options.

  • lottie-react-web:

    lottie-react-web provides basic support for rendering animations but lacks advanced controls for playback, making it suitable for static animations without interactive needs.

Performance

  • react-lottie:

    react-lottie may introduce some overhead due to its additional features, but it is still performant for most applications, especially those that require complex animations.

  • react-lottie-player:

    react-lottie-player is designed to be efficient, but its performance can vary based on the complexity of the animations and the number of instances rendered.

  • lottie-react-web:

    lottie-react-web is lightweight and optimized for performance, making it suitable for applications where loading speed is critical and animations are used sparingly.

Customization

  • react-lottie:

    react-lottie allows for more customization through props and event handlers, enabling developers to tailor animations to specific interactions and states.

  • react-lottie-player:

    react-lottie-player provides a user-friendly way to customize animations with props for speed, direction, and looping, making it easy to adapt animations to different contexts.

  • lottie-react-web:

    lottie-react-web has limited customization options, focusing primarily on rendering animations as they are, which may not suit all use cases.

Community and Support

  • react-lottie:

    react-lottie benefits from a larger community and more extensive documentation, making it easier to find solutions and examples for common use cases.

  • react-lottie-player:

    react-lottie-player is gaining popularity and has a growing community, but it may not yet have as many resources as react-lottie.

  • lottie-react-web:

    lottie-react-web has a smaller community compared to the other libraries, which may result in less available support and fewer resources for troubleshooting.

How to Choose: react-lottie vs react-lottie-player vs lottie-react-web
  • react-lottie:

    Select react-lottie if you require a more feature-rich library that provides additional controls for animation playback, such as play, pause, and stop functionalities, along with event handling for animation lifecycle events.

  • react-lottie-player:

    Opt for react-lottie-player if you want a highly customizable player with a focus on ease of use, providing a simple interface for controlling animations and supporting both Lottie and SVG formats.

  • lottie-react-web:

    Choose lottie-react-web if you need a lightweight solution that focuses on rendering Lottie animations with minimal overhead and offers a straightforward API for integrating animations into your React components.

README for react-lottie

Lottie Animation View for React (Angular, Vue)

npm version

Demo

https://chenqingspring.github.io/react-lottie

Wapper of bodymovin.js

bodymovin is Adobe After Effects plugin for exporting animations as JSON, also it provide bodymovin.js for render them as svg/canvas/html.

Why Lottie?

Flexible After Effects features

We currently support solids, shape layers, masks, alpha mattes, trim paths, and dash patterns. And we’ll be adding new features on a regular basis.

Manipulate your animation any way you like

You can go forward, backward, and most importantly you can program your animation to respond to any interaction.

Small file sizes

Bundle vector animations within your app without having to worry about multiple dimensions or large file sizes. Alternatively, you can decouple animation files from your app’s code entirely by loading them from a JSON API.

Learn more › http://airbnb.design/lottie/

Looking for lottie files › https://www.lottiefiles.com/

Installation

Install through npm:

npm install --save react-lottie

Usage

Import pinjump.json as animation data

import React from 'react'
import Lottie from 'react-lottie';
import * as animationData from './pinjump.json'

export default class LottieControl extends React.Component {

  constructor(props) {
    super(props);
    this.state = {isStopped: false, isPaused: false};
  }

  render() {
    const buttonStyle = {
      display: 'block',
      margin: '10px auto'
    };

    const defaultOptions = {
      loop: true,
      autoplay: true, 
      animationData: animationData,
      rendererSettings: {
        preserveAspectRatio: 'xMidYMid slice'
      }
    };

    return <div>
      <Lottie options={defaultOptions}
              height={400}
              width={400}
              isStopped={this.state.isStopped}
              isPaused={this.state.isPaused}/>
      <button style={buttonStyle} onClick={() => this.setState({isStopped: true})}>stop</button>
      <button style={buttonStyle} onClick={() => this.setState({isStopped: false})}>play</button>
      <button style={buttonStyle} onClick={() => this.setState({isPaused: !this.state.isPaused})}>pause</button>
    </div>
  }
}

props

The <Lottie /> Component supports the following components:

options required

the object representing the animation settings that will be instantiated by bodymovin. Currently a subset of the bodymovin options are supported:

loop options [default: false]

autoplay options [default: false]

animationData required

rendererSettings required

width optional [default: 100%]

pixel value for containers width.

height optional [default: 100%]

pixel value for containers height.

eventListeners optional [default: []]

This is an array of objects containing a eventName and callback function that will be registered as eventlisteners on the animation object. refer to bodymovin#events where the mention using addEventListener, for a list of available custom events.

example:

eventListeners=[
  {
    eventName: 'complete',
    callback: () => console.log('the animation completed:'),
  },
]

isClickToPauseDisabled optional [default: false] When this props is left unspecified or is set to false animations are paused or resumed when a user clicks or taps them. If you do not want this behaviour set this prop to true.

Related Projects

Contribution

Your contributions and suggestions are heartily welcome.

License

MIT