美文网首页
Lottie - 简单动画

Lottie - 简单动画

作者: 文强小弟 | 来源:发表于2019-11-14 15:02 被阅读0次

https://www.cnblogs.com/lennon-wechat/p/lottie.html
https://www.jianshu.com/p/282d098cf928?utm_source=oschina-app

  1. 官网动画实例 www.lottiefiles.com
  2. AE文件预览 https://www.lottiefiles.com/preview

implementation 'com.airbnb.android:lottie:2.0.1'

<com.airbnb.lottie.LottieAnimationView
                    android:id="@+id/animation_view"
                    android:layout_width="match_parent"
                    android:layout_height="80dp"/>

将下载的aaa.json放在main/assets文件夹下

LottieAnimationView animationView = findViewById(R.id.animation_view);
        animationView.setAnimation("aaa.json");
//        animationView.loop(true);//循环播放动画,已经废弃,但是还可以使用,建议使用下面的两行代码
        animationView.setRepeatMode(LottieDrawable.REVERSE);//设置播放模式
        animationView.setRepeatCount(LottieDrawable.INFINITE);//设置重复次数
        animationView.playAnimation();

相关文章

网友评论

      本文标题:Lottie - 简单动画

      本文链接:https://www.haomeiwen.com/subject/jgolictx.html