IntersectionObserver to pause/play animations
See original GitHub issueParticles animation can affect website performance and a good improvement could be detecting if particles container is visible on the screen
I’ve thought about Intersection Observer API to check this but some browsers can’t use this feature so a check of the API availability is needed.
This could interact with the existing pauseOnBlur
property (that pauses animations when the window loses its focus) or a new one can be used, personally I prefer the first solution.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (8 by maintainers)
Top Results From Across the Web
How to auto play/pause videos like Netflix | by Akash Thakur
First can be achieved by intersection observer API and the second with page visibility API. Let's look at the implementation below.
Read more >Play/pause CSS animations with IntersectionObserver
In this demo, all CSS animations are paused by default. Scroll (slowly!) downwards, and watch the info-bar at the bottom. An element will...
Read more >Minimize browser repainting: Simplest code for intersection in ...
var observer = new IntersectionObserver(function(entries, observer) { entries.forEach(function(entry) { // Pause/Play the animation if ...
Read more >How To Implement React “useInView” Custom Hook
Intersection Observer, animations, and multiple refs ... pause/play a video when it is exiting/entering the view; count how many times an ...
Read more >Quick look into the Intersection Observer API - Notificare
Auto-Pause Videos. Another common use case for the IntersectionObserver would be to pause/play a video whenever that element is visible or ...
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 Free
Top 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
Issue-Label Bot is automatically applying the label
feature_request
to this issue, with a confidence of 0.96. Please mark this comment with 👍 or 👎 to give our bot feedback!Links: app homepage, dashboard and code for this bot.
I created a pull request that implements what we have talked about #942. Preview here: