♀方圍..定礎..結!!♂就讓你走進我的絕界裡頭吧!! 心境不夠平靜根本不能稱得上是術者!!@o@ ''還未成為成功的術者根本不可能進入黑芒的
 
首頁歡迎頁日曆相冊常見問題搜尋會員列表會員群組會員註冊登入

分享 | 
 

 程式名稱 : 火花釋放效果

上一篇主題 下一篇主題 向下 
發表人內容
☆卍滿天星卍"◇
Admin
avatar

文章數 : 170
注冊日期 : 2009-09-24
年齡 : 19

發表主題: 程式名稱 : 火花釋放效果   12/3/2010, 3:40 pm

步驟一 :
將以下程式碼複製 , 貼在網頁原始檔HTML <body> 與 </body> 之間 .
<SCRIPT LANGUAGE="JavaScript1.2" TYPE="text/javascript">
<!--wenchin
var fireNo = 6;
var fireSize = 150;
var speed = 5;
var wa = 6;
var space = 15
var fireColor = new Array('#ffffff','#ff0000','#00ff00','#ffff00','#00ffff','#ff00ff','#ff8000','#ff80ff','#ff0080');

var _dom=(document.all?3:(document.getElementById?1:(document.layers?2:0)));
var fireLay="";
for (i=0; i<fireNo*wa; i++) {
if (_dom == 1 || _dom == 3) {
fireLay += '<DIV id="fire' + i + '" style="position:absolute; width:1px; height:1px left:0px; top=0px; font-size:1px; background:#FFFFFF;"></DIV>';
}
if (_dom == 2) {
fireLay += '<LAYER name="fire'+ i +'" left="0" top="0" clip="0,0,1,1" bgcolor="#FFFFFF"></LAYER>\n';
}
}
document.writeln(fireLay);

function getWindowSize() {
if(_dom == 1 || _dom == 2) {
win_width = self.innerWidth;
win_height = self.innerHeight;
}
if (_dom == 3) {
win_width = document.body.clientWidth;
win_height = document.body.clientHeight;
}
}

function getScrollPosY() {
if (_dom == 1) return scrollY;
if (_dom == 2) return pageYOffset;
if (_dom == 3) return document.body.scrollTop;
}

function showLayer(layerName){
if (_dom == 1) document.getElementById(layerName).style.visibility = "visible";
if (_dom == 2) document.layers[layerName].visibility = "show";
if (_dom == 3) document.all(layerName).style.visibility = "visible";
}

function hideLayer(layerName){
if (_dom == 1) document.getElementById(layerName).style.visibility = "hidden";
if (_dom == 2) document.layers[layerName].visibility = "hide";
if (_dom == 3) document.all(layerName).style.visibility = "hidden";
}

function hanabi() {
for (i=0; i<fireNo*wa; i++) {
if (_dom == 1) var div = document.getElementById("fire" + i).style;
if (_dom == 2) var div = document.layers["fire" + i];
if (_dom == 3) var div = document.all("fire" + i).style;
zure1 = Math.floor(i/fireNo)%2 == 0 ? 0:(Math.PI / fireNo);
zure2 = Math.floor(i/fireNo) * space;
ran = (radius1>(fireSize*0.8)) ? Math.floor(Math.random()*20-10) : 0;
radius2 = (radius1 - zure2) > 0 ? radius1 - zure2 : 0;
if ((radius1 - zure2) > fireSize) { hideLayer("fire" + i); }
else { showLayer("fire" + i); }
div.left = centerX + Math.cos(i * (Math.PI * 2 / fireNo) + zure1) * (radius2) + ran;
div.top = centerY + Math.sin(i * (Math.PI * 2 / fireNo) + zure1) * (radius2) + ran;
if (radius2 < fireSize * 0.4) {
if (_dom == 1 || _dom == 3) {
div.background = startColor;
div.width = 1;
div.height = 1;
}
if (_dom == 2){
div.bgColor = startColor;
div.clip.width = 1;
div.clip.height = 1;
}
} else if (radius2 < fireSize * 0.8) {
if (_dom == 1 || _dom == 3) {
div.width = 2;
div.height = 2;
}
if (_dom == 2){
div.clip.width = 2;
div.clip.height = 2;
}
} else {
if (_dom == 1 || _dom == 3) {
div.background = fireColor[Math.floor(Math.random() * fireColor.length)];
div.width = Math.floor(Math.random()*2+1);
div.height = Math.floor(Math.random()*2+1);
}
if (_dom == 2){
div.bgColor = fireColor[Math.floor(Math.random() * fireColor.length)];
div.clip.width = Math.floor(Math.random()*2+1);
div.clip.height = Math.floor(Math.random()*2+1);
}
}
}
radius1 += speed;
if (radius1 > (fireSize + space * wa)) { setHanabiPos(); }
else { setTimeout("hanabi()",10);}
}

function setHanabiPos() {
rev = 0; radius1 = 0;
getWindowSize(); sclY = getScrollPosY();
startColor = fireColor[Math.floor(Math.random() * fireColor.length)];
centerX = Math.floor(Math.random() * (win_width - (fireSize + space * wa) * 2) + (fireSize + space * wa));
centerY = Math.floor(Math.random() * (win_height - (fireSize + space * wa) * 2) + (fireSize + space * wa)) + sclY;
setTimeout("hanabi()",1000);
}

setHanabiPos();

//wenchin -->
</SCRIPT>
回頂端 向下
http://enjoytheworld.forum888.tw
 
程式名稱 : 火花釋放效果
上一篇主題 下一篇主題 回頂端 
1頁(共1頁)

這個論壇的權限:無法 在這個版面回復文章
☆★㊣論壇俱樂部㊣★☆ :: 俱樂部之城 I :: 程式分享俱樂部-
前往: