CSS3动画 ☞ animation-time-function ☞ step属性

CSS3动画 ☞ animation-time-function ☞ step属性

动画属性

  • animation-name: 给动画起的名字,在定义动画帧@keyframes时用
  • animation-duration:动画执行时间
  • animation-timing-function:动画帧执行函数,可以指定两个帧之间的过渡方式
    linear|ease|ease-in|ease-out|ease-in-out|step-start|step-end|steps(int,start|end)|cubic-bezier(n,n,n,n)|initial|inherit
  • animation-delay:延迟动画执行时间
  • animation-iteration-count:动画执行次数,infinite:无限次
  • animation-direction:执行方向
  • animation-fill-mode:none|forwards|backwards|both|initial|inherit
  • animation-play-state:指定动画状态,paused | running | initial | inherit

概念(step(n, start/end))

  • w3schools上的介绍:
    The first parameter specifies the number of intervals in the function. It must be a positive integer (greater than 0). The second parameter, which is optional, is either the value “start” or “end”, and specifies the point at which the change of values occur within the interval.

    自己的理解(还不是完全理解o(╯□╰)o):指定执行的帧的数量,大概意思就是有两个帧,将这两个帧之间的间隔平均分成n段去执行,start/end指定是跳跃到帧的开始还是帧的结尾,且这个step属性只针对每两个帧之间,而不是动画全过程。

  • demo

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="UTF-8"/>
    <title>Document</title>
    <style>
      .bird {
          min-width: 91px;
          min-height: 91px;
          position: absolute;
          left: 20px;
          Top: 50px;
          background: #fee url(images/step-anim/steps-test.png);
      }
    
     .birdFly {
         -moz-animation: bird-slow 2000ms steps(3, start) infinite;
         -webkit-animation: bird-slow 2000ms steps(3, start) infinite;
     }
    
     @keyframes bird-slow {
         0% {background-position-x: -0px;}
         // 分割成三帧执行 step(3, start)
         100% {background-position-x: -273px;}
     }
    </style>
    </head>
    <body>
    使用step属性实现帧动画
      <div class="bird birdFly"></div>
    </body>
    </html>
    

没啥内容,做个小记录,小笔记,嘿嘿- - !不知道咋让运行结果的动画搞成图片弄上来,不知道有没有能在线编辑demo同时出效果的网站^_^!

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

若叶岂知秋vip

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值