I want to playing reverse animation after cancel animation.
Instead of using Handler and LottieAnimView.setProgress(x) to reverse played time,
i want to find other ways.
ex) ValueAnimator.reverse()
I solved this issue. but I think you have to support method in LottieAnimView.
float progress = animView.getProgress();
ValueAnimator valueAnimator = ValueAnimator.ofFloat(-progress,0 ).setDuration((long) ( animView.getDuration()* progress));
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
animView.setProgress(Math.abs((float)animation.getAnimatedValue()));
}
});
valueAnimator.start();
Fixed by https://github.com/airbnb/lottie-android/commit/0ca8ad880ae565a4c67ea849b89f37b38de0cc21
Will be in 1.0.3
Could we possibly have a setSpeed(float) method and pass -1 to reverse the animation ?
@martinbonnin you got it :)
Fixed by 0ca8ad8
Will be in 1.0.3
I tried using it in 3.5.0, but I couldn't find the method to reverse the view. It seems that the method might have been removed. Passing -1 to setSpeed(float) works fine, however.
@sijanr That is the correct way to do this.
@gpeal Great! I've just started using Lottie and totally love it so far.
Most helpful comment
Could we possibly have a
setSpeed(float)method and pass-1to reverse the animation ?