 |
效果预览
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网页特效|Linkweb.cn/Js|---两只逼真的飞舞蝴蝶</title> </head>
<body>
<body onLoad="MM_timelinePlay('Timeline1');MM_timelinePlay('Timeline2');" background="../images/bg.gif"> <script language="JavaScript"> <!-- function MM_timelinePlay(tmLnName, myID) { var i,j,tmLn,props,keyFrm,sprite,numKeyFr,firstKeyFr,propNum,theObj,firstTime=false; if (document.MM_Time == null) MM_initTimelines(); tmLn = document.MM_Time[tmLnName]; if (myID == null) { myID = ++tmLn.ID; firstTime=true;} if (myID == tmLn.ID) { setTimeout('MM_timelinePlay("'+tmLnName+'",'+myID+')',tmLn.delay); fNew = ++tmLn.curFrame; for (i=0; i<tmLn.length; i++) { sprite = tmLn[i]; if (sprite.charAt(0) == 's') { if (sprite.obj) { numKeyFr = sprite.keyFrames.length; firstKeyFr = sprite.keyFrames[0]; if (fNew >= firstKeyFr && fNew <= sprite.keyFrames[numKeyFr-1]) {//in range keyFrm=1; for (j=0; j<sprite.values.length; j++) { props = sprite.values[j]; if (numKeyFr != props.length) { if (props.prop2 == null) sprite.obj[props.prop] = props[fNew-firstKeyFr]; else sprite.obj[props.prop2][props.prop] = props[fNew-firstKeyFr]; } else { while (keyFrm<numKeyFr && fNew>=sprite.keyFrames[keyFrm]) keyFrm++; if (firstTime || fNew==sprite.keyFrames[keyFrm-1]) { if (props.prop2 == null) sprite.obj[props.prop] = props[keyFrm-1]; else sprite.obj[props.prop2][props.prop] = props[keyFrm-1]; } } } } } } else if (sprite.charAt(0)=='b' && fNew == sprite.frame) eval(sprite.value); if (fNew > tmLn.lastFrame) tmLn.ID = 0; } } }
function MM_timelineGoto(tmLnName, fNew, numGotos) { var i,j,tmLn,props,keyFrm,sprite,numKeyFr,firstKeyFr,lastKeyFr,propNum,theObj; if (document.MM_Time == null) MM_initTimelines(); tmLn = document.MM_Time[tmLnName]; if (numGotos != null) if (tmLn.gotoCount == null) tmLn.gotoCount = 1; else if (tmLn.gotoCount++ >= numGotos) {tmLn.gotoCount=0; return} jmpFwd = (fNew > tmLn.curFrame); for (i = 0; i < tmLn.length; i++) { sprite = (jmpFwd)? tmLn[i] : tmLn[(tmLn.length-1)-i]; if (sprite.charAt(0) == "s") { numKeyFr = sprite.keyFrames.length; firstKeyFr = sprite.keyFrames[0]; lastKeyFr = sprite.keyFrames[numKeyFr - 1]; if ((jmpFwd && fNew<firstKeyFr) || (!jmpFwd && lastKeyFr<fNew)) continue; for (keyFrm=1; keyFrm<numKeyFr && fNew>=sprite.keyFrames[keyFrm]; keyFrm++); for (j=0; j<sprite.values.length; j++) { props = sprite.values[j]; if (numKeyFr == props.length) propNum = keyFrm-1 else propNum = Math.min(Math.max(0,fNew-firstKeyFr),props.length-1); if (sprite.obj != null) { if (props.prop2 == null) sprite.obj[props.prop] = props[propNum]; else sprite.obj[props.prop2][props.prop] = props[propNum]; } } } else if (sprite.charAt(0)=='b' && fNew == sprite.frame) eval(sprite.value); } tmLn.curFrame = fNew; if (tmLn.ID == 0) eval('MM_timelinePlay(tmLnName)'); }
function MM_preloadImages() { if (document.images) { var imgFiles = MM_preloadImages.arguments; if (document.preloadArray==null) document.preloadArray = new Array(); var i = document.preloadArray.length; with (document) for (var j=0; j<imgFiles.length; j++) if (imgFiles[j].charAt(0)!="#"){ preloadArray[i] = new Image; preloadArray[i++].src = imgFiles[j]; } } } function MM_swapImgRestore() { if (document.MM_swapImgData != null) for (var i=0; i<(document.MM_swapImgData.length-1); i+=2) document.MM_swapImgData[i].src = document.MM_swapImgData[i+1]; } function MM_swapImage() { var i,j=0,objStr,obj,swapArray=new Array,oldArray=document.MM_swapImgData; for (i=0; i < (MM_swapImage.arguments.length-2); i+=3) { objStr = MM_swapImage.arguments[(navigator.appName == 'Netscape')?i:i+1]; if ((objStr.indexOf('document.layers[')==0 && document.layers==null) || (objStr.indexOf('document.all[') ==0 && document.all ==null)) objStr = 'document'+objStr.substring(objStr.lastIndexOf('.'),objStr.length); obj = eval(objStr); if (obj != null) { swapArray[j++] = obj; swapArray[j++] = (oldArray==null || oldArray[j-1]!=obj)?obj.src:oldArray[j]; obj.src = MM_swapImage.arguments[i+2]; } } document.MM_swapImgData = swapArray; } function MM_initTimelines() { var ns = navigator.appName == "Netscape"; document.MM_Time = new Array(2); document.MM_Time[0] = new Array(2); document.MM_Time["Timeline1"] = document.MM_Time[0]; document.MM_Time[0].MM_Name = "Timeline1"; document.MM_Time[0].fps = 15; document.MM_Time[0][0] = new String("sprite"); document.MM_Time[0][0].slot = 1; if (ns) document.MM_Time[0][0].obj = document["Layer10"]; else document.MM_Time[0][0].obj = document.all ? document.all["Layer10"] : null; document.MM_Time[0][0].keyFrames = new Array(1, 5, 9, 13, 15, 21, 24, 29, 33, 37, 41, 43, 47, 50); document.MM_Time[0][0].values = new Array(2); document.MM_Time[0][0].values[0] = new Array(333,354,375,396,415,429,441,455,473,502,536,570,599,619,622,619,616,614,613,611,610,612,614,616,614,613,
611,608,607,613,620,628,635,623,608,589,568,547,524,500,475,422,373,354,339,326,314,298,284,271); document.MM_Time[0][0].values[0].prop = "left"; document.MM_Time[0][0].values[1] = new Array(312,314,316,318,320,324,331,336,335,328,319,305,287,237,194,201,210,216,222,227,232,235,234,
233,234,234,235,236,238,238,237,236,242,257,273,290,305,316,326,333,336,320,305,309,318,329,341,360,382,404); document.MM_Time[0][0].values[1].prop = "top"; if (!ns) { document.MM_Time[0][0].values[0].prop2 = "style"; document.MM_Time[0][0].values[1].prop2 = "style"; } document.MM_Time[0][1] = new String("behavior"); document.MM_Time[0][1].frame = 51; document.MM_Time[0][1].value = "MM_timelineGoto('Timeline1','1')"; document.MM_Time[0].lastFrame = 51; document.MM_Time[1] = new Array(2); document.MM_Time["Timeline2"] = document.MM_Time[1]; document.MM_Time[1].MM_Name = "Timeline2"; document.MM_Time[1].fps = 15; document.MM_Time[1][0] = new String("sprite"); document.MM_Time[1][0].slot = 1; if (ns) document.MM_Time[1][0].obj = document["Layer11"]; else document.MM_Time[1][0].obj = document.all ? document.all["Layer11"] : null; document.MM_Time[1][0].keyFrames = new Array(1, 4, 7, 11, 14, 18, 22, 26, 30, 34, 38, 42, 45); document.MM_Time[1][0].values = new Array(2); document.MM_Time[1][0].values[0] = new Array(78,86,94,99,99,96,91,85,77,70,66,71,79,89,91,91,91,92,96,102,107,111,111,110,108,109,112,
116,122,129,138,148,
161,177,197,219,243,270,301,336,371,405,446,486,526); document.MM_Time[1][0].values[0].prop = "left"; document.MM_Time[1][0].values[1] = new Array(306,278,251,225,203,183,165,155,146,137,125,101,75,54,61,69,78,88,106,126,147,168,186,202,216,
230,240,249,256,265,276,289,301,
312,321,328,333,338,341,344,345,344,340,334,327); document.MM_Time[1][0].values[1].prop = "top"; if (!ns) { document.MM_Time[1][0].values[0].prop2 = "style"; document.MM_Time[1][0].values[1].prop2 = "style"; } document.MM_Time[1][1] = new String("behavior"); document.MM_Time[1][1].frame = 46; document.MM_Time[1][1].value = "MM_timelineGoto('Timeline2','1')"; document.MM_Time[1].lastFrame = 46; for (i=0; i<document.MM_Time.length; i++) { document.MM_Time[i].ID = null; document.MM_Time[i].curFrame = 0; document.MM_Time[i].delay = 1000/document.MM_Time[i].fps; } } //-->
</script> <div id="Layer10" style="position:absolute; left:333px; top:312px; width:33px; height:35px; z-index:39"> <img src="images19/butterfly1.gif" width="86" height="81"></div> <div id="Layer11" style="position:absolute; left:78px; top:306px; width:29px; height:29px; z-index:38"> <img src="images19/butterfly2.gif" width="79" height="78"></div> </body>
</html> |
 |