当scrollTop等于500px时,我想在固定位置的div上触发动画。有没有办法在帧运动中做到这一点。只有当元素在视区中时,我才能找到解决方案。但是我的div总是在视区中,因为它有一个固定的位置。我需要一个内置的滚动位置观察器。
import { useInView } from "react-intersection-observer";
import { motion, useAnimation } from "framer-motion";发布于 2021-05-05 22:27:31
这已经有点老了,但这就是答案。
import { useViewportScroll } from "framer-motion";
const Nav = () => {
const { scrollY } = useViewportScroll();
scrolly.onChange(y => {
// y = scroll position
//Do Something
})
}
https://stackoverflow.com/questions/64239823
复制相似问题