zoukankan      html  css  js  c++  java
  • Css3关键帧动画

    @keyframes设置动画规则,可以理解为一个剧本;

      1.name动画的名字必需填写  2.可以使用百分比0%-100%或者from...to...必填内容;  3.需要变化css的样式;必需;

      animation所有动画的简写属性排序如下:

      animation-name动画的名字  / animation-duration 持续时长  / animation-timing-function规定动画的速度曲线。/

      animation-delay动画定时  /animation-iteration-count动画的运动的次数  /animation-direction属性定义是否应该轮流反向播放动画。

      animation-timing-function:规定动画的运动速度曲线。

        属性有如下几种:linear匀速进行  ease 开始低速逐渐加快结束时候再变慢

                ease-in动画以低速开始  ease-out动画以低速结束

                ease-in-out动画以低速开始和结束  cubic-bezier(n,n,n,n)在 cubic-bezier 函数中自己的值。可能的值是从 0 到 1 的数值。

      animation-direction:normal默认属性 顺序播放/alternate轮流反向播放。

      animation-iteration-count:n设置次数;infinite无限次循环播放;

      animation-play-state:默认running是正常播放  /paused暂停动画 需要结合js代码才能实现

      animation-fill-mode:定义动画结束之外的状态:none 不改变默认行为  /forwards当动画完成,保留最后一个属性值

                /backwards 定义在animation-delay中这一段时间,应用开始的属性值,在动画开始之前的状态。

                both向前和向后填充模式都被应用(意思是以上2种方法同时会被使用。)

      下面是个小实例:

        

    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>无标题文档</title>
    <link rel="stylesheet" type="text/css" href="file:///C|/Users/xz/Desktop/学习工具/images/Untitled-2.css">
    </head>
    <body>
    <div class="dh">
    </div>
    </body>
    </html>

    @charset "utf-8";
    /* CSS Document */

    div{
    200px;
    height:400px;
    background:rgba(153,102,0,0.8);
    animation-name:mydh;
    animation-duration:2s;
    animation-timing-function:linear;
    animation-delay:0s;
    animation-iteration-count:infinite;
    animation-direction:alternate;
    }
    @keyframes mydh{
    0%{
    200px;
    height:400px;
    margin-top:100px;
    background-color:#0F3;
    }
    50%{
    300px;
    height:200px;
    background-color:#CC9;
    margin-top:250px;
    }
    100%{
    200px;
    height:400px;
    background-color:#C36;
    margin-top:300px;}
    }

  • 相关阅读:
    window linux pycharm 相互协作
    再次校验环境
    转 安装 ubuntu后 软件处理 -感谢博主skykingf csdn
    NSError是向用户传递详细错误信息的不错的选择
    Node.js学习笔记-入门
    UIKit和CSS布局方式的差异
    继承缺陷以及替代方案
    HTML、HTML DOM、Javascript、CSS以及jQuery使用小结
    关于cookies
    一个诡异bug---symbol not found: objc_setProperty_atomic
  • 原文地址:https://www.cnblogs.com/l8l8/p/8022469.html
Copyright © 2011-2022 走看看