Git Product home page Git Product logo

lottie-android's Introduction

Lottie for Android, iOS, React Native, Web, and Windows

Build Status

Get it on Google Play

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. They say a picture is worth 1,000 words so here are 13,000:

Sponsors

Lottie is maintained and improved on nights and weekends. If you use Lottie in your app, please consider sponsoring it to help ensure that we can continue to improve the project we love. Click the sponsor button above to learn more

Sponsor Button

Lead Sponsors

Lottiefiles

Lottie Lab

Airbnb

Stream

Emerge Tools

Coinbase

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

Example1

Example2

Example3

Community

Example4

Download

Gradle is the only supported build configuration, so just add the dependency to your project build.gradle file:

dependencies {
  implementation 'com.airbnb.android:lottie:$lottieVersion'
}

The latest Lottie version is: lottieVersion

The latest stable Lottie-Compose version is: lottieVersion Click here for more information on Lottie-Compose.

Lottie 2.8.0 and above only supports projects that have been migrated to androidx. For more information, read Google's migration guide.

Contributing

Because development has started for Lottie Compose, Gradle, and the Android Gradle Plugin will be kept up to date with the latest canaries. This also requires you to use Android Studio Canary builds. Preview builds can be installed side by side with stable versions.

lottie-android's People

Contributors

akihito104 avatar azchohfi avatar bhullnatik avatar bmc08gt avatar boduan-coder avatar cdotchen avatar cgathergood avatar digitalbuddha avatar dryganets avatar elihart avatar felipecsl avatar goooler avatar gpeal avatar headsvk avatar hearsilent avatar imliujun avatar jawnnypoo avatar jossiwolf avatar kevinrob avatar kudanai avatar mateuszkwiecinski avatar ngsilverman avatar pablorengo avatar paulwoitaschek avatar r-ralph avatar ramonaharrison avatar seanfchan avatar sorotokin avatar tonnyl avatar zacsweers avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lottie-android's Issues

Crash on master with my animation

I have a crash when loading an animation I put in the assets folder of the sample app.

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
at com.airbnb.lottie.AnimatableIntegerValue.(AnimatableIntegerValue.java:17)
at com.airbnb.lottie.Layer.fromJson(Layer.java:81)
at com.airbnb.lottie.LottieComposition.fromJsonSync(LottieComposition.java:165)
at com.airbnb.lottie.LottieComposition.fromInputStream(LottieComposition.java:102)
at com.airbnb.lottie.LottieComposition$FileCompositionLoader.doInBackground(LottieComposition.java:270)
at com.airbnb.lottie.LottieComposition$FileCompositionLoader.doInBackground(LottieComposition.java:258)

Unsynchronized cache construction

Right now neither strong nor weak cache construction is covered with any synchronization primitives. In case of concurrent animation loading (say, showing list of animation for a first time), due to lack of synchronization we can create multiple instances of each cache, thus get worse performance and larger memory usage.

Pre-composition support

Quite a few of our animations are pre-comp'd as we reuse elements. Bodymovin supports them; Am I doing something wrong and/or is this on the roadmap for Lottie? I'm game to look into it.

com.airbnb.lottie.LottieAnimationView crashes

