HTML5清明节柳叶飘动特效

2013/11/20 22:44:00  人气 3292    模板学院  
专题:Html5教程

HTML5清明节柳叶飘动特效,不推荐说不过去了,哈,来自百度清明节纪念网页的特效,运用主流的HTML5技术实现网页动画,柳叶随风飘动的效果,有点味道,搞HTML5的,应该看看这些门户网站的特效实例。测试时请不要使用IE浏览器。

<!DOCTYPE html>
<html>
<head>
<meta http-equiv=“X-UA-Compatible“ content=“IE=7“>
<meta http-equiv=“content-type“ content=“text/html;charset=utf-8“>
<title>柳叶飘动</title>
<style>
.qmg_leaf_div{width:500px;height:200px;overflow:hidden;}
.qmg_leaf_acti{width:267px;height:260px;background:url(‘/jscss/demoimg/201304/qmbg3.gif‘) no-repeat;position: absolute;right:0;top:0;}
.qmg_leaf_all{width:250px;height:260px;position:absolute;right:0;top:0}.qmg_leaf1,.qmg_leaf2,.qmg_leaf3,.qmg_leaf4,.qmg_leaf6,.qmg_leaf7,.qmg_leaf8,.qmg_leaf9,.qmg_leaf10,.qmg_leaf11{opacity: 0;-moz-opacity:0;filter:alpha(opacity=0);position: absolute;z-index:1;}
.qmg_leaf7{filter:alpha(opacity=100);}
.qmg_leaf8{filter:alpha(opacity=100);}
.qmg_leaf9{filter:alpha(opacity=100);}
.qmg_leaf10{filter:alpha(opacity=100);}
.qmg_leaf11{filter:alpha(opacity=100);}
.qmg_leaf1{
-webkit-animation:fade 10s linear infinite,* 10s ease-in infinite;
}
.qmg_leaf1 img{
-webkit-animation:turnround 10s ease-in-out infinite;
}
@-webkit-keyframes fade{
0% { opacity: 0; }
1% { opacity: 1; }
80% { opacity: 1; }
100% { opacity: 0; }
}
@-webkit-keyframes *{
0% { -webkit-transform: translate(40px, 90px);}
100% { -webkit-transform: translate(40px, 200px);}
}
@-webkit-keyframes turnround{
0% { -webkit-transform:rotateZ(0deg) rotateX(0deg) translate(50px,0px);}
40% { -webkit-transform:rotateZ(-15deg) rotateX(0deg) translate(-200px,10px);}
70% { -webkit-transform:rotateZ(0deg) rotateX(10deg) translate(-300px,100px);}
100% { -webkit-transform:rotateZ(-10deg) rotateX(20deg) translate(-400px,150px);}
}

.qmg_leaf1{
-moz-animation:fade 10s linear infinite,* 10s ease-in infinite;
}
.qmg_leaf1 img{
-moz-animation:turnround 10s ease-in-out infinite;
}
@-moz-keyframes fade{
0% { opacity: 0;-moz-opacity:0; }
1% { opacity: 1; -moz-opacity:1;}
80% { opacity: 1; -moz-opacity:1;}
100% { opacity: 0; -moz-opacity:0;}
}
@-moz-keyframes *{
0% { -moz-transform: translate(40px, 90px);}
100% { -moz-transform: translate(40px, 200px);}
}
@-moz-keyframes turnround{
0% { -moz-transform:rotateZ(0deg) rotateX(0deg) translate(50px,0px);}
40% { -moz-transform:rotateZ(-15deg) rotateX(0deg) translate(-200px,10px);}
70% { -moz-transform:rotateZ(0deg) rotateX(10deg) translate(-300px,100px);}
100% { -moz-transform:rotateZ(-10deg) rotateX(20deg) translate(-400px,150px);}
}

/*qmg_leaf 2*/
.qmg_leaf2{
-webkit-animation:fade2 10s linear infinite,*2 10s ease-in infinite;
}
.qmg_leaf2 img{
-webkit-animation:turnround2 10s 0.1s ease-in-out infinite;
}
@-webkit-keyframes fade2{
0% { opacity: 1; }
35% { opacity: 1; }
40% { opacity: 0; }
100% { opacity: 0; }
}
@-webkit-keyframes *2{
0% { -webkit-transform:translate(55px, 155px);-webkit-transform-origin: 50% 50%;}
100% { -webkit-transform: translate(-10px, 200px);}
}
@-webkit-keyframes turnround2{
0% { -webkit-transform:rotateX(0deg) rotateY(0deg) translateY(0px);}
1% { -webkit-transform:rotateX(-10deg) rotateY(-10deg) translateY(0px);}
40% { -webkit-transform:rotateX(10deg) rotateY(700deg) translateY(150px);}
100% { -webkit-transform:rotateX(10deg) rotateY(700deg) translateY(150px);}
}
.qmg_leaf2{
-moz-animation:fade2 10s linear infinite,*2 10s ease-in infinite;
}
.qmg_leaf2 img{
-moz-animation:turnround2 10s 0.1s ease-in-out infinite;
}
@-moz-keyframes fade2{
0% { opacity: 1; -moz-opacity:1;}
35% { opacity: 1; -moz-opacity:1;}
40% { opacity: 0; -moz-opacity:0;}
100% { opacity: 0; -moz-opacity:0;}
}
@-moz-keyframes *2{
0% { -moz-transform:translate(55px, 155px);-moz-transform-origin: 50% 50%;}
100% { -moz-transform: translate(-10px, 200px);}
}
@-moz-keyframes turnround2{
0% { -moz-transform:rotateX(0deg) rotateY(0deg) translateY(0px);}
1% { -moz-transform:rotateX(-10deg) rotateY(-10deg) translateY(0px);}
40% { -moz-transform:rotateX(10deg) rotateY(700deg) translateY(150px);}
100% { -moz-transform:rotateX(10deg) rotateY(700deg) translateY(150px);}
}
/*qmg_leaf 3*/
.qmg_leaf3{
-webkit-transform:rotate(30deg);
-webkit-animation:fade3 10s 2s linear infinite,*3 10s 2s ease-in infinite;
}
.qmg_leaf3 img{
-webkit-animation:turnround3 10s 2s ease-in-out infinite;
}
@-webkit-keyframes fade3{
0% { opacity: 0; }
10% { opacity: 1; }
10% { opacity: 1; }
80% { opacity: 1; }
100% { opacity: 0; }
}
@-webkit-keyframes *3{
0% { -webkit-transform:translate(130px, 50px);}
100% { -webkit-transform: translate(-10px, 200px);}
}
@-webkit-keyframes turnround3{
0% { -webkit-transform:rotateZ(0deg) rotateX(0deg) translate(0px,0px);}
50% { -webkit-transform:rotateZ(90deg) rotateX(0deg) translate(20px,150px);}
100% { -webkit-transform:rotateZ(-10deg) rotateX(0deg) translate(-250px,100px);}
}
.qmg_leaf3{
-moz-transform:rotate(30deg);
-moz-animation:fade3 10s 2s linear infinite,*3 10s 2s ease-in infinite;
}
.qmg_leaf3 img{
-moz-animation:turnround3 10s 2s ease-in-out infinite;
}
@-moz-keyframes fade3{
0% { opacity: 0; -moz-opacity:0;}
10% { opacity: 1; -moz-opacity:1;}
10% { opacity: 1; -moz-opacity:1;}
80% { opacity: 1; -moz-opacity:1;}
100% { opacity: 0; -moz-opacity:0;}
}
@-moz-keyframes *3{
0% { -moz-transform:translate(130px, 50px);}
100% { -moz-transform: translate(-10px, 200px);}
}
@-moz-keyframes turnround3{
0% { -moz-transform:rotateZ(0deg) rotateX(0deg) translate(0px,0px);}
50% { -moz-transform:rotateZ(90deg) rotateX(0deg) translate(20px,150px);}
100% { -moz-transform:rotateZ(-10deg) rotateX(0deg) translate(-250px,100px);}
}
/*qmg_leaf 4*/
.qmg_leaf4{
-webkit-transform:rotate(30deg);
-webkit-animation:fade4 14s 1s linear infinite,*4 14s 1s ease-in infinite;
}
.qmg_leaf4 img{
-webkit-animation:turnround4 14s 1s ease-in-out infinite;
}
@-webkit-keyframes fade4{
0% { opacity: 1; }
49% { opacity: 0; }
50%{opacity: 0; }
51% { opacity: 0; }
52% { opacity: 1; }
100% { opacity: 0; }
}
@-webkit-keyframes *4{
0% {-webkit-transform: translate(40px, -20px);}
49% {-webkit-transform: translate(-300px, 150px);}
50% {-webkit-transform: translate(-180px, -20px);}
51% {-webkit-transform: translate(-180px, -20px);}
52% {-webkit-transform: translate(-180px, -20px);}
100% {-webkit-transform: translate(-300px, 150px);}
}
@-webkit-keyframes turnround4{
0% { -webkit-transform:rotateZ(0deg) rotateX(0deg) translate(0px,0px);}
25% { -webkit-transform:rotateZ(90deg) rotateX(0deg) translate(50px,150px);}
49% { -webkit-transform:rotateZ(-10deg) rotateX(0deg) translate(-200px,0px);}
50% { -webkit-transform:rotateZ(0deg) rotateX(0deg) translate(0px,0px);}
51% { -webkit-transform:rotateZ(0deg) rotateX(0deg) translate(0px,0px);}
52% { -webkit-transform:rotateZ(0deg) rotateX(0deg) translate(0px,0px);}
75% { -webkit-transform:rotateZ(90deg) rotateX(0deg) translate(50px,150px);}
100% { -webkit-transform:rotateZ(-10deg) rotateX(0deg) translate(-200px,0px);}
}
.qmg_leaf4{
-moz-transform:rotate(30deg);
-moz-animation:fade4 14s 1s linear infinite,*4 14s 1s ease-in infinite;
}
.qmg_leaf4 img{
-moz-animation:turnround4 14s 1s ease-in-out infinite;
}
@-moz-keyframes fade4{
0% { opacity: 1; -moz-opacity:1;}
49% { opacity: 0; -moz-opacity:0;}
50% {opacity: 0; -moz-opacity:0;}
51% { opacity: 0; -moz-opacity:0;}
52% { opacity: 1; -moz-opacity:1;}
100% { opacity: 0; -moz-opacity:0;}
}
@-moz-keyframes *4{
0% {-moz-transform: translate(40px, -20px);}
49% {-moz-transform: translate(-300px, 150px);}
50% {-moz-transform: translate(-180px, -20px);}
51% {-moz-transform: translate(-180px, -20px);}
52% {-moz-transform: translate(-180px, -20px);}
100% {-moz-transform: translate(-300px, 150px);}
}
@-moz-keyframes turnround4{
0% { -moz-transform:rotateZ(0deg) rotateX(0deg) translate(0px,0px);}
25% { -moz-transform:rotateZ(90deg) rotateX(0deg) translate(50px,150px);}
49% { -moz-transform:rotateZ(-10deg) rotateX(0deg) translate(-200px,0px);}
50% { -moz-transform:rotateZ(0deg) rotateX(0deg) translate(0px,0px);}
51% { -moz-transform:rotateZ(0deg) rotateX(0deg) translate(0px,0px);}
52% { -moz-transform:rotateZ(0deg) rotateX(0deg) translate(0px,0px);}
75% { -moz-transform:rotateZ(90deg) rotateX(0deg) translate(50px,150px);}
100% { -moz-transform:rotateZ(-10deg) rotateX(0deg) translate(-200px,0px);}
}
/*qmg_leaf 6*/
.qmg_leaf6{
z-index:300;
-webkit-animation:fade6 12s 3s linear infinite,*6 12s 3s ease-in infinite;
}
.qmg_leaf6 img{
-webkit-animation:turnround6 12s 3s ease-in-out infinite;
}
@-webkit-keyframes fade6{
0% { opacity: 1; }
80% { opacity: 1; }
100% { opacity: 0; }
}
@-webkit-keyframes *6{
0% { -webkit-transform:translate(-180px, -10px);}
100% { -webkit-transform: translate(-240px, 150px);}
}
@-webkit-keyframes turnround6{
0% { -webkit-transform:rotateZ(0deg) rotateX(0deg) translate(50px,0px);}
50% { -webkit-transform:rotateZ(90deg) rotateX(0deg) translate(100px,100px);}
100% { -webkit-transform:rotateZ(0deg) rotateX(0deg) translate(280px,300px);}
}
.qmg_leaf6{
z-index:300;
-moz-animation:fade6 12s 3s linear infinite,*6 12s 3s ease-in infinite;
}
.qmg_leaf6 img{
-moz-animation:turnround6 12s 3s ease-in-out infinite;
}
@-moz-keyframes fade6{
0% { opacity: 1; -moz-opacity:1;}
80% { opacity: 1; -moz-opacity:1;}
100% { opacity: 0; -moz-opacity:0;}
}
@-moz-keyframes *6{
0% { -moz-transform:translate(-180px, -10px);}
100% { -moz-transform: translate(-420px, 150px);}
}
@-moz-keyframes turnround6{
0% { -moz-transform:rotateZ(0deg) rotateX(0deg) translate(50px,0px);}
50% { -moz-transform:rotateZ(90deg) rotateX(0deg) translate(100px,100px);}
100% { -moz-transform:rotateZ(0deg) rotateX(0deg) translate(280px,300px);}
}
</style>

