본문 바로가기
Reference/CSS

animation-timing-function 속성은 애니메이션 움직임의 속도를 설정합니다.

by @webstoryboy 2022. 11. 3.

animation-timing-function 속성은 애니메이션 움직임의 속도를 설정합니다.

Reference/CSS

animation-timing-function 속성은 애니메이션 움직임의 속도를 설정합니다.

by @webs 2022. 7. 4.

animation-timing-function

animation-timing-function 속성은 애니메이션 움직임의 속도를 설정합니다. 애니메이션은 움직임 시간, 움직임 지연 시간, 움직임 방향, 움직임 속도, 움직임 진행상태, 움직임 반복 횟수, 움직임 진행상태, 움직임 속도, 키프레임 이름 등을 설정하여 원하는 애니메이션을 구현 할 수 있습니다.


특징 설명
기본값 animation-timing-function : linear;
적용 animation
버전 CSS3
사용성 ★★★★★

정의(Definition)

  • animation-timing-function 속성은 애니메이션 움직임의 속도를 설정합니다.
  • animation-timing-function 속성은 애니메이션 움직임의 속도를 건너뛰기로 설정할 수 있습니다.
  • animation-timing-function 속성은 애니메이션 움직임의 속도를 큐빅 베지어 곡선값으로 설정할 수 있습니다.

애니메이션과 관련된 속성(Animation Related Properties)

  • animation 속성은 애니메이션과 관련된 속성을 일괄적으로 설정합니다.
  • animation-delay 속성은 애니메이션 지연 시간을 설정합니다.
  • animation-direction 속성은 애니메이션 움직임 방향을 설정합니다.
  • animation-duration 속성은 애니메이션 움직임 시간을 설정합니다.
  • animation-fill-mode 속성은 애니메이션이 끝난 후의 상태를 설정합니다.
  • animation-iteration-count 속성은 애니메이션 반복 횟수를 설정합니다.
  • animation-name 속성은 애니메이션 keyframe 이름을 설정합니다.
  • animation-play-state 속성은 애니메이션 진행상태를 설정합니다.
  • animation-timing-function 속성은 애니메이션 움직임의 속도를 설정합니다.

문법(Syntax)

animation-timing-function : linear | ease | ease-in | ease-out | ease-in-out | step-start | step-end | steps(int,start|end) | cubic-bezier(n,n,n,n) | inherit;

/* 기본 애니메이션 */
animation-timing-function : linear;
animation-timing-function : ease;
animation-timing-function : ease-in;
animation-timing-function : ease-out;
animation-timing-function : ease-in-out;
animation-timing-function : step-start;
animation-timing-function : step-end;
animation-timing-function : steps(int,start|end);
animation-timing-function : cubic-bezier(n,n,n,n);
animation-timing-function : inherit;

속성(Property)

속성값 값(예) 설명
linear animation-timing-function : linear; 처음 속도와 마지막 속도가 일정합니다.
ease animation-timing-function : ease; 처음엔 천천히 시작하여 빨라지고 마지막에 다시 느려집니다.
ease-in animation-timing-function : ease-in; 천천히 시작되어 정상 속도가 됩니다.
ease-out animation-timing-function : ease-out; 마지막에 천천히 속도를 줄여 끝납니다.
ease-in-out animation-timing-function : ease-in-out; 천천히 시작되어 정상 속도가 되었다가 마지막에 느려집니다.
step-start animation-timing-function : step-start; 애니메이션을 시작점에서만 표현됩니다.
step-end animation-timing-function : step-end; 애니메이션을 끝점에서만 표현됩니다.
steps(int, start|end) animation-timing-function : 4 start; 애니메이션을 단계별로 설정합니다.
cubic-bezier(n,n,n,n) animation-timing-function : cubic-bezier(1, 0.01, 0.07, 0.99); 베지어 곡선값을 만들어서 속도를 설정합니다.
inherit animation-timing-function : inherit; 애니메이션 움직임을 상위 요소한테 상속받습니다.

예제1(Sample)

애니메이션 움직임의 속도를 키워드로 설정한 예제입니다.

