TypechoJoeTheme

Dcr163的博客

统计

CSS3中设置动画播放时间

2017-03-23
/
0 评论
/
1,145 阅读
/
正在检测是否收录...
03/23

animation-duration主要用来设置CSS3动画播放时间,其使用方法和transition-duration类似,是用来指定元素播放动画所持续的时间长,也就是完成从0%到100%一次动画所需时间单位:S秒

语法规则

animation-duration: <time>[,<time>]*

取值<time>为数值,单位为秒,其默认值为“0”,这意味着动画周期为“0”,也就是没有动画效果(如果值为负值会被视为“0”)


例如:让元素从红色变化到绿色,整个变化过程持续5s时间。

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8">
<title>变形与动画</title>

<style>
        @keyframes changeColor {
          from {
            background: red;
          }
          to {
            background:green;
          }
        }
        div {
          width: 200px;
          height: 200px;
          background: red;
          text-align:center;
          margin: 20px auto;
          line-height: 200px;
          color: #fff;
        }
        div:hover {
          animation-name: changeColor;
          -webkit-animation-duratuib: 3s;
          -moz-animation-duration:3s;
          animatino-duration:3s;
          animation-timing-function: ease-out;
          animation-delay: .1s;
        }
</style>
</head> 
<body>
<div>Hover Me</div>

</body>
</html>

效果如图所示:
    



朗读
赞(0)
版权属于:

Dcr163的博客

本文链接:

https://www.dcr163.cn/148.html(转载时请注明本文出处及文章链接)

评论 (0)

人生倒计时

今日已经过去小时
这周已经过去
本月已经过去
今年已经过去个月

最新回复

  1. https://www.triptipedia.com/user/phmapaladnet
    2025-05-08
  2. https://Sites.google.com/view/vavada-online-casino
    2025-04-12
  3. https://x.com/jeetbuzzcom
    2025-04-07
  4. prozone.cc alternative
    2025-03-19
  5. urgent delivery
    2025-03-16

标签云