首页 > Web开发 > 详细

CSS3 动画

时间:2019-11-26 16:11:35      阅读:67      评论:0      收藏:0      [点我收藏+]

动画:动画同过渡有些相似,格式如下

div{
    animation:myfirst 5s;    /*动画名 持续时间*/
    -webkit-animation:myfirst 5s;  /*Safari 与 Chrome*/  
}

@keyframes myfirst    /*动画效果*/
{
    from {background: red;}
    to {background: yellow;}
}
 
@-webkit-keyframes myfirst /* Safari 与 Chrome */
{
    from {background: red;}
    to {background: yellow;}
}

多属性动画

@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;}
}
 
@-webkit-keyframes myfirst /* Safari 与 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;}
}

无线循环动画

div{
    animation: myfirst 5s infinite;
    -webkit-animation:myfirst 5s infinite;
}

 

 

 

CSS3 动画

原文:https://www.cnblogs.com/xihailong/p/11935632.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!