implementation 'com.francescozoccheddu.animatorhelpers:AnimatorHelpers:0.1'
Setup
var myAnimatedFloat by ABFloat(0f).apply {
onUpdate = {
println("myAnimatedFloat=$it")
}
speed = 3f
}
Change value
myAnimatedFloat = 8f
Setup
val myAnimatedColor = ABColor(Color.RED).apply {
onUpdate = {
println("myAnimatedColor=#${Integer.toHexString(it)}")
}
duration = 0.5f
}
Change value
myAnimatedColor.value = Color.YELLOW
AnimatedValue
UnanimatedValue
TargetedValue
ABValue
ABColor
ABFloat
ABInt
SmoothValue
SmoothColor
SmoothFloat
SmoothInt
SpringValue
SpringColor
SpringFloat
SpringInt
Base class
value
:Type
get
animated value /set
target valuerunning
:Boolean
get
whether animation is running or finishedonUpdate
:((ReadOnlyObservableAnimatedValue<Type>) -> Unit)?
get
/set
value update callbackreach()
:Unit
end animation and instantly jump to target value
Animated value with target
target
:Type
get
target value (set
byvalue
property)
Android ValueAnimator
wrapper
Use it for transitions or uninterruptible animations
interpolator
:TimeInterpolator
get
/set
value easingdurationMode
:ABValue.DurationMode
get
duration mode (set
byspeed
orduration
properties)duration
:Float
get
/set
constant animation duration (seconds)speed
:Float
get
/set
constant animation speed (amount per second)
Continuous exponential animator
Use it for continuously changing target values (eg. to smooth touch drag gestures)
smoothness
:Float
get
/set
smoothness amount (0.2f
is a reasonable value)
Continuous spring animator
Use it for frequently changing target values (eg. to programmatically move on screen objects)
acceleration
:Float
get
/set
acceleration amount (velocity increment per second)maxVelocity
:Float
get
/set
velocity limit (amount per second)