// css
@keyframes sample-ani{
0%{
transform: translate(0,0);
}
50%{
transform: translate(300px, 0);
}
100%{
transform: translate(700px, 400px);
}
}
.box{
display:flex;
align-items: center;
justify-content: center;
width:100px;
height:100px;
border: 2px solid black;
background-color: pink;
animation: sample-ani 2s linear infinite;
}
중간 상태들의 전환을 어떤 시간간격으로 진행할지 지정합니다.
.box:hover{
animation-play-state:pause
@keyframes spaceship-ani{
to{
background-position:-2550px 0;
}
}
.spaceship{
width:150px;
height:150px;
background: url('images/sprite_spaceship.png') no-repeat 0 0 /auto 150px;
animation:spaceship-ani 2s infinite steps(17);
}
📑 reference