question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is executing animation with fail

See original GitHub issue

Version: 2.0.0-beta4 I’m changing animation with same lotties

1 - lottie1.json (2 seconds) 2 - lottie2.json (2 seconds) 3 - lottie3.json (2 seconds)

When I change lottie1 to lottie2, the second lottie is executing by 1 seconds or some times don’t executing I did have this problem with queue animation in view, because this android don’t delete this animation in some devices causing conflicts bettween them

I used this code for correct this problem, for after change animation in another components that I worked

@Override
public void onAnimationEnd(Animator animation) {
        removeQueueAnimator();
        onEnd();
}

@Override
public void onAnimationCancel(Animator animation) {
        removeQueueAnimator();
        onCancel();
}

private void removeQueueAnimator() {
        view.clearAnimation();
        view.animate().setListener(null);
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13

github_iconTop GitHub Comments

2reactions
franrccommented, Aug 11, 2017

Hi, I had the same problem, it seems that the setAnimation takes some time for load the json. My solution is to add a short timer before launching the animation :

lottieView.setAnimation("lottie1.json");
lottieView.playAnimation();
lottieView.addAnimatorListener(new Animator.AnimatorListener() {
            @Override
            public void onAnimationStart(Animator animator) {
                
            }

            @Override
            public void onAnimationEnd(Animator animator) {
                lottieView.pauseAnimation();
                lottieView.setAnimation("lottie2.json");//only showed this first frame

                new Handler().postDelayed(new Runnable() {
                     @Override
                     public void run() {
                          lottieView.playAnimation();
                    }
                 }, 300);
            }

            @Override
            public void onAnimationCancel(Animator animator) {

            }

            @Override
            public void onAnimationRepeat(Animator animator) {

            }
        });

Hope it helps.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What are various reasons why UIView.animate() would fail to ...
Here are the reasons that I can think of: 1- You can check your device settings General-> Accessibility-> Vision-> Reduce Motion.
Read more >
Executing UX Animations: Duration and Motion Characteristics
The speed of an animation is hugely important for the usability — too fast, and it's hard to see or dizzying; too slow,...
Read more >
animation-fill-mode - CSS: Cascading Style Sheets | MDN
The animation-fill-mode CSS property sets how a CSS animation applies styles to its target before and after its execution.
Read more >
animation error - Forums - IBM Support
When i execute my configuration it is executing well,but i am not able to run the executable.When i click on run executable button...
Read more >
.animate() | jQuery API Documentation
If supplied, the start , step , progress , complete , done , fail , and always callbacks are called on a per-element...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found