CSS 애니메이션은 결합, 회전 및 번역을 통해 다양한 방식으로 요소를 변형하는 데 도움이 됩니다.
다음 예는 원형 경로에서 요소를 이동하는 방법을 보여줍니다.
예시
<!DOCTYPE html>
<html>
<head>
<style>
div {
margin: 8%;
width: 35px;
height: 35px;
border-radius: 5px;
background: red;
animation: move 3s infinite linear;
}
@keyframes move {
0% {
transform: rotate(0deg) translateX(40px) rotate(0deg);
}
100% {
transform: rotate(360deg) translateX(40px) rotate(-360deg);
}
}
</style>
</head>
<body>
<div></div>
</body>
</html> 출력
이것은 다음 결과를 생성합니다 -
