animation-fill-mode

2020/CSS 2020. 3. 24. 12:14
반응형
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .box {
        width: 100px;
        height: 100px;
        background: blueviolet;
        margin: 10px;
        animation: move 2s 2s;
        /* 함수 실행시간 딜레이시간*/
        
        /* animation-fill-mode : 애니메이션의 전후 상태(위치)를 설정 
        none: 기존위치에서 시작하고 애니메이션 시작 위치로 이동- 동작- 기존위치에서 끝
        forwards: 기존위치 -> 애니메이션 시작위치 > 동작 > 애니메이션 끝위치에서 끝
        backwards: 애니메이션 시작위치 시작 -> 동작 -> 기존위치에서 끝
        both: 애니메이션 시작 위치에서 시작 -> 동작 -> 애니메이션 끝 위치에서 끝
        */
        animation-fill-mode: both;
        
      }
      @keyframes move {
        0% {
          transform: translate(100px, 100px);
          background: dodgerblue;
        }
        100% {
          transform: translate(300px, 100px);
          background: coral;
        }
      }
    </style>
  </head>
  <body>
    <div class="box"></div>
  </body>
</html>
반응형

'2020 > CSS' 카테고리의 다른 글

css 다단  (0) 2020.03.24
animation-play-state  (0) 2020.03.24
animation-iteration-count, animation-direction  (0) 2020.03.24
animation-timing-function  (0) 2020.03.24
@keyframes  (0) 2020.03.24
블로그 이미지

꽃꽂이하는개발자

,