ColorAnimator
ColorAnimator is a color transition animation library for android
|firstColor|----delayTime----|transitToSecondColor|----delayTime----|transitToThirdColor| ...
Setup
Step #1. Add the JitPack repository to root build.gradle file:
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
Step #2. Add the dependency
dependencies {
implementation 'com.github.RezaKardoost:ColorAnimator:v1.1'
}
Implementation
var ca: ColorAnimator? = null
//colors array.add any colors you want
val colors = arrayOf(Color.parseColor("#8adcd3")
,Color.parseColor("#74b9ff")
,Color.parseColor("#a29bfe"))
...
//onCreateView
ca = ColorAnimator.Builder(colors)
.setAnimationDuration(5000)
.setDelayDuration(10000)
.setRepeatMode(true)//default:false
.addColorUpdateListener(object : ColorAnimator.ColorAnimatorUpdateListener{
override fun onColorUpdate(color: Int) {
//change your view's textColor or backgroundColor or ...
}
})
.build()
ca?.start()
...
//onPause
ca?.pause()
...
//onResume
ca?.resume()