All Projects → lottie-react-native → Lottie React Native

lottie-react-native / Lottie React Native

Licence: apache-2.0
Lottie wrapper for React Native.

Programming Languages

java
68154 projects - #9 most used programming language
javascript
184084 projects - #8 most used programming language
C#
18002 projects
swift
15916 projects
objective c
16641 projects - #2 most used programming language
ruby
36898 projects - #4 most used programming language
Starlark
911 projects

Projects that are alternatives of or similar to Lottie React Native

AE-Icon
🐱 use bodymovin to render some interesting After Effects vector icon
Stars: ✭ 47 (-99.68%)
Mutual labels:  after-effects, bodymovin
Lottieuwp
UWP port of Lottie(https://github.com/airbnb/lottie-android)
Stars: ✭ 276 (-98.12%)
Mutual labels:  animations, after-effects
Lottie Windows
Lottie-Windows is a library (and related tools) for rendering Lottie animations on Windows 10.
Stars: ✭ 322 (-97.81%)
Mutual labels:  animations, after-effects
Unity Aseprite Importer
An aseprite-file importer for unity written in C#, built upon the experimental AssetImporter API
Stars: ✭ 177 (-98.8%)
Mutual labels:  animations
Ae Element
🎨 use bodymovin to render some interesting After Effects vector element
Stars: ✭ 180 (-98.78%)
Mutual labels:  after-effects
Swiftyanimate
Composable animations in Swift
Stars: ✭ 194 (-98.68%)
Mutual labels:  animations
Vue Particle Effect Buttons
A bursting particles effects buttons component ✨💥❄️🌋
Stars: ✭ 219 (-98.51%)
Mutual labels:  animations
Agvolumecontrolview
Visual regulator can be connected to a player or other smart house’s device making the process of controlling the level of a particular characteristic
Stars: ✭ 170 (-98.84%)
Mutual labels:  animations
Xamarin Forms Page Transitions
Custom page transitions in a Xamarin.Forms App
Stars: ✭ 200 (-98.64%)
Mutual labels:  animations
Babypiganimation
基本动画、位移动画、缩放动画、旋转动画、组动画、关键帧动画、贝塞尔曲线、进度条动画、复杂动画、OC动画、aniamtion、basicanimation等。
Stars: ✭ 192 (-98.69%)
Mutual labels:  animations
Jelly
🌊 - Jelly is a library for animated, non-interactive & interactive viewcontroller transitions and presentations with the focus on a simple and yet flexible API.
Stars: ✭ 2,319 (-84.23%)
Mutual labels:  animations
Angular Fx
Angular CSS3 animation directives (ngfx-bounce, ngfx-shake, ngfx-flip, ngfx-pulse and more ...) https://720kb.github.io/angular-fx
Stars: ✭ 181 (-98.77%)
Mutual labels:  animations
React Portfolio Template
Modern React Portfolio Template (FREE)
Stars: ✭ 188 (-98.72%)
Mutual labels:  animations
Konfetti
Celebrate more with this lightweight confetti particle system 🎊
Stars: ✭ 2,278 (-84.51%)
Mutual labels:  animations
Web Portfolio
Personal portfolio website made with the React
Stars: ✭ 207 (-98.59%)
Mutual labels:  animations
Sketch2ae
A Sketch plugin to export sketch file to Adobe After Effect
Stars: ✭ 170 (-98.84%)
Mutual labels:  after-effects
Duaef duik
Duduf After Effects Framework | Duik
Stars: ✭ 197 (-98.66%)
Mutual labels:  after-effects
Animatable Component
Animate once, use Everywhere! 💫
Stars: ✭ 188 (-98.72%)
Mutual labels:  animations
React Native Animated Spinkit
A collection of loading indicators for React Native
Stars: ✭ 186 (-98.74%)
Mutual labels:  animations
Motionlayoutexperiments
Collection of experiments, using motion layout.
Stars: ✭ 194 (-98.68%)
Mutual labels:  animations

Lottie for React Native, iOS, and Android

npm Version License

Lottie component for React Native (iOS and Android)

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!

For the first time, designers can create and ship beautiful animations without an engineer painstakingly recreating it by hand.

Installing

Install lottie-react-native (latest) and lottie-ios (3.2.3):

yarn add lottie-react-native
yarn add [email protected]

or

npm i --save lottie-react-native
npm i --save [email protected]

Go to your ios folder and run:

pod install

Versioning

Depending on which version of React Native your app runs on you might need to install a specific version of lottie-react-native. Here's the compatibility list:

App built in React Native version Requires lottie-react-native version Requires lottie-ios version
>= 0.59 3.0.2 3.0.3
>= 0.60 4.0.2 3.2.3
>= 0.63 4.0.3 3.2.3
>= 0.64 4.1.3 3.2.3
>= 0.66 latest 3.2.3

Usage

(If you are using TypeScript, please read this first)

LottieView can be used in a declarative way:

import React from 'react';
import LottieView from 'lottie-react-native';

export default class BasicExample extends React.Component {
  render() {
    return <LottieView source={require('./animation.json')} autoPlay loop />;
  }
}

Additionally, there is an imperative API which is sometimes simpler.

import React from 'react';
import LottieView from 'lottie-react-native';

export default class BasicExample extends React.Component {
  componentDidMount() {
    this.animation.play();
    // Or set a specific startFrame and endFrame with:
    this.animation.play(30, 120);
  }

  render() {
    return (
      <LottieView
        ref={animation => {
          this.animation = animation;
        }}
        source={require('../path/to/animation.json')}
      />
    );
  }
}

Lottie's animation progress can be controlled with an Animated value:

import React from 'react';
import { Animated, Easing } from 'react-native';
import LottieView from 'lottie-react-native';

export default class BasicExample extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      progress: new Animated.Value(0),
    };
  }

  componentDidMount() {
    Animated.timing(this.state.progress, {
      toValue: 1,
      duration: 5000,
      easing: Easing.linear,
    }).start();
  }

  render() {
    return (
      <LottieView source={require('../path/to/animation.json')} progress={this.state.progress} />
    );
  }
}

