js動(dòng)畫(huà)效果制件讓圖片組成動(dòng)畫(huà)代碼分享
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無(wú)標(biāo)題文檔</title>
<style>
.ld_anipic{ position:absolute; width:8px; height:8px; background-color:#ccc;}
</style>
<script>
//ld動(dòng)畫(huà)組建
//被加載的divID
function ldAni(contain_id,id_flag,start_id){
this.contain_id=contain_id;
this.id_flag=id_flag;
this.start_id=start_id;
this.a = new Array();
this.tempa=new Array();
this.Add_cmd=function(cmd){
this.a.unshift(cmd);
};
this.bakdata=function(){
this.tempa = this.a.concat();
};
this.steprun=function(){
if (this.a.length < 1) {
//從副本恢復(fù)數(shù)組到緩存,用于循環(huán)顯示
//this.a = this.tempa.concat();
return;
}
var x = this.a.pop();
var cmds = x.toString().split(";"); //字符分
for (var i = 0; i < cmds.length; i++) {
if(cmds[i].toString().length>0){
var d = cmds[i].toString().split(",");
this.dit(d[0], d[1], d[2], d[3]);
}
}
};
this.dit=function(objid, cmd, cs1, cs2){
var obj = null;
try{
obj = document.getElementById(this.id_flag + objid);
}catch(e){}
//move 移動(dòng)的意思
if (cmd == "m") {
obj.style.left = cs1 + "px";
obj.style.top = cs2 + "px";
}
//show 顯示的意思
else if (cmd == "s") {
obj.style.display = "block";
}
//hidden 隱藏的意思
else if (cmd == "h") {
obj.style.display = "none";
}
else if(cmd=="a"){
this.start_id++;
var atag = document.createElement("a");
atag.setAttribute("class", "ld_anipic");
atag.setAttribute("id",this.id_flag + this.start_id);
document.getElementById(this.contain_id).appendChild(atag);
try{
obj = document.getElementById(this.id_flag + this.start_id);
}catch(e){}
obj.style.display = "block";
obj.style.left = cs1 + "px";
obj.style.top = cs2 + "px";
}
}
}
//動(dòng)畫(huà)速度可以在這里控制
var ani=new ldAni("ld_anicon","ldanim_pic",1);
//7
ani.Add_cmd("1,a,0,0");
ani.Add_cmd("1,a,10,0");
ani.Add_cmd("1,a,20,0");
ani.Add_cmd("1,a,30,0");
ani.Add_cmd("1,a,40,0");
ani.Add_cmd("1,a,50,0");
ani.Add_cmd("1,a,50,10");
ani.Add_cmd("1,a,44,20");
ani.Add_cmd("1,a,39,30");
ani.Add_cmd("1,a,35,40");
ani.Add_cmd("1,a,31,50");
ani.Add_cmd("1,a,29,60");
ani.Add_cmd("1,a,27,70");
ani.Add_cmd("1,a,25,80");
ani.Add_cmd("1,a,23,90");
ani.Add_cmd("1,a,22,100");
ani.Add_cmd("1,a,21,110");
//5
ani.Add_cmd("1,a,70,0");
ani.Add_cmd("1,a,70,10");
ani.Add_cmd("1,a,70,20");
ani.Add_cmd("1,a,70,30");
ani.Add_cmd("1,a,70,40");
ani.Add_cmd("1,a,84,45");
ani.Add_cmd("1,a,96,50");
ani.Add_cmd("1,a,106,55");
ani.Add_cmd("1,a,114,60");
ani.Add_cmd("1,a,120,65");
ani.Add_cmd("1,a,120,70");
ani.Add_cmd("1,a,120,75");
ani.Add_cmd("1,a,120,80");
ani.Add_cmd("1,a,120,85");
ani.Add_cmd("1,a,120,90");
ani.Add_cmd("1,a,114,95");
ani.Add_cmd("1,a,106,100");
ani.Add_cmd("1,a,96,105");
ani.Add_cmd("1,a,84,110");
ani.Add_cmd("1,a,70,110");
ani.Add_cmd("1,a,80,20");
ani.Add_cmd("1,a,90,20");
ani.Add_cmd("1,a,100,20");
ani.Add_cmd("1,a,110,20");
ani.Add_cmd("1,a,120,20");
ani.bakdata();
setInterval("ani.steprun()",50);
</script>
</head>
<body>
<div>用js來(lái)進(jìn)行一些圖片的移動(dòng)來(lái)組成動(dòng)畫(huà)效果</div>
<table>
<tr>
<td id="ld_anicon" style=" position:relative; display:inline-block; width:160px;">
</td>
<td style="display:inline-block; font-size:250px;">
SOFT.com
</td>
</tr>
</table>
</body>
</html>
- JavaScript canvas實(shí)現(xiàn)圍繞旋轉(zhuǎn)動(dòng)畫(huà)
- 圖片的左右移動(dòng),js動(dòng)畫(huà)效果實(shí)現(xiàn)代碼
- 原生JS實(shí)現(xiàn)勻速圖片輪播動(dòng)畫(huà)
- 圖片動(dòng)畫(huà)橫條廣告帶上下滾動(dòng)的JS代碼
- js實(shí)現(xiàn)圖片切換(動(dòng)畫(huà)版)
- JavaScript+html5 canvas實(shí)現(xiàn)圖片破碎重組動(dòng)畫(huà)特效
- js、jquery圖片動(dòng)畫(huà)、動(dòng)態(tài)切換示例代碼
- jQuery插件ImageDrawer.js實(shí)現(xiàn)動(dòng)態(tài)繪制圖片動(dòng)畫(huà)(附源碼下載)
- javascript轉(zhuǎn)換靜態(tài)圖片,增加粒子動(dòng)畫(huà)效果
- JS實(shí)現(xiàn)圖片旋轉(zhuǎn)動(dòng)畫(huà)效果封裝與使用示例
相關(guān)文章
createElement與createDocumentFragment的點(diǎn)點(diǎn)區(qū)別小結(jié)
在DOM操作里,createElement是創(chuàng)建一個(gè)新的節(jié)點(diǎn),createDocumentFragment是創(chuàng)建一個(gè)文檔片段2011-12-12基于bootstrap實(shí)現(xiàn)廣告輪播帶圖片和文字效果
這篇文章主要介紹了基于bootstrap實(shí)現(xiàn)廣告輪播帶圖片和文字效果,效果非常棒,需要的朋友可以參考下2016-07-07關(guān)于js中window.location.href,location.href,parent.location.href
關(guān)于js中window.location.href,location.href,parent.location.href,top.location.href的用法2010-10-10基于js實(shí)現(xiàn)二級(jí)下拉聯(lián)動(dòng)
這篇文章主要為大家詳細(xì)介紹了基于js實(shí)現(xiàn)二級(jí)下拉聯(lián)動(dòng),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-12-12JavaScript在網(wǎng)頁(yè)中畫(huà)圓的函數(shù)arc使用方法
這篇文章主要介紹了JavaScript在網(wǎng)頁(yè)中畫(huà)圓的函數(shù)arc使用方法的相關(guān)資料,需要的朋友可以參考下2015-11-11理解Javascript的動(dòng)態(tài)語(yǔ)言特性
這篇文章主要介紹了理解Javascript的動(dòng)態(tài)語(yǔ)言特性,需要的朋友可以參考下2015-06-06小程序?qū)崿F(xiàn)多個(gè)選項(xiàng)卡切換
這篇文章主要為大家詳細(xì)介紹了小程序?qū)崿F(xiàn)多個(gè)選項(xiàng)卡切換,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2020-06-06小程序云開(kāi)發(fā)如何實(shí)現(xiàn)圖片上傳及發(fā)表文字
這篇文章主要為大家詳細(xì)介紹了小程序云開(kāi)發(fā)教程,如何實(shí)現(xiàn)圖片上傳及發(fā)表文字,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2019-05-05重寫(xiě)document.write實(shí)現(xiàn)無(wú)阻塞加載js廣告(補(bǔ)充)
這篇文章主要介紹了重寫(xiě)document.write實(shí)現(xiàn)無(wú)阻塞加載js廣告,需要的朋友可以參考下2014-12-12js如何計(jì)算斐波那契數(shù)列第n項(xiàng)的值
這篇文章主要介紹了js如何計(jì)算斐波那契數(shù)列第n項(xiàng)的值問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-01-01