复习下 css3 的动画, 都快不会写了,那会儿挺喜欢 flash 的,可惜了时代在前进。写这里就当是文档看吧
浏览器支持
Internet Explorer 10、Firefox 以及 Opera 支持 animation 属性。
Safari 和 Chrome 支持替代的 -webkit-animation 属性。
注释:Internet Explorer 9 以及更早的版本不支持 animation 属性。
定义和用法
animation属性是一个简写属性,用于设置六个动画属性:
-
animation-name
-
animation-duration
-
animation-timing-function animation-delay
-
animation-iteration-count animation-direction
语法
animation: name duration timing-function delay iteration-count direction;

关于keyframe的定义
-
Firefox支持替代的@-moz-keyframes规则;
-
Opera支持替代的@-o-keyframes规则;
-
Safari和Chrome支持替代的@-webkit-keyframes规则;
-
取值支持 0-100% 和from,to。
@keyframes move {
0% {
top: 0px;
left: 0px;
}
25% {
top: 200px;
left: 200px;
}
50% {
top: 100px;
left: 100px;
}
75% {
top: 200px;
left: 200px;
}
100% {
top: 0px;
left: 0px;
}
}
@keyframes move {
from {
top: 0px;
left: 0px;
}
to {
top: 0px;
left: 100px;
}
}
demo 写了一个例子,地球绕太阳转

以下是代码
<!-- html 部分 -->
<div style="width:700px; ">
<div class="t">
<div class="t1"></div>
</div>
</div>
/* css 部分 */
@keyframes t {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
@-webkit-keyframes t {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
.t {
height: 500px;
width: 500px;
position: relative;
border-radius: 50%;
transform: scale(.8);
border: 1px solid #dedede;
&::before {
content: "";
width: 50px;
height: 50px;
background: radial-gradient(72px, #f00, #ff0, #080);
border-radius: 50%;
position: absolute;
left: 50%;
top: 50%;
margin-top: -25px;
margin-left: -25px;
box-shadow: 0 0 37px #fcff4a;
}
.t1 {
height: 20px;
border-radius: 50%;
width: 20px;
margin-top: -10px;
top: 50%;
left: -10px;
background: radial-gradient(26px, #0082ff, #184608, #003ade);
position: absolute;
animation: t 3s infinite linear;
transform-origin: 260px center;
}
}
</style>
还有一个 demo ,在这里https://k-ui.cn
推荐学习CSS3视频教程
以上就是手把手教你怎么使用CSS3怎么实现动画效果(代码分享)的详细内容,更多请关注亿码酷站其它相关文章!
手把手教你怎么使用CSS3怎么实现动画效果(代码分享)
—–文章转载自PHP中文网如有侵权请联系ymkuzhan@126.com删除
转载请注明来源:手把手教你怎么使用CSS3怎么实现动画效果(代码分享)
本文永久链接地址:https://www.ymkuzhan.com/38450.html
本文永久链接地址:https://www.ymkuzhan.com/38450.html
下载声明:
本站资源如无特殊说明默认解压密码为www.ymkuzhan.com建议使用WinRAR解压; 本站资源来源于用户分享、互换、购买以及网络收集等渠道,本站不提供任何技术服务及有偿服务,资源仅提供给大家学习研究请勿作它用。 赞助本站仅为维持服务器日常运行并非购买程序及源码费用因此不提供任何技术支持,如果你喜欢该程序,请购买正版! 版权声明:
下载本站资源学习研究的默认同意本站【版权声明】若本站提供的资源侵犯到你的权益,请提交版权证明文件至邮箱ymkuzhan#126.com(将#替换为@)站长将会在三个工作日内为您删除。 免责声明:
您好,本站所有资源(包括但不限于:源码、素材、工具、字体、图像、模板等)均为用户分享、互换、购买以及网络收集而来,并未取得原始权利人授权,因此禁止一切商用行为,仅可用于个人研究学习使用。请务必于下载后24小时内彻底删除,一切因下载人使用所引起的法律相关责任,包括但不限于:侵权,索赔,法律责任,刑事责任等相关责任,全部由下载人/使用人,全部承担。以上说明,一经发布视为您已全部阅读,理解、同意以上内容,如对以上内容持有异议,请勿下载,谢谢配合!支持正版,人人有责,如不慎对您的合法权益构成侵犯,请联系我们对相应内容进行删除,谢谢!





