| animation | |
|---|---|
| animation-name | @keyframes 애니메이션 이름 지정 |
| animation-duration | 한 주기를 완료하는데 걸리는 시간 |
| anumation-timing-function | 애니메이션의 속도 곡선 |
| animation-delay | 애니메이션 시작 지연 |
| animation-iteration | 재생 횟수 |
| animation-direction | 애니메이션 앞으로, 뒤로. 번갈아가며 |
| animation | 모든 애니메이션 속성을 설정하기 위한 약식 속성 |
animation-direction
| 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>Document</title>
<style>
div {
width: 100px;
height: 100px;
background-color: red;
position: relative;
animation: name 5s linear infinite alternate;
}
@keyframes name {
0% {
background-color: lightblue;
left: 0px;
top: 0px;
}
25% {
background-color: lightcoral;
left: 150px;
top: 0px;
}
50% {
background-color: lightcyan;
left: 150px;
top: 150px;
}
75% {
background-color: lightgray;
left: 0px;
top: 150px;
}
100% {
background-color: lightcoral;
left: 0px;
top: 0px;
}
}
</style>
</head>
<body>
<div></div>
</body>
</html>