()
| 149 | let [start, end] = animationRange.split(' ').map(v => parseInt(v, 10)); |
| 150 | let animations = ref.current.getAnimations({subtree: true}); |
| 151 | let onScroll = () => { |
| 152 | // Calculate animation time based on percentage of animationRange * duration. |
| 153 | let time = Math.max(0, Math.min(end, window.scrollY - start) / (end - start)) * 1000; |
| 154 | for (let animation of animations) { |
| 155 | animation.currentTime = time; |
| 156 | } |
| 157 | }; |
| 158 | |
| 159 | window.addEventListener('scroll', onScroll, {passive: true}); |
| 160 | return () => window.removeEventListener('scroll', onScroll); |
nothing calls this directly
no outgoing calls
no test coverage detected