Animation steps
Concepts
애니메이션을 smooth 하게 움직이는 요소를 보여주는 것이 아니라, 단계별로 딱딱 끊어서 표현하고 싶을 때 사용한다.
Demo
Source Code
Markup
import './index.css'
function Animation() {
return (
<div style={{marginLeft: '30px'}}>
<h1>Animation</h1>
<div className={'circle'}>
<div className={'second'}/>
<div className={'center'}/>
</div>
</div>)
}
export default Animation;
CSS
.circle {
position: relative;
border: 1px solid black;
border-radius: 50%;
width: 150px;
height: 150px;
display: flex;
align-items: center;
justify-content: center;
}
@keyframes seco {
to {
transform: rotate(360deg);
}
}
.center {
width: 15px;
height: 15px;
border-radius: 50%;
background-color: dodgerblue;
z-index: 2;
}
.second {
position: absolute;
left: 75px;
top: 75px;
width: 60px;
border: 1px solid black;
animation: seco 60s steps(60) infinite;
transform-origin: left;
}