▣ animation-direction 속성값의 종류
속성값 | 설명 |
normal | 기본 설정값이다. 애니메이션이 순방향으로 재생된다. |
reverse | 애니메이션이 역방향으로 재생된다. |
alternate | 애니메이션이 양방향으로 재생된다. - 홀수 : 순방향으로 재생된다. - 짝수 : 역방향으로 재생된다. |
alternate-reverse | 애니메이션이 양방향으로 재생된다. - 홀수 : 역방향으로 재생된다. - 짝수 : 순방향으로 재생된다. |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>애니메이션의 진행 방향 설정하기</title>
<style>
div {
width: 100px;
height: 100px;
background-color: red;
color: white;
position: relative;
animation: boxmove 5s linear infinite;
}
#box1 {
animation-delay: 3s;
animation-direction: reverse;
}
#box2 {
animation-delay: 5s;
animation-direction: alternate-reverse;
}
@keyframes boxmove {
from {
left: 0px;
}
to {
left: 300px;
}
}
</style>
</head>
<body>
<div id="box1">애니메이션 박스 1</div>
<div id="box2">애니메이션 박스 2</div>
<p><strong>참고 : </strong>IE9 이하 혹은 낮은 버전에서는 지원하지 않습니다. </p>
</body>
</html>