解析AndroidProject 啓動閃屏頁動畫 lottie json動畫 Lottie的json動畫

  • 參考博文

   Lottie的json動畫

   AE製作Json動畫教程

  • 效果演示  

  

 

  • 實現方式(需要引入依賴)

splash_activity.xml
    <com.airbnb.lottie.LottieAnimationView
        android:id="@+id/lav_splash_lottie"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginBottom="40dp"
        app:lottie_autoPlay="true"  //是否自動播放
        app:lottie_loop="false"     //是否循環播放
        app:lottie_rawRes="@raw/welcome" />

 

動畫資源 @raw/welcome

  

 

 ⭐是一個json動畫,內容(此凡胎無法識別)

  

 

  • 引入依賴

   // 動畫解析庫:https://github.com/airbnb/lottie-android
    // 動畫資源:https://lottiefiles.comhttps://icons8.com/animated-icons
    implementation 'com.airbnb.android:lottie:3.6.1'
  • 動畫監聽

⭐啓動頁在動畫播放結束之後,將進行跳轉頁面

        mLottieView.addAnimatorListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                mLottieView.removeAnimatorListener(this);
                //HomeActivity.start(getContext()); //Intent跳轉
                finish();
            }
        });

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章