transition은 속성을 서서히 변화시키는 속성
div {
transition: property duration [timing-function] [delay];
}
transition을 적용시킬 속성을 지정
transition-property: none | all | property | initial | inherit
transition의 총 시간을 지정(지속시간)
transition-duration: time | initial | inherit
ex) transition: font-size 2.5s; //font-size만 바꿀때
ex) transition: all 2.5s; //전부바꿀때
transition의 변화 속도를 지정(진행속도)
transition-timing-function: ease-in | ease-out | ease-in-out | cubic-bezier() | initial | inherit
transition이 몇초후에 실행되면 좋을지 설정
transition-delay: time | initial | inherit
👩💻 참고) transition: font-size 1000ms ease-out, background-color 2000ms cubic-bezier(0.8, 0.5, 0.9, -0.6) 1000ms; 이런식으로 각각의property마다 개별적으로 줄 수 있다.
CSS의 애니메이션 속성으로 동적인 효과를 만들 수 있다. (transition보다 자유도가 더 크다)
div {
animation: property duration [timing-function] [delay]
}
어떤모양에서 어떤 모양으로 변할지 정해준다.
@keyframes 애니메이션이름 {
from {
/* rules */
}
to {
/* rules */
}
0% {}
50% {}
100% {}
}
애니메이션의 총 시간,
animation-duration: time | initial | inherit
애니메이션의 진행속도를 지정
animation-timing-function : ease-in | ease-out | ease-in-out
애니메이션을 시작하기 전에 대기하는 시간(몇초뒤에동작하는지)
animation-delay: time | initial | inherit
애니메이션의 반복횟수 지정
animation-iteration-count : 정수입력 | infinite(무한반복)
animation-direction: normal | reverse | alternate | alternate-reverse | initial | inherit
ex) animation-direction: alternate;
번갈아가면서작동 (form->to로 갔다가 reverse(to -> from)갔다가)
transform 속성으로 요소를 회전하거나 확대/축소 등 형태를 변형할 수 있다.
요소를 x축, y축으로 위치시키고 싶을 때
.box{
width: 300px;
height: 300px;
transform: translate(10%, 10%);
/* width의 10%, height의 10% */
}
N배만큼 사이즈를 확대하거나 축소할 때 사용
👩💻 참고) transform: scale(x, y); : 자신의 width만큼의 x배, height의 y배
각도만큼 요소를 회전시킨다.