2020/CSS

css animation @keyframes

꽃꽂이하는개발자 2020. 2. 16. 18:52
반응형
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Transformations</title>
  <style>
    .box{
      width: 100px;
      height: 100px;
      background: red;
      /*animation: 1회동작시간 함수명 동작시간(안적어주면 1회) ease-in-out;*/
      animation: 1.5s scaleAndRotateSquare infinite ease-in-out;
    }
    /*@keyframes 애니메이션을 사용할 거라는 말. @keyframes 함수명{}
    2가지 버전이 있는데 from to 를 사용해도 되고  0% 50% 100% 를 사용하여도 됩니다.*/
    /*@keyframes scaleAndRotateSquare {
      from{
      }
      to{
      }
    }*/
    @keyframes scaleAndRotateSquare {
      0%{
        transform:none;
      }
      50%{
        transform: rotate(1turn) scale(.5, .5);
        color:white;
      }
      100%{
        transform: none;
        color:blue;
      }
    }
  </style>
</head>
<body>
  <div class="box">11</div>
</body>
</html>

출처: nomad coder

반응형