(*실행 화면 : mov를 gif로 변환한 이미지)
#reflow, repaint 발생
const Circle = styled.div<{ active: boolean }>`
width: 20px;
height: 20px;
border-radius: 100px;
background-color: ${BrandColor.white};
animation: ${props => (props.active ? 'toActive' : 'toInactive')} 0.4s
forwards;
@keyframes toActive {
0% {
margin-left: 0;
}
100% {
margin-left: 24px;
}
}
@keyframes toInactive {
0% {
margin-left: 24px;
}
100% {
margin-left: 0;
}
}
`;
const Circle = styled.div<{ active: boolean }>`
width: 20px;
height: 20px;
border-radius: 100px;
background-color: ${BrandColor.white};
transform-origin: left;
transform: translateX(${props => (props.active ? '24px' : 0)});
transition: transform 400ms ease;
box-shadow: ${props =>
props.active
? `-2px 2px 4px rgba(0, 0, 0, 0.15)`
: `2px 2px 4px rgba(0, 0, 0, 0.15)`};
`;