css3中动画animation的应用

摘要:
0%{Opacity:0;font-size:12px;}100%{Opacity:1;font-size:34px;}}.anim1Div{-webkit-animation-name:anim1;规定@keyframes动画的名称-webkit-animation-duration:1.5s;规定动画完成一个周期所花费的秒或毫秒。默认是0-webkit-animation-iteration-count:400;规定动画被播放的次数。-webkit-animation-direction:alternate;规定动画是否在下一周期逆向地播放。-webkit-animation-timing-function:ease-in-out;规定动画的速度曲线。
<!DOCTYPE html>
<html>
<head>
<style> 
/*@-webkit-keyframes anim1 { // 规定动画。
0% { 
Opacity: 0; 
font-size: 12px; 
} 
100% { 
Opacity: 1; 
font-size: 34px; 
} 
} 
.anim1Div { 
-webkit-animation-name: anim1 ; 规定 @keyframes 动画的名称
-webkit-animation-duration: 1.5s; 规定动画完成一个周期所花费的秒或毫秒。默认是 0
-webkit-animation-iteration-count: 400; 规定动画被播放的次数。默认是 1。
-webkit-animation-direction: alternate; 规定动画是否在下一周期逆向地播放。默认是 "normal"。
-webkit-animation-timing-function: ease-in-out; 规定动画的速度曲线。默认是 "ease"。
} */
div
{
100px;
height:100px;
background:red;
position:relative;

animation:myfirst 5s linear 2s infinite alternate;
/*Firefox: */
-moz-animation:myfirst 5s linear 2s infinite alternate;
/*Safari and Chrome: */
-webkit-animation:myfirst 5s linear 2s infinite alternate;
/*Opera: */
-o-animation:myfirst 5s linear 2s infinite alternate;
}

@keyframes myfirst /*需要用@keyframes来申明动画的名称*/{/*从0%一直到100%的渐变过程*/
0%{background:red; left:0px; top:0px;}
25%{background:yellow; left:200px; top:0px;}
50%{background:blue; left:200px; top:200px;}
75%{background:green; left:0px; top:200px;}
100%{background:red; left:0px; top:0px;}
}

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

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

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

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

<div></div>

</body>
</html>

免责声明:文章转载自《css3中动画animation的应用》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇12种JS常用获取时间的方式Navicat远程连接MySQL数据库下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

vscode中使用beautify插件格式化vue文件

1.点击文件->首选项->设置,找到beautify.language并在html一栏里加上vue "beautify.language": { "js": { "type": [ "javascript", "json"...

width:100%和width:inherit

前几天遇到过这么一个问题。我想让子盒子的宽度等于父盒子的宽度。父盒子宽度为一个具体值比如说200px.我将子盒子宽度设为了100%。按道理说应该是可以等于父盒子的宽度的,但结果并没有,而是通栏了。然后我又将子盒子宽度设为了inherit。结果宽度就是父盒子的宽度了。 HTML结构如下: <body> <div cl...

CSS文本部分之字体样式[1]

1. 字体系列 [通用字体系列] 1. serif字体:带衬线字体,如Georiga、Times等 2. sans-serif字体:不带衬线字体,包括Arial、Geneva等 3. Monospace字体:等宽字体,包括Courier等 4. Cursive字体:手写字体,包括Author等 5. Fanstasy字体:无法归类,包括Western等...

【转】CSS浏览器兼容性与解析问题终极归纳

1.怪异模式问题:漏写DTD声明,Firefox仍然会按照标准模式来解析网页,但在IE中会触发怪异模式。为避免怪异模式给我们带来不必要的麻烦,最好养成书写DTD声明的好习惯。 2.IE6双边距问题:在IE6下,如果对元素设置了浮动,同时又设置了margin-left或margin-right,margin值会加倍。例如: HTML: <div cla...

第二章 JSP页面制作基础

第二章  JSP页面制作基础 [本章导读] JSP页面将Java代码嵌入到HTML脚本中,掌握HTML语言是学习JSP的基础。HTML是网页制作的一种规范,一种标准,它通过标记符来标记网页的各个部分。本章首先介绍用HTML制作网页的各种标记符的设置方法,接着介绍了CSS的基本概念和使用方法。此外,为了增强读者对网页制作的了解,介绍了Dreamweaver的...

less和scss

一、less基础语法 1、声明变量:@变量名:变量值;      使用变量:@变量名; 2、混合(Mixins) 1)无参混合 声明: .class{} 调用:在选择器中,使用.class;直接调用 2)有参无默认值混合: 声明:.class(@param){...