【发布时间】:2022-01-16 19:09:18
【问题描述】:
我想在组件安装时延迟映射出每个按钮的动画,而不是在悬停或单击按钮时。现在我总是得到延迟。
有什么想法吗?
<motion.button
className={distanse === place ? "aktiv" : null}
initial={{
opacity: 0,
y: -200,
rotate: 180,
}}
animate={{ opacity: 1, y: 0, rotate: 0 }}
transition={{
type: "spring",
stiffness: 150,
delay: Math.random(),
duration: 2,
}}
whileHover={{ scale: 1.3 }}
whileTap={{ scale: 0.9, rotate: 45 }}
key={i}
type="button"
value={place}
onClick={handleDistanceChange}
>
{place === "10km" ? "Mål" : place}
</motion.button>
【问题讨论】:
标签: reactjs animation framer-motion