particle
This is a handy android library for particle effect.
To start with, you need to add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Then add the dependency
dependencies {
implementation 'com.github.ultimateHandsomeBoy666:Particle:0.1'
}
And add the following code:
Particles.with(context, container) // container is the parent ViewGroup for particles
.colorFromView(button)// color sampling from button
.particleNum(200)// how many particles
.anchor(button)// use button as the anchor of the animation
.shape(Shape.CIRCLE)// circle particle
.radius(2, 6)// random circle radius from 2 to 6
.anim(ParticleAnimation.EXPLOSION)// using explosion animation
.start()
you can get something like this:
You can have more particle annimations by customizing the particle motion curve. The app module in the project shows how to customize it, check it out.