Transform
특정 요소에 효과를 적용
CSS 요소를 회전, 크기 조정, 기울이기 등 변화
test1:hover
Transition
특정 요소에 특정한 조건에 해당될 때
CSS 값이 변할 때(특정 조건 = 트리거) 특정한 효과를 적용
div:hover
Animation
특정한 조건 없이 효과를 적용
Transition 처럼 변경하지만, 보다 여러가지의 종류로 다양하게 변화 가능
+시작 정지 반복까지 제어 가능
test2:hover{} @keyframes{}
<style> .transtition { transform: rotate(45deg); / 회전 / transform: scale(2, 3); / 확대, 축소 / transform: skew(10deg, 20deg) / 각도 변경 / transform: translate(100px, 200px) / 위치 변경 / } <style>
<style> -webkit-tranform: translate(1oopx, 200px); / 크롬, 사파리 / -moz-tranform: translate(1oopx, 200px); / 파이어폭스 / -ms-tranform: translate(1oopx, 200px); / 익스플로러 9.0 / -o-tranform: translate(1oopx, 200px); / 오페라 /
<style> .transition { transition-property: width; transition-duration: 2s; transition-timing-function: linear; transition-delay: 1s; } <style>
<style> .transition:hover { width: 300px; } </style>
정리
<style> .transition { transition: width 2s linear 1s; } .transition:hover { width: 300px; } </style>
<style> .animation { animation-name: changeWidth; / 임의로 작성 / animation-duration: 3s; animation-timing-function: linear; animation-delay: 1s; animation-iteration-count: 6s; animation-direction: alternate; } @keyframes changeWidth { from { width: 300px; } to { width: 600px; } </style>
한 줄로 작성 ( 숫자는 'duration - delay' 순 )
<style> .animation: changeWidth 3s linear 1s 6 alternate; </style>
<style> .box { -webkit-animation: rotation 3s linear 1s 6 alternate; } @-webkit-keyframes rotation { from {-webkit-transform: rotate(10deg); } to {-webkit-transform: rotate(10deg); } </style>