Animation
: 요소에 적용되는 CSS 스타일 다른 CSS 스타일로 부드럽게 전환시켜주는 것을 말한다. 이때 CSS 스타일 이 변화되는 중간 지점을 Keyframe이라고 말하며, @keyframes은 애니메이션의 중간 상태라고 할 수 있다. 애니메이션은 트랜지션보다 훨씬 더 규모가 크고 복잡하며, 다양한 능력을 가지고 있기 때문에 좀 더 정밀한 효과를 구현할 수 있다.
참고 사이트 : CoolCSSAnimation
Keyframes 정의하기
@keyframes으로 애니메이션을 정의할 수 있다.
📌 from (시작) ~to (끝) 를 잉용한 애니메이션 shape 생성
:
@keyframes shape {
from{
border: 1px solid transparent;
}
to {
border: 1px soild black;
border-radius: 50%;
}
}
📌 from ~ n% ~ to 를 이용한 애니메이션 생성
Animation 속성
animation-name : 애니메이션의 중간 상태를 지정하기 위한 이름을 정의한다. @keryframes 규칙을 이용하여 기술한다.
animation-name: shape;
... @keyframes shape
animation -duration : 지속시간
animation-delay : 지연시간
animation-iteration-count : 반복횟수. 만약 infinite로 설정하면 무한 반복한다.
animation-play-state : 멈추거나 다시 시작할 수 있다.
animation-timing-function : 중간 상태들의 전환을 어떤 시간간격으로 진행할지 지정한다.
animation-fill-mode : 애니메이션이 시작되기 전이나 끝나고 난 후 어떤 값이 적용될지 지정한다.
단일 속성으로 단축해서 사용할 수 있다.
ex) rotate 애니메이션, background 애니메이션 동시에 실행
animation: rotate 1.5s infinte, background 1.5s infinite alternate;
Loading Animation _ Full Code Example
'CSS' 카테고리의 다른 글
Flex Box (1) | 2024.01.25 |
---|---|
Responsive Web 반응형 웹 | Viewport | 미디어 쿼리 (0) | 2024.01.25 |
Transform, Transition (0) | 2024.01.25 |
Pseudo Class & Element (0) | 2024.01.24 |
Background (0) | 2024.01.24 |
댓글