방명록
- infinity rotate 애니메이션 예제2022년 05월 11일 23시 32분 57초에 업로드 된 글입니다.작성자: 루루개발자
안녕하세요. 루루개발자 입니다.
이번 시간에는 css 로 특정 요소를 무한 회전시키는 애니메이션 예제를 살펴보겠습니다.
예제 코드는 다음과 같습니다.
<infinity-rotate.html>
<div class="box"> <div></div> <div></div> <div></div> <div></div> </div>
<infinity-rotate.css>
.box { width: 10px; height: 10px; display: flex; position: relative; -webkit-animation: rotating 2s linear infinite; -moz-animation: rotating 2s linear infinite; -ms-animation: rotating 2s linear infinite; -o-animation: rotating 2s linear infinite; animation: rotating 2s linear infinite; } .box > div { width: 5px; height: 5px; position: absolute; } .box > div:nth-child(1) { top: 0; left: 0; background-color: rgb(255, 0, 0); } .box > div:nth-child(2) { top: 0; right: 0; background-color: rgb(60, 212, 26); } .box > div:nth-child(3) { bottom: 0; left: 0; background-color: rgb(29, 112, 227); } .box > div:nth-child(4) { bottom: 0; right: 0; background-color: rgb(227, 29, 197); } @keyframes rotating { from { -ms-transform: rotate(0deg); -moz-transform: rotate(0deg); -webkit-transform: rotate(0deg); -o-transform: rotate(0deg); transform: rotate(0deg); } to { -ms-transform: rotate(360deg); -moz-transform: rotate(360deg); -webkit-transform: rotate(360deg); -o-transform: rotate(360deg); transform: rotate(360deg); } }
결과는 다음과 같습니다.
'CSS' 카테고리의 다른 글
CSS 가 적용되는 우선순위 (0) 2024.01.24 CSS 에서 사용하는 길이 단위 (0) 2022.10.02 ul, ol 태그에서 커스텀 마커 사용하는 방법 (1) 2022.07.05 bell shake 애니메이션 예제 (0) 2022.05.12 scrollbar (스크롤바) css (0) 2021.03.13 다음글이 없습니다.이전글이 없습니다.댓글