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.

Tell when animation is finished

See original GitHub issue

Sort of related to #100

It is OK now to check current value if you are using default spring preset. But if I am using something like wobbly and animate height, I can easily get zero height while animation is far from being finished (then it goes to negative height, but that is a different story).

So if I think that my animation is done when height equals 0 and want to unmount element, that is not actually true and on next RAF component is shown again but with a very little height. And again and again.

animation-end

I am pretty sure we had this discussion somewhere else, but could not find a separate issue for this.

I would like to see API in this way:

<Motion>
  {(style, {isFinished}) => console.log(isFinished)}
</Motion>

Passing another object to render function will not break current API, and will potentially allow us to pass more fields, not only isFinished but exposing some RM internal state (maybe related to #219)

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:26 (10 by maintainers)

github_iconTop GitHub Comments

11reactions
p4blochcommented, Sep 12, 2016

@chenglou any news on when/if this will be implemented in TransitionMotion? I think that would keep consistency in the API and allow to have an easy, clean way to use that functionality (all I tried to use this with current implementation feels hacky).

If there’s request for such cb for StaggeredMotion and TransitionMotion we should reopen this issue or create a new one.

Not sure if this is the proper way to make a formal request, but I think this could be pushed forward. Any thoughts?

Thanks!

7reactions
chengloucommented, Apr 20, 2016

Alright so end callback is in for Motion (react-motion v0.4.3). If there’s request for such cb for StaggeredMotion and TransitionMotion we should reopen this issue or create a new one.

Sorry for the wait everyone! And thank you again @appsforartists for actually implementing it =].

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I check if an animation is playing or has finished ...
To know if Animator is playing any animation: bool AnimatorIsPlaying(){; return animator.
Read more >
Unity: detect animation's end
I need a way to detect if animation's clip finished playing and then execute a certain code. Here's some script, that I wrote...
Read more >
How to know if animation has finished completely?
If you want to check when your animation has finished playing entirely, definitively use animationTrack.Stopped:Wait(). Oficcer_F (Oficcer_F) ...
Read more >
Element: animationend event - Web APIs | MDN
The animationend event is fired when a CSS Animation has completed. If the animation aborts before reaching completion, such as if the ...
Read more >
Angular, how do you detect when an animation finishes?
The 2nd event is the one that occurs when your fade-in-up animation actually completes (because it's reached your final state of 'in' ),...
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