• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

css3动画属性

武飞扬头像
孙景荣
帮助1

一、动画属性

动画需要声明/创建
@keyframes 动画的名称{动画的运动方式}

二、属性

1.animation-name 动画名字
2.animation-duration 动画的运动持续时间
3.animation-timing-function 动画的运动类型
4.animation-delay 动画的延迟
5.animation-iteration-count 运动的循环次数
6.animation-direction 动画的运动方向
7.animation-play-state 控制动画的运动状态

简写方式
属性:animation
属性值: 动画的名字 动画的时间 动画的延迟 动画的次数 动画的方向

三、示例

<!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>Document</title>
    <style>
      section {
        width: 500px;
        height: 500px;
        border: 1px solid #000;
        margin: 100px auto;
        position: relative;
      }
      div {
        width: 100px;
        height: 100px;
        background: green;
        position: absolute;
        animation: divMove 3s linear infinite;
      }
      @keyframes divMove {
        0% {
          left: 0;
          top: 0;
        }
        25% {
          left: 400px;
          top: 0;
        }
        50% {
          left: 400px;
          top: 400px;
        }
        75% {
          left: 0;
          top: 400px;
        }
        100% {
          left: 0;
          top: 0;
        }
      }
      section:hover div {
        animation-play-state: paused;
      }
    </style>
  </head>
  <body>
    <section>
      <div></div>
    </section>
  </body>
</html>
学新通

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhfgijbf
系列文章
更多 icon
同类精品
更多 icon
继续加载