Projects AndroidUtils Docs AnimatedColor

AnimatedColor

Type: public class

The AnimatedColor class animates a color int, to a granularity of 1/255. That is, if the difference between the target and current value is 1 or less, it will be ignored and the animation will be regarded as complete.

set

Type: public void

Set the current value to be drawn.

Parameter Name Description
value The current value.

setDefault

Type: public void

Set the default value to return to.

Parameter Name Description
defaultValue The default value.

setCurrent

Type: public void

Set the current (and target) value.

Parameter Name Description
value The current value.

val

Type: @ColorInt public int

Get the current value to be drawn.

Returned Value: The current value.

nextVal

Type: @ColorInt public int

Get the next value about to be drawn, without setting the current value to it.

Returned Value: The next value.

nextVal

Type: @ColorInt public int

Get the next value about to be drawn, without setting the current value to it.

Parameter Name Description
duration The duration, in milliseconds, that the animation should take.

Returned Value: The next value.

nextVal

Type: @ColorInt public int

Get the next value about to be drawn, without setting the current value to it.

Parameter Name Description
start The time at which the animation started, in milliseconds.
duration The duration, in milliseconds, that the animation should take.

Returned Value: The next value.

getTarget

Type: @ColorInt public int

Get the target value that is currently being animated to.

Returned Value: The target value.

getDefault

Type: @ColorInt public int

Get the default value that the animation should return to.

Returned Value: The default value.

isTarget

Type: public boolean

Determine if the target value has been drawn (implying that the animation is complete).

Returned Value: True if the target value has supposedly been drawn.

isDefault

Type: public boolean

Determine if the default value has been drawn.

Returned Value: True if the default value has supposedly been drawn.

isTargetDefault

Type: public boolean

Determine if the default value has been set AND is the current target.

Returned Value: True if the default value is the current target.

toDefault

Type: public void

Animate to the default value.

to

Type: public void

Set the value to be animated towards.

Parameter Name Description
value The target value.

next

Type: public void

Update the current value.

Parameter Name Description
animate Whether to animate the change.

next

Type: public void

Update the current value.

Parameter Name Description
animate Whether to animate the change.
duration The duration, in milliseconds, to animate across.