sl133 sl133 - 1 year ago 185
Android Question

Android ObjectAnimator Start offset

I've tried looking all around google and various stack questions but can't seem to find anything similar to what I'm doing.

Basically, I just want to start a given ObjectAnimator animation at a certain offset of the animation (e.g. 30% through the animation, or 70% through the animation) rather than starting it from the beginning.

I'm not sure if I should be using a specific Interpolator or if there is a similar function to animation.setStartTime(). I've been using this guide heavily but can't seem to find anything in the API for setting the initial timeline of an animation to begin.

Maybe I need to be using keyframes? But I'm not sure how to sync up a keyframe to just start at 30% or 50% or 70% of the way through.

I just need to be pointed in the right direction, any help is appreciated.


Answer Source

The method setCurrentFraction()

Sets the position of the animation to the specified fraction.

So setting the animation to an offset of 30% could be achieved with

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download