700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > 手把手教你怎么使用CSS3实现动画效果(代码分享)

手把手教你怎么使用CSS3实现动画效果(代码分享)

时间:2024-02-22 08:34:51

相关推荐

手把手教你怎么使用CSS3实现动画效果(代码分享)

web前端|css教程

css3

web前端-css教程

网盘源码手机版,ubuntu修改网络协议,tomcat安装配置监控,python 爬虫兼职,在线执行php的网站, seolzw

复习下 css3 的动画, 都快不会写了,那会儿挺喜欢 flash 的,可惜了时代在前进。写这里就当是文档看吧

cocos2d塔防游戏源码,ubuntu vi命令退出,电动爬虫原理视频,sgd php,seo.mllzw

浏览器支持

web棋盘源码,ubuntu如何识别空格,12306爬虫实战教程,php requrie,seo跟竞价lzw

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

写了一个例子,地球绕太阳转

以下是代码

/* 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; }}

还有一个 demo ,在这里https://k-

推荐学习CSS3视频教学

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。