css3 animation(动画)属性

css3   animation(动画)属性



1.animation: name duration timing-function delay iteration-count direction fill-mode play-state(所有属性集合)
2.animation-name属性值:绑定动画名(@keyframes名)
3.animation-duration属性值:time。(5s)

4.animation-timing-function属性值: 

  • linear--------速度均匀(默认)
  • ease-------低速加快变慢
  • ease-in-------低速开始
  • ease-out--------低速结束
  • ease-in-out-------低速开始结束
  • cubic-bezier(n,n,n,n)-------0-1数值自己定义
5.animation-delay属性值:time。(5s)

6.animation-iteration-count属性值:

  • n-------次数(默认1次)
  • infinite-------无限(永远)

7.animation-direction属性值:

  • normal-------正常播放
  • reverse-------反向播放
  • alternate-------奇数次正向播,偶数次反向播
  • alternate-reverse-------奇数次反向播,偶数次正向播
  • initia-------默认属性
  • inherit-------从父级继承 

8.animation-play-state属性值:

  • paused-------暂停
  • running-------正在运行

 配合@keyframes使用

语法如下



//1.也可以写成这样
@keyframes mymove
{
   from { top: 0px ;}
   to { top: 200px ;}
}


//2.也可以写成这样
@keyframes mymove
{
   0% { top: 0px ;}
   25% { top: 200px ;}
   50% { top: 100px ;}
   75% { top: 200px ;}
   100% { top: 0px ;}
}


小例子:(以改变宽度为例)

.div1 {
     width: 20px ;
     height: 20px ;
     margin: 100px auto ;
     background: #ccc ;
   animation: mymove 5s ;

  
    
  }

/* 规定动画。 */
@keyframes mymove
{
   0% { width: 20px ;}
   25% { width: 200px ;}
   50% { width: 100px ;}
   75% { width: 200px ;}
   100% { width: 20px ;}
}


  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值