CSS3简单动画_html/css_WEB-ITnose

php中文网
发布: 2016-06-24 11:33:00
原创
1295人浏览过

css3的动画确实非常绚丽!浏览器兼容性很重要!。

分享两个小动画

<!doctype html><html lang="en"> <head>  <meta charset="UTF-8">  <meta name="Generator" content="EditPlus&reg;">  <meta name="Author" content="">  <meta name="Keywords" content="">  <meta name="Description" content="">  <title>C3动画</title>  <style>    /*****************/    #d1{width:50px;height:50px;background-color:green;float:left;        border-radius:50%;}    #d2{width:50px;height:50px;background-color:red;float:left;        border-radius:50%;position:relative;}    @-webkit-keyframes jump{    0%{transform:rotate(0deg);opacity:1;}    25%{transform:rotate(-10deg);opacity:0.5;}    50%{transform:rotate(0deg);opacity:1;}    75%{transform:rotate(10deg);opacity:0.5;}    100%{transform:rotate(0deg);opacity:1;}    }    #d1{-webkit-animation:jump 0.3s linear infinite;}    @-webkit-keyframes move{        0%{left:10px;background-color:blue;}        50%{left:800px;background-color:yellow;}        100%{left:10px;background-color:red;}    }    #d2{-webkit-animation:move 5s linear infinite;}  </style> </head> <body>    <div id="d1"></div>    <div id="d2"></div> </body></html>
登录后复制

效果如本博客首页那两个小圆圈!

需要注意的是:

1、在css里创建动画时候要处理兼容性

立即学习前端免费学习笔记(深入)”;

2、在调用的时候不单要处理兼容性> -webkit-animation: ; -moz-animation: ; -o-animation: ; animation: ; 

还要注意animation:animation-name,animation-duration,animation-timing-function,animation-iteration-count

万兴爱画
万兴爱画

万兴爱画AI绘画生成工具

万兴爱画 52
查看详情 万兴爱画

  animation-name:是用来定义一个动画的名称

  animation-duration是用来指定元素播放动画所持续的时间长,取值:为数值,单位为s (秒.)其默认值为“0”。

  animation-timing-function:是指元素根据时间的推进来改变属性值的变换速率,说得简单点就是动画的播放方式.

    具有以下六种变换方式:ease;ease-in;ease-in-out;linear;cubic- bezier。就是播放速度~

  animation-iteration-count是用来指定元素播放动画的循环次数,其可以取值为数字,其默认值为“1”;infinite为无限次数循环。

HTML速学教程(入门课程)
HTML速学教程(入门课程)

HTML怎么学习?HTML怎么入门?HTML在哪学?HTML怎么学才快?不用担心,这里为大家提供了HTML速学教程(入门课程),有需要的小伙伴保存下载就能学习啦!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号