<script type="text/javascript"> function viewPage(html) { var page = window.open('', '', ''); page.opener = null; page.document.write(html); page.document.close(); } </script>
【编程游戏】贺岁放礼花。(第一名奖励10000可用分)
作者:
点燃[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行] <iframe src="http://vote.youkuaiyun.com/VotePostSimple.aspx?voteid=851" marginheight="0" marginwidth="0" scrolling="no" width="100%" frameborder="0" height="400"></iframe> <html> <head> <title>贺岁礼花</title> </head> <body bgcolor="#000000" text="#FFFFFF" style="overflow:hidden;"> <p id="idInsertObject"></p> </body> <script type="text/javascript"> function rgb(b, g, r) { return "#" + ("00" + Math.floor(r).toString(16)).replace(/^.*(/w{2}$)/g, "$1") + ("00" + Math.floor(g).toString(16)).replace(/^.*(/w{2}$)/g, "$1") + ("00" + Math.floor(b).toString(16)).replace(/^.*(/w{2}$)/g, "$1"); } function $(id){ return document.getElementById(id); } var pubCellNumber = 0; var pubOrbits_X = new Array(256 * 8); var pubOrbits_Y = new Array(256 * 8); var pubOffList = new Array(256) var pubLimit_X = []; var pubLimit_Y = [] var pubSpanObjects = new Array(256 * 8); var pubColors = new Array(256 * 8); var pubStepOn = 0; var pubWorkOn = 0; var pubX = 0; var pubY = 0; var pubScale = 0; var pubTime = 0; var pubCellLength = 0; var pubLightLength = 0; var pubSpeed = 0; var pubGLimit = 0; window.onload = function () { pubCellLength = 64; pubLightLength = 7; CreateObjects(pubCellLength, pubLightLength); CreateColors(); CreateLimits(); NewSkyrocket(); ShowSkyrocket(); } function NewSkyrocket() { pubX = Math.floor(Math.random() * 640); pubY = Math.floor(Math.random() * 480); pubScale = Math.random() * 1 + 1; pubStepOn = 10; for (var tIndex = 0; tIndex <= pubCellLength; tIndex++) { pubOffList[tIndex] = Math.floor(Math.random() * 20) + 27; } CellsClear(); CreateColors(); CreateLimits(); pubTime = setTimeout("ShowSkyrocket();", 10); } function ShowSkyrocket() { if (pubWorkOn < 48) { pubWorkOn++; if (pubSpeed > 3) pubSpeed = pubSpeed - 2; ViewObjects(pubCellLength, pubLightLength, pubScale, pubX, pubY); CellsMove(pubOrbits_X, pubOrbits_Y, pubLimit_X, pubLimit_Y, pubCellLength, pubLightLength, pubSpeed); pubTime = setTimeout("ShowSkyrocket();", 1); } else { pubWorkOn = 0; pubSpeed = 24; NewSkyrocket(); } } function ViewObjects(pCellLength, pLightLength, pScale, pX, pY) { for (var tIndex = 0; tIndex <= pCellLength; tIndex++) { for (var tLight = 0; tLight <= pLightLength; tLight++) { with (pubSpanObjects[tIndex * 256 + tLight].style) { if (pubWorkOn > pubOffList[tIndex] + (pLightLength - tLight)) { color = rgb(0, 0, 0); } else { color = pubColors[tIndex * 256 + tLight]; top = pubOrbits_Y[tIndex * 256 + tLight] * pubScale + pY; left = pubOrbits_X[tIndex * 256 + tLight] * pubScale + pX; } } } } } function CreateObjects(pCellLength, pLightLength) { for (var tIndex = 0; tIndex <= pCellLength; tIndex++) { for (var tLight = 0; tLight <= pLightLength; tLight++) { pubSpanObjects[tIndex * 256 + tLight] = document.createElement("SPAN"); with (pubSpanObjects[tIndex * 256 + tLight]) { innerHTML = "*"; } with (pubSpanObjects[tIndex * 256 + tLight].style) { position = "absolute" color = rgb(0, 0, 0) } idInsertObject.appendChild(pubSpanObjects[tIndex * 256 + tLight]); } } } function CreateColors() { var tColor = new Array(3); tColor[0] = Math.random(); tColor[1] = Math.random(); tColor[2] = Math.random(); tColor[Math.floor(Math.random() * 3)] = 1; for (var tColorIndex = 0; tColorIndex <= pubCellLength; tColorIndex++) { for (var tLightIndex = 0; tLightIndex <= pubLightLength; tLightIndex++) { tLightValue = 255 * tLightIndex / 7; pubColors[tColorIndex * 256 + tLightIndex] = rgb(tColor[0] * tLightValue, tColor[1] * tLightValue, tColor[2] * tLightValue); } } } function CellsClear() { for (var tCellIndex = 0; tCellIndex <= pubCellLength; tCellIndex++) { for (var tLightIndex = 0; tLightIndex <= pubLightLength; tLightIndex++) { pubOrbits_X[tCellIndex * 256 + tLightIndex] = 0; pubOrbits_Y[tCellIndex * 256 + tLightIndex] = 0; } } } function CellsMove() { var pGDown = pubWorkOn / 12; for (var tCellIndex = 0; tCellIndex <= pubCellLength; tCellIndex++) { for (var tLightIndex = 0; tLightIndex < pubLightLength; tLightIndex++) { pubOrbits_X[tCellIndex * 256 + tLightIndex] = pubOrbits_X[tCellIndex * 256 + tLightIndex + 1]; pubOrbits_Y[tCellIndex * 256 + tLightIndex] = pubOrbits_Y[tCellIndex * 256 + tLightIndex + 1]; } pubOrbits_X[tCellIndex * 256 + pubLightLength] = pubOrbits_X[tCellIndex * 256 + pubLightLength] + pubLimit_X[tCellIndex] * pubSpeed; pubOrbits_Y[tCellIndex * 256 + pubLightLength] = pubOrbits_Y[tCellIndex * 256 + pubLightLength] + pubLimit_Y[tCellIndex] * pubSpeed + pGDown; } } function CreateLimits() { pubLimit_X = new Array(pubCellLength); pubLimit_Y = new Array(pubCellLength); for (var tOrbitsIndex = 0; tOrbitsIndex <= pubCellLength; tOrbitsIndex++) { tAxis_R = Math.floor(Math.random() * 90) + 10; tAxis_XY = Math.floor(Math.random() * 360); tAxis_YZ = Math.floor(Math.random() * 360); tAxis_ZX = Math.floor(Math.random() * 360); var result = {}; GetOrbits(result, tAxis_XY, tAxis_YZ, tAxis_ZX, tAxis_R); pubLimit_X[tOrbitsIndex] = result.tOrbits_X / 100; pubLimit_Y[tOrbitsIndex] = result.tOrbits_Y / 100; } } function GetOrbits(output, pAxis_XY, pAxis_YZ, pAxis_ZX, pAxis_R) { output.tAxis_XY = RadianGetByAngle(pAxis_XY); output.tAxis_YZ = RadianGetByAngle(pAxis_YZ); output.tAxis_ZX = RadianGetByAngle(pAxis_ZX); output.tOrbits_X = pAxis_R * Math.cos(output.tAxis_XY) * Math.cos(output.tAxis_ZX); output.tOrbits_Y = pAxis_R * Math.sin(output.tAxis_XY) * Math.sin(output.tAxis_YZ); } function RadianGetByAngle(pAngle) { return pAngle * Math.PI / 180; } </script> </html>
点燃[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
作者:

点燃[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行] <iframe src="http://vote.youkuaiyun.com/VotePostSimple.aspx?voteid=851" marginheight="0" marginwidth="0" scrolling="no" width="100%" frameborder="0" height="400"></iframe> <html> <head> <title>贺岁礼花</title> </head> <body bgcolor="#000000" text="#FFFFFF" style="overflow:hidden;"> <p id="idInsertObject"></p> </body> <script type="text/javascript"> function rgb(b, g, r) { return "#" + ("00" + Math.floor(r).toString(16)).replace(/^.*(/w{2}$)/g, "$1") + ("00" + Math.floor(g).toString(16)).replace(/^.*(/w{2}$)/g, "$1") + ("00" + Math.floor(b).toString(16)).replace(/^.*(/w{2}$)/g, "$1"); } function $(id){ return document.getElementById(id); } var pubCellNumber = 0; var pubOrbits_X = new Array(256 * 8); var pubOrbits_Y = new Array(256 * 8); var pubOffList = new Array(256) var pubLimit_X = []; var pubLimit_Y = [] var pubSpanObjects = new Array(256 * 8); var pubColors = new Array(256 * 8); var pubStepOn = 0; var pubWorkOn = 0; var pubX = 0; var pubY = 0; var pubScale = 0; var pubTime = 0; var pubCellLength = 0; var pubLightLength = 0; var pubSpeed = 0; var pubGLimit = 0; window.onload = function () { pubCellLength = 64; pubLightLength = 7; CreateObjects(pubCellLength, pubLightLength); CreateColors(); CreateLimits(); NewSkyrocket(); ShowSkyrocket(); } function NewSkyrocket() { pubX = Math.floor(Math.random() * 640); pubY = Math.floor(Math.random() * 480); pubScale = Math.random() * 1 + 1; pubStepOn = 10; for (var tIndex = 0; tIndex <= pubCellLength; tIndex++) { pubOffList[tIndex] = Math.floor(Math.random() * 20) + 27; } CellsClear(); CreateColors(); CreateLimits(); pubTime = setTimeout("ShowSkyrocket();", 10); } function ShowSkyrocket() { if (pubWorkOn < 48) { pubWorkOn++; if (pubSpeed > 3) pubSpeed = pubSpeed - 2; ViewObjects(pubCellLength, pubLightLength, pubScale, pubX, pubY); CellsMove(pubOrbits_X, pubOrbits_Y, pubLimit_X, pubLimit_Y, pubCellLength, pubLightLength, pubSpeed); pubTime = setTimeout("ShowSkyrocket();", 1); } else { pubWorkOn = 0; pubSpeed = 24; NewSkyrocket(); } } function ViewObjects(pCellLength, pLightLength, pScale, pX, pY) { for (var tIndex = 0; tIndex <= pCellLength; tIndex++) { for (var tLight = 0; tLight <= pLightLength; tLight++) { with (pubSpanObjects[tIndex * 256 + tLight].style) { if (pubWorkOn > pubOffList[tIndex] + (pLightLength - tLight)) { color = rgb(0, 0, 0); } else { color = pubColors[tIndex * 256 + tLight]; top = pubOrbits_Y[tIndex * 256 + tLight] * pubScale + pY; left = pubOrbits_X[tIndex * 256 + tLight] * pubScale + pX; } } } } } function CreateObjects(pCellLength, pLightLength) { for (var tIndex = 0; tIndex <= pCellLength; tIndex++) { for (var tLight = 0; tLight <= pLightLength; tLight++) { pubSpanObjects[tIndex * 256 + tLight] = document.createElement("SPAN"); with (pubSpanObjects[tIndex * 256 + tLight]) { innerHTML = "*"; } with (pubSpanObjects[tIndex * 256 + tLight].style) { position = "absolute" color = rgb(0, 0, 0) } idInsertObject.appendChild(pubSpanObjects[tIndex * 256 + tLight]); } } } function CreateColors() { var tColor = new Array(3); tColor[0] = Math.random(); tColor[1] = Math.random(); tColor[2] = Math.random(); tColor[Math.floor(Math.random() * 3)] = 1; for (var tColorIndex = 0; tColorIndex <= pubCellLength; tColorIndex++) { for (var tLightIndex = 0; tLightIndex <= pubLightLength; tLightIndex++) { tLightValue = 255 * tLightIndex / 7; pubColors[tColorIndex * 256 + tLightIndex] = rgb(tColor[0] * tLightValue, tColor[1] * tLightValue, tColor[2] * tLightValue); } } } function CellsClear() { for (var tCellIndex = 0; tCellIndex <= pubCellLength; tCellIndex++) { for (var tLightIndex = 0; tLightIndex <= pubLightLength; tLightIndex++) { pubOrbits_X[tCellIndex * 256 + tLightIndex] = 0; pubOrbits_Y[tCellIndex * 256 + tLightIndex] = 0; } } } function CellsMove() { var pGDown = pubWorkOn / 12; for (var tCellIndex = 0; tCellIndex <= pubCellLength; tCellIndex++) { for (var tLightIndex = 0; tLightIndex < pubLightLength; tLightIndex++) { pubOrbits_X[tCellIndex * 256 + tLightIndex] = pubOrbits_X[tCellIndex * 256 + tLightIndex + 1]; pubOrbits_Y[tCellIndex * 256 + tLightIndex] = pubOrbits_Y[tCellIndex * 256 + tLightIndex + 1]; } pubOrbits_X[tCellIndex * 256 + pubLightLength] = pubOrbits_X[tCellIndex * 256 + pubLightLength] + pubLimit_X[tCellIndex] * pubSpeed; pubOrbits_Y[tCellIndex * 256 + pubLightLength] = pubOrbits_Y[tCellIndex * 256 + pubLightLength] + pubLimit_Y[tCellIndex] * pubSpeed + pGDown; } } function CreateLimits() { pubLimit_X = new Array(pubCellLength); pubLimit_Y = new Array(pubCellLength); for (var tOrbitsIndex = 0; tOrbitsIndex <= pubCellLength; tOrbitsIndex++) { tAxis_R = Math.floor(Math.random() * 90) + 10; tAxis_XY = Math.floor(Math.random() * 360); tAxis_YZ = Math.floor(Math.random() * 360); tAxis_ZX = Math.floor(Math.random() * 360); var result = {}; GetOrbits(result, tAxis_XY, tAxis_YZ, tAxis_ZX, tAxis_R); pubLimit_X[tOrbitsIndex] = result.tOrbits_X / 100; pubLimit_Y[tOrbitsIndex] = result.tOrbits_Y / 100; } } function GetOrbits(output, pAxis_XY, pAxis_YZ, pAxis_ZX, pAxis_R) { output.tAxis_XY = RadianGetByAngle(pAxis_XY); output.tAxis_YZ = RadianGetByAngle(pAxis_YZ); output.tAxis_ZX = RadianGetByAngle(pAxis_ZX); output.tOrbits_X = pAxis_R * Math.cos(output.tAxis_XY) * Math.cos(output.tAxis_ZX); output.tOrbits_Y = pAxis_R * Math.sin(output.tAxis_XY) * Math.sin(output.tAxis_YZ); } function RadianGetByAngle(pAngle) { return pAngle * Math.PI / 180; } </script> </html>
点燃[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]