利用插件制作安卓动画

用到两个插件:Bodymovin和Lottie

Bodymovin:AE插件  ,作用是把AE合成生成json文件。

Lottie:安卓端把json文件,解析成动画 并展现出来

Lottie使用方法 :

1.首先添加依赖:

compile 'com.airbnb.android:lottie:2.1.0'
2.布局文件添加:

<com.airbnb.lottie.LottieAnimationView
        android:id="@+id/animation_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:lottie_fileName="hello-world.json"
        app:lottie_loop="true"
        app:lottie_autoPlay="true" />

3.代码中:

LottieAnimationView animationView = (LottieAnimationView) findViewById(R.id.animation_view);
animationView.setAnimation("hello-world.json");
animationView.loop(true);
animationView.playAnimation();
这样就最简单的实现了一个AE动画在安卓中的显示。更多代码 看github:https://github.com/airbnb/lottie-android


利用插件制作安卓动画