十五.动画

1.animation
animation:动画名称 时间 速度曲线 延迟时间 播放次数 是否循环播放
2.关键帧
@keyframes 动画名 {
时间点1{
css属性:属性值;
}


注意之间无符号

时间点1{
css属性:属性值;
}
}

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }
    .demo {
      position: absolute;
      top: 0;
      left: 0;
      width: 100px;
      height: 100px;
      background-color: lightgreen;
      animation: move 2s ease-in-out infinite alternate;
    }

    /* 关键帧 */
    @keyframes move {
      0% {
        top: 0;
        left: 0;
      }
      /* 25% {
        top: 0;
        left: 500px;
      }

      50% {
        top: 300px;
        left: 500px;
      }

      75% {
        top: 300px;
        left: 0;
      } */
      100% {
        top: 0;
        left: 600px;
      }
    }
  </style>
</head>
<body>
  <div class="demo"></div>
</body>
</html>

 

posted @ 2021-03-13 10:35  faval  阅读(23)  评论(0)    收藏  举报