useAnimateKeyframes to show element when in viewport
See original GitHub issueFirst 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:
- Created 4 years ago
- Comments:15 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for all your help!
hmmm, that’s something need a patch. I may change
playState
toplay
, so those probably can go away.