1번 적용 효과 : animation-timing-function : linear
2번 적용 효과 : animation-timing-function : ease
3번 적용 효과 : animation-timing-function : ease-in
4번 적용 효과 : animation-timing-function : ease-out
5번 적용 효과 : animation-timing-function : ease-in-out
HTML
CSS
SCRIPT
<div class="animation-box">
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
</div>
.animation-box.a1.show .box:nth-child(1) {animation: move 2s 1 linear;}
.animation-box.a1.show .box:nth-child(2) {animation: move 2s 1 ease;}
.animation-box.a1.show .box:nth-child(3) {animation: move 2s 1 ease-in;}
.animation-box.a1.show .box:nth-child(4) {animation: move 2s 1 ease-out;}
.animation-box.a1.show .box:nth-child(5) {animation: move 2s 1 ease-in-out;}

@keyframes move {
    0%   {left: 0%;}
    50%  {left: calc(100% - 80px);}
    100% {left: 0%;}
}
//Javascript none

예제2(Sample)

애니메이션 움직임의 속도를 건너뛰기로 설정한 예제입니다.

1번 적용 효과 : animation-timing-function : step-start;
2번 적용 효과 : animation-timing-function : step-end;
3번 적용 효과 : animation-timing-function : steps(4, start);
4번 적용 효과 : animation-timing-function : steps(4, end);
5번 적용 효과 : animation-timing-function : steps(10, start);
6번 적용 효과 : animation-timing-function : steps(10, end);
HTML
CSS
SCRIPT
<div class="animation-box">
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
</div>
.animation-box.a2.show .box:nth-child(1) {animation: move 2s 1 step-start;}
.animation-box.a2.show .box:nth-child(2) {animation: move 2s 1 step-end;}
.animation-box.a2.show .box:nth-child(3) {animation: move 2s 1 steps(4, start);}
.animation-box.a2.show .box:nth-child(4) {animation: move 2s 1 steps(4, end);}
.animation-box.a2.show .box:nth-child(5) {animation: move 2s 1 steps(10, start);}
.animation-box.a2.show .box:nth-child(6) {animation: move 2s 1 steps(10, end);}

@keyframes move {
    0%   {left: 0%;}
    50%  {left: calc(100% - 80px);}
    100% {left: 0%;}
}
//Javascript none

예제3(Sample)

애니메이션 움직임의 속도를 큐빅 베지어 곡선값으로 설정한 예제입니다.

1번 적용 효과 : animation-timing-function : cubic-bezier(0,0,0,0);
2번 적용 효과 : animation-timing-function : cubic-bezier(1,0,0,1);
3번 적용 효과 : animation-timing-function : cubic-bezier(1, 0.01, 0.07, 0.99);
4번 적용 효과 : animation-timing-function : cubic-bezier(0, 0.92, 1,-0.08);
5번 적용 효과 : animation-timing-function : cubic-bezier(0.76, 0.85, 1, 0.25);
HTML
CSS
SCRIPT
<div class="animation-box">
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
</div>
.animation-box.a3.show .box:nth-child(1) {animation: move 2s 1 cubic-bezier(0,0,0,0);}
.animation-box.a3.show .box:nth-child(2) {animation: move 2s 1 cubic-bezier(1,0,0,1);}
.animation-box.a3.show .box:nth-child(3) {animation: move 2s 1 cubic-bezier(1, 0.01, 0.07, 0.99);}
.animation-box.a3.show .box:nth-child(4) {animation: move 2s 1 cubic-bezier(0, 0.92, 1,-0.08);}
.animation-box.a3.show .box:nth-child(5) {animation: move 2s 1 cubic-bezier(0.76, 0.85, 1, 0.25);}

@keyframes move {
    0%   {left: 0%;}
    50%  {left: calc(100% - 80px);}
    100% {left: 0%;}
}
//Javascript none

호환성(Compatibility)

크롬 아이콘 파이어폭스 아이콘 사파리 아이콘 오페라 아이콘 네이버 웨일 익스플로러6 아이콘6 익스플로러7 아이콘7 익스플로러8 아이콘8 익스플로러9 아이콘9 익스플로러10 아이콘10 익스플로러11 아이콘11 엣지 아이콘 안드로이드 아이콘 ios 아이콘
animation-play-state

참고(Reference)


댓글