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.

useAnimateKeyframes to show element when in viewport

See original GitHub issue

First off, awesome project – it’s been super useful for me.

The issue: I’m trying to use useAnimateKeyframes to show an element when it comes into view. However, unlike useAnimate where startStyle is applied as an initial style, the 0% state of the keyframes isn’t applied until play is actually called.

Essentially, the behavior ends up being that the element has opacity: 1 to start, but when it gets scrolled into view (and play() is called), the element flickers for a second as the element initializes to opacity: 0 and then proceeds to animate properly to opacity: 1.

Am I just missing something or using it incorrectly? Please advise.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
guacamolicommented, May 17, 2019

Thanks for all your help!

1reaction
bluebill1049commented, May 16, 2019

hmmm, that’s something need a patch. I may change playState to play, so those probably can go away.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS3-Animate elements if visible in viewport (Page Scroll)
Use JS, and if an element is in Viewport than add a class to all that elements. That class should trigger CSS3 animations....
Read more >
Animate elements when scrolled into view with native JavaScript
In this tutorial, you'll learn how to animate elements as they are scrolled into view using native JavaScript and CSS.
Read more >
How To Check If An Element Is In The Viewport - YouTube
How to detect the entrance of an element to the viewport in order to ... How To Check If An Element Is In...
Read more >
Element.animate() - Web APIs - MDN Web Docs
You can get a list of the animations that affect an element by calling Element.getAnimations() . Syntax. animate(keyframes, options)
Read more >
Animate when scrolled into view - Benevolent Bytes Blog
Learn how to use whileInView in Framer Motion for animation in React.
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