<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=817" marginheight="0" marginwidth="0" scrolling="no" width="100%" frameborder="0" height="400"></iframe> <html> <head> <title>【编程游戏】贺岁放礼花。</title> </head> <body bgcolor="#000000" text="#FFFFFF"> <p id="idInsertObject"></p> </body> <script type="text/javascript"> var pubSpanObjects = new Array(256 * 256); var pubColors = new Array(256 * 256); var pubStepOn = 0; var pubWorkOn = 0; var pubX = 0; var pubY = 0; var pubScale = 1; var pubTime = 0; pubOrbits_X = new Array(256 * 256); pubOrbits_Y = new Array(256 * 256); CreateObjects(); CreateColors(); CreateOrbits(); ViewObjects(1, 255, 255, 255); NewSkyrocket(); ShowSkyrocket(); 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); } function NewSkyrocket() { pubX = Math.floor(Math.random() * 640); pubY = Math.floor(Math.random() * 480); pubScale = Math.random() * 2 + 2; pubStepOn = 12; pubTime = setTimeout("ShowSkyrocket();", 1); } function ShowSkyrocket() { if (pubWorkOn >= 100 && pubWorkOn <= 244) { if (pubStepOn > 1) pubStepOn = pubStepOn - 1; } if (pubWorkOn >= 225 && pubWorkOn <= 255) pubStepOn = 1; if (pubWorkOn < 256) { pubWorkOn = pubWorkOn + pubStepOn; ViewObjects(pubScale, pubWorkOn, pubX, pubY); pubTime = setTimeout("ShowSkyrocket();", 1); } else { pubWorkOn = 0; ViewObjects(pubScale, pubWorkOn, pubX, pubY); NewSkyrocket(); } } function ViewObjects(pScale, pIndex, pX, pY) { for (var tIndex = 0; tIndex <= 255; tIndex++) { if (pIndex < 256) { with (pubSpanObjects[tIndex].style) { color = pubColors[tIndex * 256 + pIndex]; top = pubOrbits_Y[tIndex * 256 + pIndex] * pScale + pY + "px"; left = pubOrbits_X[tIndex * 256 + pIndex] * pScale + pX + "px"; } } } } function CreateObjects() { for (var tIndex = 0; tIndex <= 255; tIndex++) { pubSpanObjects[tIndex] = document.createElement("SPAN"); with (pubSpanObjects[tIndex]) { innerHTML = "*"; } with (pubSpanObjects[tIndex].style) { position = "absolute"; left = "0px"; top = "0px"; color = rgb(0, 0, 0); } $("idInsertObject").appendChild(pubSpanObjects[tIndex]); } } function CreateColors() { var tColor = {}; for (var tColorIndex = 0; tColorIndex <= 255; tColorIndex++) { tColor[0] = Math.random(); tColor[1] = Math.random(); tColor[2] = Math.random(); tColor[Math.floor(Math.random() * 3)] = 1; tLightLen = Math.floor(Math.random() * 50) + 50; for (var tLightIndex = 0; tLightIndex <= 99; tLightIndex++) { pubColors[tColorIndex * 256 + tLightIndex] = rgb(0, (tLightIndex * 128) / 100, (tLightIndex * 255) / 100); } for (var tLightIndex = 100; tLightIndex <= 199; tLightIndex++) { pubColors[tColorIndex * 256 + tLightIndex] = 0; } for (var tLightIndex = 100; tLightIndex <= 100 + tLightLen; tLightIndex++) { pubColors[tColorIndex * 256 + tLightIndex] = rgb((tColor[0] * (tLightIndex - 100) * 255) / tLightLen, (tColor[1] * (tLightIndex - 100) * 255) / tLightLen, (tColor[2] * (tLightIndex - 100) * 255) / tLightLen); } for (var tLightIndex = 200; tLightIndex <= 224; tLightIndex++) { pubColors[tColorIndex * 256 + tLightIndex] = rgb(0, (tLightIndex - 200) * 64 / 24, (tLightIndex - 200) * 128 / 24); } for (var tLightIndex = 225; tLightIndex <= 255; tLightIndex++) { pubColors[tColorIndex * 256 + tLightIndex] = Math.floor(Math.random() * 3) == 0 ? rgb(255, 255, 255) : rgb(0, 0, 0); } } } function CreateOrbits() { for (var tOrbitsIndex = 0; tOrbitsIndex <= 255; tOrbitsIndex++) { var tAxis_R = Math.floor(Math.random() * 50) + 50; var tAxis_XY = Math.floor(Math.random() * 360); var tAxis_YZ = Math.floor(Math.random() * 360); var tAxis_ZX = Math.floor(Math.random() * 360); var result = {}; GetOrbits(result, tAxis_XY, tAxis_YZ, tAxis_ZX, tAxis_R); for (var tLightIndex = 0; tLightIndex <= 255; tLightIndex++) { pubOrbits_X[tOrbitsIndex * 256 + tLightIndex] = result.tOrbits_X * tLightIndex / 255; pubOrbits_Y[tOrbitsIndex * 256 + tLightIndex] = result.tOrbits_Y * tLightIndex / 255; } } } 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=817" marginheight="0" marginwidth="0" scrolling="no" width="100%" frameborder="0" height="400"></iframe> <html> <head> <title>【编程游戏】贺岁放礼花。</title> </head> <body bgcolor="#000000" text="#FFFFFF"> <p id="idInsertObject"></p> </body> <script type="text/javascript"> var pubSpanObjects = new Array(256 * 256); var pubColors = new Array(256 * 256); var pubStepOn = 0; var pubWorkOn = 0; var pubX = 0; var pubY = 0; var pubScale = 1; var pubTime = 0; pubOrbits_X = new Array(256 * 256); pubOrbits_Y = new Array(256 * 256); CreateObjects(); CreateColors(); CreateOrbits(); ViewObjects(1, 255, 255, 255); NewSkyrocket(); ShowSkyrocket(); 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); } function NewSkyrocket() { pubX = Math.floor(Math.random() * 640); pubY = Math.floor(Math.random() * 480); pubScale = Math.random() * 2 + 2; pubStepOn = 12; pubTime = setTimeout("ShowSkyrocket();", 1); } function ShowSkyrocket() { if (pubWorkOn >= 100 && pubWorkOn <= 244) { if (pubStepOn > 1) pubStepOn = pubStepOn - 1; } if (pubWorkOn >= 225 && pubWorkOn <= 255) pubStepOn = 1; if (pubWorkOn < 256) { pubWorkOn = pubWorkOn + pubStepOn; ViewObjects(pubScale, pubWorkOn, pubX, pubY); pubTime = setTimeout("ShowSkyrocket();", 1); } else { pubWorkOn = 0; ViewObjects(pubScale, pubWorkOn, pubX, pubY); NewSkyrocket(); } } function ViewObjects(pScale, pIndex, pX, pY) { for (var tIndex = 0; tIndex <= 255; tIndex++) { if (pIndex < 256) { with (pubSpanObjects[tIndex].style) { color = pubColors[tIndex * 256 + pIndex]; top = pubOrbits_Y[tIndex * 256 + pIndex] * pScale + pY + "px"; left = pubOrbits_X[tIndex * 256 + pIndex] * pScale + pX + "px"; } } } } function CreateObjects() { for (var tIndex = 0; tIndex <= 255; tIndex++) { pubSpanObjects[tIndex] = document.createElement("SPAN"); with (pubSpanObjects[tIndex]) { innerHTML = "*"; } with (pubSpanObjects[tIndex].style) { position = "absolute"; left = "0px"; top = "0px"; color = rgb(0, 0, 0); } $("idInsertObject").appendChild(pubSpanObjects[tIndex]); } } function CreateColors() { var tColor = {}; for (var tColorIndex = 0; tColorIndex <= 255; tColorIndex++) { tColor[0] = Math.random(); tColor[1] = Math.random(); tColor[2] = Math.random(); tColor[Math.floor(Math.random() * 3)] = 1; tLightLen = Math.floor(Math.random() * 50) + 50; for (var tLightIndex = 0; tLightIndex <= 99; tLightIndex++) { pubColors[tColorIndex * 256 + tLightIndex] = rgb(0, (tLightIndex * 128) / 100, (tLightIndex * 255) / 100); } for (var tLightIndex = 100; tLightIndex <= 199; tLightIndex++) { pubColors[tColorIndex * 256 + tLightIndex] = 0; } for (var tLightIndex = 100; tLightIndex <= 100 + tLightLen; tLightIndex++) { pubColors[tColorIndex * 256 + tLightIndex] = rgb((tColor[0] * (tLightIndex - 100) * 255) / tLightLen, (tColor[1] * (tLightIndex - 100) * 255) / tLightLen, (tColor[2] * (tLightIndex - 100) * 255) / tLightLen); } for (var tLightIndex = 200; tLightIndex <= 224; tLightIndex++) { pubColors[tColorIndex * 256 + tLightIndex] = rgb(0, (tLightIndex - 200) * 64 / 24, (tLightIndex - 200) * 128 / 24); } for (var tLightIndex = 225; tLightIndex <= 255; tLightIndex++) { pubColors[tColorIndex * 256 + tLightIndex] = Math.floor(Math.random() * 3) == 0 ? rgb(255, 255, 255) : rgb(0, 0, 0); } } } function CreateOrbits() { for (var tOrbitsIndex = 0; tOrbitsIndex <= 255; tOrbitsIndex++) { var tAxis_R = Math.floor(Math.random() * 50) + 50; var tAxis_XY = Math.floor(Math.random() * 360); var tAxis_YZ = Math.floor(Math.random() * 360); var tAxis_ZX = Math.floor(Math.random() * 360); var result = {}; GetOrbits(result, tAxis_XY, tAxis_YZ, tAxis_ZX, tAxis_R); for (var tLightIndex = 0; tLightIndex <= 255; tLightIndex++) { pubOrbits_X[tOrbitsIndex * 256 + tLightIndex] = result.tOrbits_X * tLightIndex / 255; pubOrbits_Y[tOrbitsIndex * 256 + tLightIndex] = result.tOrbits_Y * tLightIndex / 255; } } } 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 全部选择 提示:你可先修改部分代码,再按运行]