css动画-animations

css animations 使从一个css样式转换为另一个样式。 一般动画都是由@keyframes实现

animation子属性

animation-delay  设置延时

animation-direction 设置动画运行后,反向还是重新运行  alternate 来回动画

animaton-duration 一个周期的时长

animation-iteration-count  设定动画重复次数    infinite重复

animation-name   指定@keyframes 描述关键帧的名称

@keyframes 规则

  

    @keyframes slidein {
      from{
        margin-left: 100%;
        width: 100%;
      }

      to{
        margin-left: 0;
        width: 100%;
      }
    }

常用类型是:

@keyframes identifier {
      0%{
        top:0;
        left: 0;
      }
      30%{
        top:50px;
      }
      68%, 72%{
        left: 50px;
      }
      100%{
        top:100px;
        left:100%;
      }
    }

animation 属性简写  依次排列

animation-name

animation-duration

animation- timing-function

animation-delay

animation- iteration-count

animation-diraction

一般前三个就可以了!

animation- timing-function 属性

linear速度从头到尾一样

ease 默认  低速开始  在加速 在降速

ease-in-out 低速开始和结束

cubic-bezier(n,n,n,n)自己设定

animation-iteration-count 播放次数

n 直接定义数字

infinite 无限播放 

 

实例

p{
      position: relative;
      width: 100px;
      border: 1px solid #000;
      animation: fly 2s ease 1s infinite alternate;
    }
    @keyframes fly {
      0%{
        width: 100px;
        left: 100%;
      }
      50%{
        width: 150px;
        left: 50%;
      }
      100%{
        width: 100px;
        left: 0;
      }
    }

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值