css 动画效果
2015-05-14 22:48
337 查看
css3的动画需要遵循@keyframes规制
<div>动画效果</div>
div{
width: 100px;
height: 100px;
background: red;
/* 相对布局*/
position: relative;
animation: anim 5s infinite alternate;
-webkit-animation: anim 5s infinite alternate;
}
@keyframes anim{
0%{background: red;left: 0px;top: 0px}
25%{background: blue;left: 200px;top: 0px}
50%{background: orange;left: 200px;top: 200px}
75%{background: yellow; left: 0px;top: 200px}
100%{background: red;left: 0;top: 0px}
}
@-webkit-keyframes anim{
0%{background: red;left: 0px;top: 0px}
25%{background: blue;left: 200px;top: 0px}
50%{background: orange;left: 200px;top: 200px}
75%{background: yellow; left: 0px;top: 200px}
100%{background: red;left: 0;top: 0px};
}
<div>动画效果</div>
div{
width: 100px;
height: 100px;
background: red;
/* 相对布局*/
position: relative;
animation: anim 5s infinite alternate;
-webkit-animation: anim 5s infinite alternate;
}
@keyframes anim{
0%{background: red;left: 0px;top: 0px}
25%{background: blue;left: 200px;top: 0px}
50%{background: orange;left: 200px;top: 200px}
75%{background: yellow; left: 0px;top: 200px}
100%{background: red;left: 0;top: 0px}
}
@-webkit-keyframes anim{
0%{background: red;left: 0px;top: 0px}
25%{background: blue;left: 200px;top: 0px}
50%{background: orange;left: 200px;top: 200px}
75%{background: yellow; left: 0px;top: 200px}
100%{background: red;left: 0;top: 0px};
}
相关文章推荐
- css 动画效果
- 如何css做一个点击导航 页面滚动, 并且有动画效果
- CSS动画animate.css动画效果全集中文解释
- JavaScript实现动态下拉收起菜单+css实现动画效果
- CSS自定义下划线动画效果
- trick:CSS 3+checkbox实现JQuery的6个基本动画效果
- 模仿google首页图片动画效果 (css+javascript)
- Css Transition Animation 动画效果简介
- CSS+jQuery实现的一个放大缩小动画效果
- css 动画效果
- JavaScript+CSS实现仿Mootools竖排弹性动画菜单效果
- css动画效果:实现鼠标移入菜单栏文字下出现下划线
- 66种基于animate.css的CSS消息提示动画效果
- CSS动画效果
- 10个CSS和jQuery的加载中(loading)动画效果实现
- css实现3D动画效果
- CSS3动画效果——js调用css动画属性并回调处理详解
- CSS-动画效果
- 用CSS动画实现浮动跳动效果
- 原生JS实现CSS动画效果