Animations in Android (lottie aftereffect library)


hey friends in this blog I will tell you about an aftereffect library for Animation 
I have worked a decent amount of time in making custom loader and animation and to implement to it in this blog I will talk you about a library which helps me a lot on animation and make it simple to do animation in Android, IOS, Web without so much hard work.
                                       first of all click on the link -ClickMe

Above link is for Lottie official Github page you can read more about it in the above link.
The process to implement it-

1. Migrate your project to AndroidX if you are working with an old project or old version of Android Studio.

2. Add below lines o your app-level Gradle file.

3. After that right-click on res and choose show in explorer option and create the new folder name
assets

5. Now go on this link -ClickMe

6.choose what animation you want to show and download the JSON file of animation.

7.keep downloaded JSON file in the asset folder and then make a layout like below

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/splash"
tools:context=".Splash">
<ImageView
android:layout_width="190dp"
android:layout_height="60dp" app:srcCompat="@drawable/logo"
android:id="@+id/imageView" android:layout_marginTop="256dp"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"/>
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/animationView"
android:layout_width="180dp"
android:layout_height="40dp"
app:lottie_autoPlay="true"
app:lottie_fileName="stars.json"
android:foregroundGravity="center"
app:lottie_loop="true" android:layout_marginTop="25dp"
app:layout_constraintTop_toBottomOf="@+id/imageView" android:layout_marginEnd="8dp"
app:layout_constraintEnd_toEndOf="parent" android:layout_marginStart="8dp"
app:layout_constraintStart_toStartOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
8. Now if you make auto-play true animation will repeat.

if you have any problem in this you can download full Source Code from below link.



                                                  Source Code-ClickMe










Post a Comment

0 Comments