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.

Animation takes a long time to appear

See original GitHub issue

I’m trying to show the lottie animation on my splash screen. Below is the code for my SplashActivity. I’m adding delay of 2.5 secs to display the splash and firing an intent to MainActivity after this. But still no animations shows up till 2.5 secs. It just shows white screen. I added 5 secs then it shows up. But I don’t want to do like this. I just want to show the animation in 1 sec.

super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
LottieAnimationView lottieAnimationView = findViewById(R.id.lottie_animation);
lottieAnimationView.setAnimation("animation.json");
lottieAnimationView.playAnimation();
lottieAnimationView.loop(true);

Handler mHandler = new Handler(Looper.getMainLooper());
mHandler.postDelayed(() -> {
 Intent intent = new Intent(SplashActivity.this, MainActivity.class);
 intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
 startActivity(intent);
}, 1500);`

What to do here ?

@gpeal

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gpealcommented, Feb 1, 2019

@saketkumar For subsequent launches, you warn the cache just by using the LottieCompositionFactory methods with a cache key. The next time you call it, it’ll just return the pre-parsed composition.

0reactions
divyansh169commented, Sep 4, 2022

I also ran into the same situation but able to fix it. First make the lottie animation visible to true in the XML file then just your work will be done. PS: don’t include any other code of lottie animation in corresponding Java file. All this will lead to showing animation on the splash screen as soon as it is launched till the activity get changed after delayed amount of time

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why Does Animation Take So Long? | Video Production Bristol
There are a few reasons why animation still takes a long time to create, but we can argue that animation has become faster...
Read more >
Why animations take a long time? Is there a way to use ...
Animation is hard, that's why it takes so long. Technology is already making it easier to make high-quality animation in shorter amounts of...
Read more >
Why are some animations slow? - web.dev
Animating well is core to a great web experience. This post explains why certain types of animation perform better than others.
Read more >
Set the start time and speed of an animation effect
To run your animation effect at a faster or slower pace, change the Duration setting. On the slide, click the text or object...
Read more >
animation-delay - CSS: Cascading Style Sheets | MDN
The animation-delay CSS property specifies the amount of time to wait from applying the animation to an element before beginning to perform ...
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