【发布时间】:2021-05-11 21:05:30
【问题描述】:
我正在尝试制作一个重复的挤压气泡动画,使用成帧器运动和反应,但我无法在每次运动动画开始时都发生挤压动画。
只有在动画第一次运行时它才会起作用,但之后只有运动动画会重复,如果我尝试重复挤压动画,它就会出现故障
import React from "react";
import styled from "styled-components";
import { motion } from "framer-motion";
const Bubble = () => {
const shapeVariants = {
hidden: {
height: 450,
width: 50,
},
visible: {
height: 250,
width: 250,
transition: {
type: "spring",
bounce: 1,
stiffness: 700,
ease: "easeIn",
},
},
};
const MoveVariants = {
hidden: {
y: 1300,
},
visible: {
y: -280,
transition: {
duration: 2,
ease: "easeIn",
repeat: Infinity,
},
},
};
return (
<motion.div variants={MoveVariants} initial={"hidden"} animate={"visible"}>
<RoundDiv
onAnimationComplete={(definition) => console.log(definition)}
variants={shapeVariants}
/>
</motion.div>
);
};
const RoundDiv = styled(motion.div)`
height: 250px;
width: 250px;
background-color: #05386b;
border-radius: 50%;
`;
export default Bubble;
【问题讨论】:
标签: javascript reactjs framer-motion react-animations