androidandroid-animationviewanimator

Difference between getAnimatedValue() and getAnimatedFraction()


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


Solution

  • 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.