【编程游戏】贺岁霓虹灯。(第一名奖励10000可用分) 效果图 评分 参观 [目前Firefox中好使,其他浏览器需复制到本地,存为html文件看效果] <html> <head> <title></title> </head> <body bgcolor="#000000" text="#FFFFFF"> <p id="idInsertObject"></p> </body> <script languate="VBScript" type="text/VBScript"> Dim pubOrbits_X(255, 255) Dim pubOrbits_Y(255, 255) Dim pubOrbits_Z(255, 255) Dim pubSpanObjects(255) Dim pubColors(255, 255) Dim pubStepOn Dim pubWorkOn Dim pubX Dim pubY Dim pubScale Dim pubTime Sub window_onload() CreateObjects CreateColors CreateOrbits pubOrbits_X, pubOrbits_Y, pubOrbits_Z NewSkyrocket ShowSkyrocket End Sub Sub NewSkyrocket() pubX= 300 pubY= 300 pubScale = 2 'Rnd * 2 + 2 pubTime = window.setTimeout("ShowSkyrocket", 1) End Sub Sub ShowSkyrocket() If pubWorkOn <= 255 Then pubWorkOn = (pubWorkOn + 1) mod 256 ViewObjects pubScale, pubWorkOn, pubX, pubY pubTime = window.setTimeout("ShowSkyrocket", 33) Else pubWorkOn = 0 ViewObjects pubScale, pubWorkOn, pubX, pubY NewSkyrocket End If End Sub Sub ViewObjects(pScale, pIndex, pX, pY) For tIndex = 0 To 255 If pIndex < 256 Then With pubSpanObjects(tIndex).style tSize = (pubOrbits_Z(tIndex, pIndex) + 200) * 10 / 200 'tLongLight = (pubOrbits_Z(tIndex, pIndex) + 200) * 64 / 200 'tShowLight = (pubOrbits_Z(tIndex, pIndex) + 200) * 100 / 200 tLight = (pubOrbits_Z(tIndex, pIndex) + 200) * 170 / 200 .color = pubColors(tIndex, tLight) .top = pubOrbits_Y(tIndex, pIndex) * pScale * (tSize / 10) + pY - (tSize / 2) .left = pubOrbits_X(tIndex, pIndex) * pScale * (tSize / 10) + pX - (tSize / 2) .fontsize = tSize & "px" .zindex = tSize End With End If Next End Sub Sub CreateObjects() For tIndex = 0 To 255 Set pubSpanObjects(tIndex) = document.createElement("SPAN") With pubSpanObjects(tIndex) .innerText = "*" End With With pubSpanObjects(tIndex).style .position = "absolute" .color = Rgb(0, 0, 0) End With idInsertObject.insertAdjacentElement "beForeEnd", pubSpanObjects(tIndex) Next End Sub Sub CreateColors() Dim tColor(2) For tColorIndex = 0 To 63 tColor(0) = Rnd * 0.5 + 0.5 : tColor(1) = Rnd * 0.5 + 0.5 : tColor(2) = Rnd * 0.5 + 0.5 tColor(Int(Rnd*3)) = 1 For tLightIndex = 0 To 255 pubColors(tColorIndex, tLightIndex) = rgb(tColor(0) * tLightIndex, tColor(1) * tLightIndex, tColor(2) * tLightIndex) Next Next For tColorIndex = 64 To 255 tColor(0) = Rnd : tColor(1) = Rnd : tColor(2) = Rnd tColor(Int(Rnd*3)) = 1 For tLightIndex = 0 To 255 pubColors(tColorIndex, tLightIndex) = rgb(tColor(0) * tLightIndex, tColor(1) * tLightIndex, tColor(2) * tLightIndex) Next Next End Sub Sub CreateOrbits(pOrbits_X(), pOrbits_Y(), pOrbits_Z()) tAxis_YZ = 0 tAxis_R = 50 For tOrbitsIndex = 0 To 63 tAxis_XY = Int(Rnd * 360) tAxis_ZX = Int(Rnd * 360) For tLightIndex = 0 To 255 tTempZX = (tAxis_ZX + (tLightIndex * 360) / 255) Mod 360 GetOrbits tAxis_XY, tAxis_YZ, tTempZX, tAxis_R, tOrbits_X, tOrbits_Y, tOrbits_Z pOrbits_X(tOrbitsIndex, tLightIndex) = tOrbits_X pOrbits_Y(tOrbitsIndex, tLightIndex) = tOrbits_Y pOrbits_Z(tOrbitsIndex, tLightIndex) = tOrbits_Z Next Next tAxis_R = 100 For tOrbitsIndex = 64 To 255 tAxis_XY = Int(Rnd * 360) tAxis_ZX = Int(Rnd * 360) For tLightIndex = 0 To 255 tTempZX = (tAxis_ZX + (tLightIndex * 360) / 255) Mod 360 GetOrbits tAxis_XY, tAxis_YZ, tTempZX, tAxis_R, tOrbits_X, tOrbits_Y, tOrbits_Z pOrbits_X(tOrbitsIndex, tLightIndex) = tOrbits_X pOrbits_Y(tOrbitsIndex, tLightIndex) = tOrbits_Y pOrbits_Z(tOrbitsIndex, tLightIndex) = tOrbits_Z Next Next End Sub Sub GetOrbits(pAxis_XY, pAxis_YZ, pAxis_ZX, pAxis_R, pOrbits_X, pOrbits_Y, pOrbits_Z) tAxis_XY = RadianGetByAngle(pAxis_XY) tAxis_YZ = RadianGetByAngle(pAxis_YZ) tAxis_ZX = RadianGetByAngle(pAxis_ZX) 'pOrbits_X = pAxis_R * Cos(tAxis_XY) * Sin(tAxis_ZX) 'pOrbits_Y = pAxis_R * Sin(tAxis_XY) * Cos(tAxis_YZ) 'pOrbits_Z = pAxis_R * Cos(tAxis_ZX) pOrbits_X = pAxis_R * Cos(tAxis_XY) * Sin(tAxis_ZX) pOrbits_Y = pAxis_R * Sin(tAxis_XY) * Cos(tAxis_YZ) pOrbits_Z = pAxis_R * Cos(tAxis_ZX) * Cos(tAxis_XY)'Cos(tAxis_YZ) End Sub Function RadianGetByAngle(pAngle) RadianGetByAngle =pAngle * 3.1415926 / 180 End Function </script> </html> 参观 [目前Firefox中好使,其他浏览器需复制到本地,存为html文件看效果]