前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >css3动画知识

css3动画知识

作者头像
windseek
发布2018-05-15 17:52:00
8470
发布2018-05-15 17:52:00
举报
文章被收录于专栏:杨龙飞前端

杨龙飞

杨龙飞

杨龙飞

杨龙飞

杨龙飞
杨龙飞

<!DOCTYPE html> <html> <head> <style> div { width:100px; height:100px; background:red; animation:myfirst 5s; -moz-animation:myfirst 5s; /* Firefox */ -webkit-animation:myfirst 5s; /* Safari and Chrome */ -o-animation:myfirst 5s; /* Opera */ }

@keyframes myfirst { 0% {background:red;} 25% {background:yellow;} 50% {background:blue;} 100% {background:green;} }

@-moz-keyframes myfirst /* Firefox */ { 0% {background:red;} 25% {background:yellow;} 50% {background:blue;} 100% {background:green;} }

@-webkit-keyframes myfirst /* Safari and Chrome */ { 0% {background:red;} 25% {background:yellow;} 50% {background:blue;} 100% {background:green;} }

@-o-keyframes myfirst /* Opera */ { 0% {background:red;} 25% {background:yellow;} 50% {background:blue;} 100% {background:green;} } </style> </head> <body>

<div></div>

<p><b>注释:</b>当动画完成时,会变回初始的样式。</p>

<p><b>注释:</b>本例在 Internet Explorer 中无效。</p>

</body> </html>

无限循环动画

代码语言:javascript
复制
.content .light{position:absolute;right:0px;background:white;-webkit-animation: twinkling1 1s infinite ease-in-out;animation: twinkling1 1s infinite ease-in-out;box-sizing:border-box;border:3px solid white;}
代码语言:javascript
复制
@keyframes twinkling1 {
    100% {width:20px;height:20px;border-radius:50%;background:yellow;visibility: hidden;border-color:rgb(255,65,34);}
    66% {width:20px;height:20px;border-radius:50%;background:rgb(255,65,34);border-color:white;}
    33% {width:20px;height:20px;border-radius:50%;background: yellow;border-color:rgb(255,65,34);}
    0% {width:20px;height:20px;border-radius:50%;background: yellow;visibility: visible;border-color:rgb(255,65,34);}
}
@-moz-keyframes twinkling1 /* Firefox */
{
    100% {width:20px;height:20px;border-radius:50%;background:yellow;visibility: hidden;border-color:rgb(255,65,34);}
    66% {width:20px;height:20px;border-radius:50%;background:rgb(255,65,34);border-color:white;}
    33% {width:20px;height:20px;border-radius:50%;background: yellow;border-color:rgb(255,65,34);}
    0% {width:20px;height:20px;border-radius:50%;background: yellow;visibility: visible;border-color:rgb(255,65,34);}
}

@-webkit-keyframes twinkling1 /* Safari 和 Chrome */
{
    100% {width:20px;height:20px;border-radius:50%;background:yellow;visibility: hidden;border-color:rgb(255,65,34);}
    66% {width:20px;height:20px;border-radius:50%;background:rgb(255,65,34);border-color:white;}
    33% {width:20px;height:20px;border-radius:50%;background: yellow;border-color:rgb(255,65,34);}
    0% {width:20px;height:20px;border-radius:50%;background: yellow;visibility: visible;border-color:rgb(255,65,34);}
}

@-o-keyframes twinkling1 /* Opera */
{
    100% {width:20px;height:20px;border-radius:50%;background:yellow;visibility: hidden;border-color:rgb(255,65,34);}
    66% {width:20px;height:20px;border-radius:50%;background:rgb(255,65,34);border-color:white;}
    33% {width:20px;height:20px;border-radius:50%;background: yellow;border-color:rgb(255,65,34);}
    0% {width:20px;height:20px;border-radius:50%;background: yellow;visibility: visible;border-color:rgb(255,65,34);}
}
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2017-02-17 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 杨龙飞
    • 杨龙飞
      • 杨龙飞
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档