Changing color of layers:

import React from 'react';
import LottieView from 'lottie-react-native';

export default class BasicExample extends React.Component {
  render() {
    return (
      <LottieView
        source={require('../path/to/animation.json')}
        colorFilters={[
          {
            keypath: 'button',
            color: '#F00000',
          },
          {
            keypath: 'Sending Loader',
            color: '#F00000',
          },
        ]}
        autoPlay
        loop
      />
    );
  }
}

API

You can find the full list of props and methods available in our API document. These are the most common ones:

Prop Description Default
source Mandatory - The source of animation. Can be referenced as a local asset by a string, or remotely with an object with a uri property, or it can be an actual JS object of an animation, obtained (for example) with something like require('../path/to/animation.json'). None
style Style attributes for the view, as expected in a standard View. The aspectRatio exported by Bodymovin will be set. Also the width if you haven't provided a width or height
loop A boolean flag indicating whether or not the animation should loop. true
autoPlay A boolean flag indicating whether or not the animation should start automatically when mounted. This only affects the imperative API. false
colorFilters An Array of layers you want to change the color filter. []

More...

Troubleshooting

Not all After Effects features are supported by Lottie. If you notice there are some layers or animations missing check this list to ensure they are supported.

iOS specifc problems

If you have issues linking your iOS project check out this StackOverflow thread on how to fix it.

Android specific problems

If your app crashes on Android, means auto linking didn't work. You will need to make the following changes:

android/app/src/main/java/<AppName>/MainApplication.java

  • add import com.airbnb.android.react.lottie.LottiePackage; on the imports section
  • add packages.add(new LottiePackage()); in List<ReactPackage> getPackages();

android/app/build.gradle

add implementation project(':lottie-react-native') in the dependencies block

android/settings.gradle

add:

include ':lottie-react-native'
project(':lottie-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/lottie-react-native/src/android')

More

View more documentation, FAQ, help, examples, and more at airbnb.io/lottie

Example1

Example2

Example3

Community

Example4

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].