java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:304)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
at com.airbnb.lottie.animatable.AnimatableIntegerValue.(AnimatableIntegerValue.java:25)
at com.airbnb.lottie.model.Layer.fromJson(Layer.java:88)
at com.airbnb.lottie.model.LottieComposition.fromJsonSync(LottieComposition.java:145)
at com.airbnb.lottie.model.LottieComposition.fromInputStream(LottieComposition.java:97)
at com.airbnb.lottie.model.LottieComposition$FileCompositionLoader.doInBackground(LottieComposition.java:266)
at com.airbnb.lottie.model.LottieComposition$FileCompositionLoader.doInBackground(LottieComposition.java:254)
at android.os.AsyncTask$2.call(AsyncTask.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 
at java.lang.Thread.run(Thread.java:818) 

MAXIS

Before opening a new issue:

  • Look through open and existing issues for duplicates.
  • Apply an appropriate label.

If this is a bug:

  • Attach your After Effects file. If you do not feel comfortable posting it on github, email
    it to [email protected]. There are 500 ways to do everything in After Effects that achieves the
    same visual effect so it is nearly impossible to reproduce your issue without the original After
    Effects file.

If this is a feature request:

  • Explain what feature you would like and why you need it. There are usually After Effects
    workarounds that we can provide in the meantime that achieve the same effect.

regarding dos attck detection program in java

in this concept clint sends the requests to the server, at the same time server can maintain the queue and counter, when the client sends the requests counter increased to 1.if the same kind of requests coming from the client server would send error message.if the client repeats samething server abruptly disconnect the communication with that client.this is the main concept of dos attack detection.cn you help to write the java code for this concept.

thank you all

Crash in Animated Typography Sample

  1. In the sample, I tried to input Ç to see how it animate. But it crashed with a logcat

Caused by: java.io.FileNotFoundException: Mobilo/Ç.json at android.content.res.AssetManager.openAsset(Native Method) at android.content.res.AssetManager.open(AssetManager.java:363) at android.content.res.AssetManager.open(AssetManager.java:337) at com.airbnb.lottie.LottieComposition.fromAssetFileName(LottieComposition.java:50) at com.airbnb.lottie.samples.LottieFontViewGroup.onKeyUp(LottieFontViewGroup.java:188) 

When I debug, character Ç and C have the same keycode which is 31. Solution to this?

  1. I used the same keyboard as above with different languages input. It works when I input A-Z in French, English. However, it doesn't work in Vietnamese language when it is given A-Z characters. Any clues?

Thanks

After Effects Samples

Hi Gabriel,

Any chance of getting downsaved versions of the After Effects samples? I can't open them in AE CC15.

Lottie looks great BTW. It'll be really useful for me once I figure out how to embed vectors rather than have them included as linked files.

Thanks!

Add image support

my animator need to operate some .png img ,build a new folder "images" and put .png file in it .
json like this:"
{
"assets": [
{
"id": "image_0",
"w": 200,
"h": 120,
"u": "images/",
"p": "img_0.png"
}
],
...
} "
but I has run app ,can't see anything without empty

Big

Before opening a new issue:

  • Look through open and existing issues for duplicates.
  • Apply an appropriate label.

If this is a bug:

  • Attach your After Effects file. If you do not feel comfortable posting it on github, email
    it to [email protected]. There are 500 ways to do everything in After Effects that achieves the
    same visual effect so it is nearly impossible to reproduce your issue without the original After
    Effects file.

If this is a feature request:

  • Explain what feature you would like and why you need it. There are usually After Effects
    workarounds that we can provide in the meantime that achieve the same effect.

About licencing issues

As seen so far,
there is no license specified,
so if I have this to be used in my projects which may be used commercial,
does Bodymovin come under Gnu or open source license or how
Will there be any legal issues forward?

Pressing "DONE" in the AppintroActivity of Sample App does nothing

Ideally when the last page of App Intro has reached, on pressing "DONE" the IntroActivity should be closed by calling finish().

Same bug exists in the Google Play version of the sample.

Not a dealbreaker as such, but my OCD compelled me to open an issue for this. :p

Lottie android Renders differently

Hi Guys,

I'm getting two different out comes when i export. The web one works fine but once i copy the json code into a android project the top corner becomes rounded. Before it was completely disconnected.

See here for the web link

Also here is a gif of the android render

Thanks

Trying to use LottieDrawable: animation doesn't start

Hi!
I just tried Lottie and I could make LottieAnimationView work with no problems.

However, I cannot make LottieDrawable work, and I wonder what I am doing wrong.

Here is what I do:

        LottieDrawable lottieDrawable = new LottieDrawable();
        mMainBinding.imgLottie.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
        mMainBinding.imgLottie.setImageDrawable(lottieDrawable);
        LottieComposition.fromAssetFileName(this, "TwitterHeart.json", (composition) -> {
            lottieDrawable.setComposition(composition);
            lottieDrawable.loop(true);
            lottieDrawable.playAnimation();
        });

The result is I only see the first frame - the animation doesn't start.
I looked at the source of LottieAnimationView to compare, and didn't see any major difference.
Any idea?

Support separated x and y values for points

Currently, Lottie searches for "k" as a direct child of "p". However, in some cases, After Effects animations will have separated keyframes for x and y, resulting in a structure like this:

"p": {
    "x": {
        "k": {
        }
    }
    "y": {
        "k": {
        }
    }
}

LottieComposition will throw an IllegalArgumentException with the message "Point values have no keyframes", when trying to load the above JSON.

It would be nice if Lottie could support this structure as it seems to be a common approach to use.
Fixing this will also require changes further down the chain, as JsonUtils.pointFromJsonArray will throw an exception as well as it expects at least two values, but the point may now be 1-dimensional and therefore only contain one value.

Let me know, what your thoughts on this are - I might try to fix this myself, but won't waste time on it, if you are already aware of this limitation and are already working on it f.x..

[Bug] Lottie is not releasing memory even after activity/fragment is destroyed.

I tried Lottie sample app and in my own app as well. Once we open activity/fragment with LottieAnimationView and exit that activity, the memory is still allocated. I used android studio memory monitor tool to get memory footprint of the app.

Ideally it should free up the memory if that Animation is not used anymore.

Here is my screenshot showing memory allocation before opening Typographic activity, after opening it and after quitting it.
screen shot 2017-02-04 at 10 56 18 am

Not building on Ubuntu 16.04, Studio 2.2

The LottieSample app is not being compiled by the Studio, for some reason it asks to setup a Gradle plugin, after which it keeps showing the building dialog box indefinitely.
The same thing happened while building the lottie app, am I doing something wrong?

Change minSdkVersion

Actually i am wonder if is possible for the near future to implement support for minSdkVersion 15.

Thanks a lot!

NullPointerException at AnimatableIntegerValue

FATAL EXCEPTION: AsyncTask #4
java.lang.RuntimeException: An error occured while executing doInBackground()
    at android.os.AsyncTask$3.done(AsyncTask.java:299)
    at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
    at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
    at java.util.concurrent.FutureTask.run(FutureTask.java:239)
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
    at java.lang.Thread.run(Thread.java:838)
 Caused by: java.lang.NullPointerException
    at com.airbnb.lottie.animatable.AnimatableIntegerValue.<init>(AnimatableIntegerValue.java:27)
    at com.airbnb.lottie.model.ShapeTransform.<init>(ShapeTransform.java:77)
    at com.airbnb.lottie.model.ShapeGroup.shapeItemWithJson(ShapeGroup.java:37)
    at com.airbnb.lottie.model.ShapeGroup.<init>(ShapeGroup.java:84)
    at com.airbnb.lottie.model.ShapeGroup.shapeItemWithJson(ShapeGroup.java:31)
    at com.airbnb.lottie.model.Layer.fromJson(Layer.java:165)
    at com.airbnb.lottie.model.LottieComposition.fromJsonSync(LottieComposition.java:145)
    at com.airbnb.lottie.model.LottieComposition.fromInputStream(LottieComposition.java:97)
    at com.airbnb.lottie.model.LottieComposition$FileCompositionLoader.doInBackground(LottieComposition.java:266)
    at com.airbnb.lottie.model.LottieComposition$FileCompositionLoader.doInBackground(LottieComposition.java:254)
    at android.os.AsyncTask$2.call(AsyncTask.java:287)
    at java.util.concurrent.FutureTask.run(FutureTask.java:234)
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 
    at java.lang.Thread.run(Thread.java:838) 

gradle error for instant run

i have this error :

Error:Could not determine the dependencies of task ':LottieSample:transformClassesWithInstantRunForDebug'.

In order to use Instant Run with this device running API 17, you must install platform 17 in your SDK

Android Studio 2.1.3
Ubuntu 14.04
i just change buildToolsVersion from 25.0.2 to 25.0.0 , and doesn't change anything from root project .

thanks in advance

Execute CompositionLoader classes with the Thread Pool Executor

I have encountered with an special case that involves multiple AsyncTasks running in a Context, where the fact that the Composition Loader is running in the basic AsyncTask Executor is causing problems with the task execution order.

I don't know if there's a reason, on why the loader task are executed this way, but it would be great to take a look on this.

Hope you can make Lottie supports Ice Cream Sandwich(API 14) ,that will be very nice^o^

Before opening a new issue:

  • Look through open and existing issues for duplicates.
  • Apply an appropriate label.

If this is a bug:

  • Attach your After Effects file. If you do not feel comfortable posting it on github, email
    it to [email protected]. There are 500 ways to do everything in After Effects that achieves the
    same visual effect so it is nearly impossible to reproduce your issue without the original After
    Effects file.

If this is a feature request:

  • Explain what feature you would like and why you need it. There are usually After Effects
    workarounds that we can provide in the meantime that achieve the same effect.

Problems in Sample Code

In android please use:
LottieAnimationView animationView = (LottieAnimationView) findViewById(R.id.animation_view);

your sample has
LottieAnimationView animationView = findViewById(R.id.animation_view);
(which will parse to normal view)

Create a pluggable JSON parsing module

Ideally there would be 2 (or n) optional json parsing modules.
1 would use raw json objects so there would be no transitive dependencies
The other would use jackson or another more performant json parsing library.

Reduce support library version

Lottie uses appcompat library version 25.1.1

https://github.com/airbnb/lottie-android/blob/master/lottie/build.gradle#L24

I'm using 24.1.1 version of support library. When adding lottie dependency, android studio changes my app support library version to the latest version used by any dependencies which here is 25.1.1

I'm not moving to 25.1.1 due to certain bugs in that version. It would be better if lottie uses lowest possible version of support library. For ex if it uses 23.x, and the user uses 24.x or 25.x, then on build time everyones support library version would be the maximum version used (24.x or 25.x).

Cannot select json file stored locally

I have tried placing the sample json files in my device storage, and from the app, they don't seem to be selectable from the default file manager.

Nexus 6P, running latest stable 7.1.1.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.