최근 UI/UX 트렌드인 모션 UI 에 대해 학습하며 개인 프로젝트, 실무에 사용합니다.
<motion.div>
와 같이 html 태그 앞에 motion. 을 붙여주어야 합니다.<motion.Box>
등과 같이 적용할 수 없습니다const Box = styled(motion.div)`
width: 200px;
height: 200px;
background-color: white;
border-radius: 10px;
`
animate
function App() {
return (
<Wrapper>
<Box animate={{ borderRadius: "100px" }} />
</Wrapper>
);
}
function App() {
return (
<Wrapper>
<Box transition={{ duration: 3 }} animate={{ borderRadius: "100px" }} />
</Wrapper>
);
}
ease
와 같은 스프링 효과가 달려있습니다.function App() {
return (
<Wrapper>
<Box initial={{ scale: 0 }} animate={{ scale: 1, rotateZ: 360 }} />
</Wrapper>
);
}
function App() {
return (
<Wrapper>
<Box
transition={{ type: "tween" }}
initial={{ scale: 0 }}
animate={{ scale: 1, rotateZ: 360 }}
/>
</Wrapper>
);
}
function App() {
return (
<Wrapper>
<Box
transition={{ type: "spring", stiffness: 10 }}
initial={{ scale: 0 }}
animate={{ scale: 1, rotateZ: 360 }}
/>
</Wrapper>
);
}
function App() {
return (
<Wrapper>
<Box
transition={{ type: "spring", damping: 10 }}
initial={{ scale: 0 }}
animate={{ scale: 1, rotateZ: 360 }}
/>
</Wrapper>
);
}
function App() {
return (
<Wrapper>
<Box
transition={{ type: "spring", delay: 0.5 }}
initial={{ scale: 0 }}
animate={{ scale: 1, rotateZ: 360 }}
>
</Box>
</Wrapper>
);
}
Framer Motion Docs
리액트 마스터클래스, 노마드코더