Wave Animation is one of the most commonly used features in Android app. You can see this animation in most of the shopping apps, music player apps, and many more. Using this Wave Animation makes the User Experience attractive. In this article, we are going to see how to implement Wave Animation in Android. A sample GIF is given below to get an idea about what we are going to do in this article.
Applications of Wave Animation
- Use for giving decorative animated effect in an Android app.
- Wave Animation is used in most of the apps on the splash screen.
- You can see this Wave animation in most of the Music Applications.
Attributes of Wave Animation
|app:mwhWaveHeight||Use to give height to the curves of the Wave.|
|app:mwhStartColor||Use to give starting color of the wave animation.|
|app:mwhCloseColor||Use to give closing color of the wave animation.|
|app:mwhGradientAngle||Use for giving angles to the curves.|
|app:mwhRunning||Use for giving Animation.|
|app:mwhVelocity||Use for displaying Velocity.|
|app:mwhProgress||Use for displaying the progress.|
|app:mwhWaves||Use for displaying multiple waves.|
Step by Step Implementation
Step 1: Create a New Project
To create a new project in Android Studio please refer to How to Create/Start a New Project in Android Studio.
Step 2: Add dependency of Wave Animation library in build.gradle file
Then Navigate to gradle scripts and then to build.gradle(Module) level. Add below line in build.gradle file in the dependencies section.
now click on Sync now it will sync your all files in build.gradle().
Step 3: Create a new Wave Animation in your activity_main.xml file
Navigate to the app > res > layout to open the activity_main.xml file. Below is the code for the activity_main.xml file.
Now click on the run option it will take some time to build Gradle. After that, you will get output on your device as given below.