</head>
<body>
<script>
window.onload = function(){
function qm_appendStr(obj, html){
var oDiv=document.*Element(‘div‘);
oDiv.innerHTML=html;
while(oDiv.childNodes.length){
obj.appendChild(oDiv.childNodes[0]);
}
}
function getByClassName(obj, sClass){
var aEle = obj.getElementsByTagName(‘*‘);
var i = 0;
var aResult = [];
for(i=0;i<aEle.length;i++){
if(aEle[i].className == sClass){
aResult.push(aEle[i]);
}
}
return aResult;
}
var qingmingjie_str = ‘<div class=“qmg_leaf_div“>‘+
‘<div class=“qmg_leaf_acti“></div>‘+
‘<div class=“qmg_leaf_all“>‘+
‘<div class=“qmg_leaf1“><img src=“/jscss/demoimg/201304/01png.png“ alt=““></div>‘+
‘<div class=“qmg_leaf2“><img src=“/jscss/demoimg/201304/02png.png“ alt=““></div>‘+
‘<div class=“qmg_leaf3“><img src=“/jscss/demoimg/201304/03png.png“ alt=““></div>‘+
‘<div class=“qmg_leaf4“><img src=“/jscss/demoimg/201304/01png.png“ alt=““></div>‘+
‘<div class=“qmg_leaf6“><img src=“/jscss/demoimg/201304/01png.png“ alt=““></div>‘+
‘<div class=“qmg_leaf7“><img src=“/jscss/demoimg/201304/03png.png“ alt=““></div>‘+
‘<div class=“qmg_leaf8“><img src=“/jscss/demoimg/201304/02png.png“ alt=““></div>‘+
‘<div class=“qmg_leaf9“><img src=“/jscss/demoimg/201304/03png.png“ alt=““></div>‘+
‘<div class=“qmg_leaf10“><img src=“/jscss/demoimg/201304/02png.png“ alt=““></div>‘+
‘<div class=“qmg_leaf11“><img src=“/jscss/demoimg/201304/01png.png“ alt=““></div>‘+
‘</div>‘+
‘</div>‘;
qm_appendStr(document.getElementsByTagName(‘body‘)[0],qingmingjie_str);
var qmgLeaf7 = getByClassName(‘qmg_leaf7‘)[0],
qmgLeaf8 = getByClassName(‘qmg_leaf8‘)[0],
qmgLeaf9 = getByClassName(‘qmg_leaf9‘)[0],
qmgLeaf10 = getByClassName(‘qmg_leaf10‘)[0],
qmgLeaf11 = getByClassName(‘qmg_leaf11‘)[0];
/*ie leaf*/
if(T.browser.ie){
function bezier(curve, rate){
if (!curve || !curve.length) return [];
if (curve.length == 1) return [curve[0][0], curve[0][1]];
if (curve.length == 2) return [
curve[0][0] + (curve[1][0] - curve[0][0]) * rate,
curve[0][1] + (curve[1][1] - curve[0][1]) * rate
];
var temp = [];
for (var i = 1; i < curve.length; i++){
temp.push(bezier([curve[i - 1], curve[i]], rate));
}
return bezier(temp, rate);
}
function rand_pm(obj,xy,rote){
var pos = bezier(xy,rote);
obj.style.right = parseInt(pos[0]) + ‘px‘;
obj.style.top = parseInt(pos[1]) + ‘px‘;
}
setInterval(function(){
rand_pm(qmgLeaf7,[[0,0],[150,92],[133,388],[416,380]],(+new Date) % 7000 / 7000);
rand_pm(qmgLeaf8,[[1,37],[296,27],[84,154],[537,107]],(+new Date) % 4000 / 4000);
rand_pm(qmgLeaf9,[[150,10],[296,27],[83,345],[562,292]],(+new Date) % 6000 / 6000);
rand_pm(qmgLeaf10,[[150,10],[296,27],[83,345],[276,340]],(+new Date) % 5000 / 5000);
rand_pm(qmgLeaf11,[[248,10],[462,142],[83,345],[459,251]],(+new Date) % 7000 / 7000);
}, 30);
}
}
</script>
</body>
</html>
百事纟超管纟快乐(ID1000)设为专题11-20 22:44

. 微信,微博,QQ空间点击右上角的三个点分享给朋友。经典话题等你参与。关注baishiwlkj公众号成

发表回复

   


  通知楼主

沙发

百事纟超管纟快乐.04-18 07:29
罒ω罒 爱生活,爱网络

回复只看TA