zoukankan      html  css  js  c++  java
  • css3中animation的应用

    1、css3 的相关属性:

    相关代码:

    div
    {
    animation-name: myfirst; //动画的名称
    animation-duration: 5s;  //动画一个周期需要5秒
    animation-timing-function: linear; //动画运动速度的曲线动画从头到尾的速度是相同的。
    animation-delay: 2s; //等待2s动画才开始
    animation-iteration-count: infinite;//动画一直在持续,无数次
    animation-direction: alternate;//动画结束后再反向循环
    animation-play-state: running;//规定动画是在运行
    /* Firefox: */
    -moz-animation-name: myfirst;
    -moz-animation-duration: 5s;
    -moz-animation-timing-function: linear;
    -moz-animation-delay: 2s;
    -moz-animation-iteration-count: infinite;
    -moz-animation-direction: alternate;
    -moz-animation-play-state: running;
    /* Safari 和 Chrome: */
    -webkit-animation-name: myfirst;
    -webkit-animation-duration: 5s;
    -webkit-animation-timing-function: linear;
    -webkit-animation-delay: 2s;
    -webkit-animation-iteration-count: infinite;
    -webkit-animation-direction: alternate;
    -webkit-animation-play-state: running;
    /* Opera: */
    -o-animation-name: myfirst;
    -o-animation-duration: 5s;
    -o-animation-timing-function: linear;
    -o-animation-delay: 2s;
    -o-animation-iteration-count: infinite;
    -o-animation-direction: alternate;
    -o-animation-play-state: running;
    }


    运动的参数(百分比表示运动的进度)

    @keyframes myfirst
    {
    0% {background:red; left:0px; top:0px;}
    25% {background:yellow; left:200px; top:0px;}
    50% {background:blue; left:200px; top:200px;}
    75% {background:green; left:0px; top:200px;}
    100% {background:red; left:0px; top:0px;}
    }
    
    @-moz-keyframes myfirst /* Firefox */
    {
    0% {background:red; left:0px; top:0px;}
    25% {background:yellow; left:200px; top:0px;}
    50% {background:blue; left:200px; top:200px;}
    75% {background:green; left:0px; top:200px;}
    100% {background:red; left:0px; top:0px;}
    }
    
    @-webkit-keyframes myfirst /* Safari and Chrome */
    {
    0% {background:red; left:0px; top:0px;}
    25% {background:yellow; left:200px; top:0px;}
    50% {background:blue; left:200px; top:200px;}
    75% {background:green; left:0px; top:200px;}
    100% {background:red; left:0px; top:0px;}
    }
    
    @-o-keyframes myfirst /* Opera */
    {
    0% {background:red; left:0px; top:0px;}
    25% {background:yellow; left:200px; top:0px;}
    50% {background:blue; left:200px; top:200px;}
    75% {background:green; left:0px; top:200px;}
    100% {background:red; left:0px; top:0px;}
    }
    

      

    
    
  • 相关阅读:
    C#设计模式(8)——桥接模式(Bridge Pattern)
    我的微软最有价值专家(Microsoft MVP)之路
    C#设计模式(7)——适配器模式(Adapter Pattern)
    C#设计模式(6)——原型模式(Prototype Pattern)
    C#设计模式(5)——建造者模式(Builder Pattern)
    C#设计模式(4)——抽象工厂模式
    C#设计模式(3)——工厂方法模式
    C#设计模式(2)——简单工厂模式
    [C# 基础知识系列]C#中易混淆的知识点
    [C# 开发技巧]如何使不符合要求的元素等于离它最近的一个元素
  • 原文地址:https://www.cnblogs.com/leyan/p/5105990.html
Copyright © 2011-2022 走看看