小编Rad*_*vic的帖子

成帧器运动新动画并退出不使用贴图

由于某种原因,我的退出和新动画不起作用。我希望每次用户单击不同的菜单链接时都会启动新的动画。我也尝试过“ animate='visible'” ,并且我也尝试过直接进行运动,但它仍然没有退出或开始新的动画。我一起使用 .map 和成帧器运动。有人可以检查一下吗?

这是代码

谢谢

const [forMapping, setForMapping] = useState(wines)

function menuHandler(index, alt) {
    setIsActive(index)
    if (alt === 'wine') {
        setForMapping(wines)
    } else if (alt === 'rakia') {
        setForMapping(rakia)
    }
}


    const variants = {
    visible: i => ({
        y: 0,
        transition: {
            duration: .7
        }
    }),
    hidden: {
        y: '40%'
    }
}


            <AnimatePresence>
                {forMapping.map((item, index) => {
                    const {
                        name,
                        description,
                        alt,
                        imageSrc,
                        price,
                        glass_price,
                        iconSrc,
                        alc
                    } = item;
                    return (
                        <motion.div
                            exit={{y: '100'}}
                            viewport={{once: true}} …
Run Code Online (Sandbox Code Playgroud)

animation next.js framer-motion

1
推荐指数
1
解决办法
3465
查看次数

标签 统计

animation ×1

framer-motion ×1

next.js ×1