sceneform-android icon indicating copy to clipboard operation
sceneform-android copied to clipboard

Displaying last animation frame

Open ninjz opened this issue 3 years ago • 0 comments

I'm trying to display the last frame of an animation by seeking to the end of the animation to be able to display the end state.

This is a snippet from my code where I'm trying to achieve this:

public void displayLastFrame(String animationName) {
        ObjectAnimator animation = characterModel.getRenderableInstance().animate(animationName);
        long duration = animation.getDuration();

        animation.setRepeatCount(0);
        animation.setCurrentPlayTime(duration - 1);
        animation.start();
}

It seems to work sporadically; perfectly at times and failing randomly for the same animation and you can see the animation is still at the beginning.

Any idea why this is not working as expected? Or is there an alternative way I can achieve this behavior?

ninjz avatar Apr 11 '22 09:04 ninjz