Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between getAnimatedValue() and getAnimatedFraction()

Could anyone tell me the difference between the two methods getAnimatedValue() and getAnimatedFraction() used in android ValueAnimator?

like image 940
Donny Dominic Avatar asked Feb 09 '23 13:02

Donny Dominic


1 Answers

Did you mean getAnimatedValue() and getAnimatedFraction()?

getAnimatedValue() returns the current value for the variable you are animating.

getAnimatedFraction() returns the value that is used for animating (it always goes from 0.0 to 1.0 basically, and the linearity of it is set by the interpolator). The animatedValue is determined through this by multiplication.

Say you want to linearly animate from 0 to 100 in 10 seconds. On the 9th second, animatedFraction is 0.9f and the animatedValue is 100*0.9f = 90.

like image 167
Tarps Avatar answered Apr 07 '23 02:04

Tarps