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 plays itself when a state changes

See original GitHub issue

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

First I’m rendering an animation with autoplay set to false. this.options = { loop: false, autoplay: false, animationData: require("./leo_anim.json"), rendererSettings: { preserveAspectRatio: "xMidYMid slice" } };

The animation does not start which is perfect, but then I call setState() function and the animation starts playing

See the behavior here: https://codesandbox.io/s/2wk6nv3pvr

What is the expected behavior?

If the animation has autoplay set to false, then it should only start when the play function is called.

Which versions of Lottie

Both “react-lottie”: “1.0.0” & “react-lottie”: “1.1.0”

Thank you for your help!

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
chenqingspringcommented, Apr 4, 2018

Yes, I think that is a bug to be fixed. I’ll handle the logic in the wrapper.

Thanks for issuing this 😃

1reaction
gisellezeitounecommented, Apr 4, 2018

There’s another problem when setting isStopped to true. Now, when a state changes, the animation stops playing.

See: https://codesandbox.io/s/xjr104920p

The play button should start the animation on the bottom but, because it also changes a state and the animation has isStopped set to true, the animation stops immediately after playing. Contrary to what happens with the top animation that has isStopped set to false. Even though I never play this animation, it starts because the state changed

Read more comments on GitHub >

github_iconTop Results From Across the Web

animation-play-state - CSS: Cascading Style Sheets | MDN
The animation-play-state CSS property sets whether an animation is running or paused.
Read more >
PowerPoint plays animations automatically even with start on ...
Hi guys, I'm facing a weird problem with PowerPoint. I have some animations applied in one of my slides, some are set to...
Read more >
Growing game animation: State changes and pathing
State changes A state change is when a character changes from one set of animations to another by some sort of trigger. These...
Read more >
Animation Trigger playing twice - Unity Answers
try setting the transition duration to 0 on the line leading to your animation and see if that works. with short animations it...
Read more >
[Unity] - Animation not playing when using any state state in ...
Not my style of videos for this channel but I wanted to share this as it seems like this is common misconception and...
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