【编程游戏】贺岁霓虹灯。(第一名奖励10000可用分) 效果图 评分 参观 [目前Firefox中好使,其他浏览器需复制到本地,存为html文件看效果] <html> <head> <title>K.G Script3D 3.00 - 霓虹灯(维纳斯裙摆)</title> </head> <body bgcolor="#000000" text="#FFFFFF"> <p id="idText" style="color:rgb(255,255,255)"></p> <p id="idInsertObject"></p> </body> <script languate="VBScript" type="text/VBScript"> 'CSDN KiteGirl 原创 Dim pubS_Pix_x, pubS_Pix_y, pubS_Pix_z Dim pubS_Pix_cr, pubS_Pix_cg, pubS_Pix_cb Dim pubD_Mx, pubD_My, pubD_Mz Dim pubD_Rx, pubD_Ry, pubD_Rz Dim pubD_Mtx_Mx, pubD_Mtx_Mr Dim pubD_Pix_x, pubD_Pix_y, pubD_Pix_z, pubD_Pix_s Dim pubF_Va, pubF_Vd Dim pubV_Vx, pubV_Vy, pubV_Vz, pubV_Sc Dim pubV_Mtx_Mx, pubV_Mtx_Mr Dim pubV_Pix_x, pubV_Pix_y, pubV_Pix_z Dim pubElm, pubElm_Len Dim pubWeb_Tv, pubWeb_Tw Dim pubWeb_WW, pubWeb_WH Dim pubWeb_FontSize Dim pubLg Dim pubR, pubG, pubB Dim pubOR, pubOG, pubOB Sub window_onload() MakeModule With document.body pubWeb_WW = .clientWidth pubWeb_WH = .clientHeight End With pubD_Rz = 0 pubD_Rx = 0 pubD_Ry = 0 pubF_Va = 15 pubF_Vd = 60 pubV_Vx = pubWeb_WW / 2 pubV_Vy = pubWeb_WH / 2 pubV_Vz = 0 pubV_Sc = 10 pubWeb_Tw = 33 pubWeb_FontSize = 5 pubD_Mx = -30 pubD_My = -8 pubD_Mz = 0 MTX_3DMixV pubV_Vx, pubV_Vy, pubV_Vz, pubV_Sc, pubV_Mtx_Mx, pubV_Mtx_Mr Web_TimeLoop End Sub Sub MakeModule pubElm_Len = 960 pubElm = ELM_Create(pubElm_Len) ReDim pubS_Pix_x(pubElm_Len), pubS_Pix_y(pubElm_Len), pubS_Pix_z(pubElm_Len) ReDim pubS_Pix_cr(pubElm_Len), pubS_Pix_cg(pubElm_Len), pubS_Pix_cb(pubElm_Len) ReDim pubD_Pix_x(pubElm_Len), pubD_Pix_y(pubElm_Len), pubD_Pix_z(pubElm_Len) ReDim pubD_Pix_s(pubElm_Len), pubLg(pubElm_Len) ReDim pubV_Pix_x(pubElm_Len), pubV_Pix_y(pubElm_Len), pubV_Pix_z(pubElm_Len) For tI = 0 To pubElm_Len pubS_Pix_y(tI) = tI / 60 pubS_Pix_x(tI) = tI Mod 60 tA = Radian(pubS_Pix_x(tI) * 12) pubS_Pix_z(tI) = pubS_Pix_y(tI) * Sin(tA) / 2 pubLg(tI) = pubS_Pix_y(tI) / 16 Next End Sub Sub Web_TimeLoop() 'pubD_Rz = 45 pubD_Rz = Int(Timer * 50 Mod 6000) * 6 / 100 pubD_Rx = -45 pubD_Ry = 0 tWv = Int(Timer * 10) Mod 60 For tI = 0 To pubElm_Len pubS_Pix_y(tI) = tI / 60 pubS_Pix_x(tI) = tI Mod 60 tX = (pubS_Pix_x(tI) + tWv) Mod 60 tA = Radian(tX * 12) pubS_Pix_z(tI) = pubS_Pix_y(tI) * Sin(tA) / 2 pubLg(tI) = pubS_Pix_y(tI) / 16 Next MTX_3DMixD pubD_Mx, pubD_My, pubD_Mz, pubD_Rx, pubD_Ry, pubD_Rz, pubD_Mtx_Mx, pubD_Mtx_Mr PXE_MTXTram3D pubS_Pix_x, pubS_Pix_y, pubS_Pix_z, pubD_Mtx_Mx, pubD_Mtx_Mr, pubD_Pix_x, pubD_Pix_y, pubD_Pix_z FIT_PSV pubD_Pix_x, pubD_Pix_y, pubD_Pix_z, pubF_Va, pubF_Vd, pubD_Pix_x, pubD_Pix_y, pubD_Pix_z, pubD_Pix_s PXE_MTXTram3D pubD_Pix_x, pubD_Pix_y, pubD_Pix_z, pubV_Mtx_Mx, pubV_Mtx_Mr, pubV_Pix_x, pubV_Pix_y, pubV_Pix_z For tI = 0 To 10 ValueMove pubR, pubOR ValueMove pubG, pubOG ValueMove pubB, pubOB If pubR = pubOR And pubB = pubOB And pubG = pubOG Then pubOR = Int(Rnd * 64) + 63 pubOG = Int(Rnd * 64) + 63 pubOB = Int(Rnd * 64) + 63 End If For tEi = pubElm_Len To 0 Step -1 tY = tEi / 60 tX = tEi Mod 60 If CBool(tX) Then pubS_Pix_cr(tEi) = pubS_Pix_cr(tY * 60 + tX - 1) pubS_Pix_cg(tEi) = pubS_Pix_cg(tY * 60 + tX - 1) pubS_Pix_cb(tEi) = pubS_Pix_cb(tY * 60 + tX - 1) Else pubS_Pix_cr(tEi) = pubR * 2 pubS_Pix_cg(tEi) = pubG * 2 pubS_Pix_cb(tEi) = pubB * 2 End If Next Next For tEi = pubElm_Len To 0 Step -1 With pubElm(tEi).style .left = pubV_Pix_x(tEi) .top = pubV_Pix_y(tEi) .zindex = pubD_Pix_z(tEi) + 100 .backgroundcolor = rgb(pubS_Pix_cr(tEi) * pubLg(tEi), pubS_Pix_cg(tEi) * pubLg(tEi), pubS_Pix_cb(tEi) * pubLg(tEi)) .width = pubD_Pix_s(tEi) * pubWeb_FontSize & "px" .height = .width End With Next pubWeb_Tv = window.setTimeout("Web_TimeLoop", pubWeb_Tw) End Sub Sub ValueMove(pV, pVo) If pV < pVo Then pV = pV + 1 If pV > pVo Then pV = pV - 1 End Sub Function ELM_Create(pEn) ReDim tElms(pEn) For tEi = 0 To pEn With document Set tElms(tEi) = .createElement("DIV") .body.insertAdjacentElement "beForeEnd", tElms(tEi) End With With tElms(tEi) .style.position = "absolute" .style.backgroundcolor = rgb(255,255,255) .style.fontsize = 0 .style.width = 10 .style.height = 10 End With Next ELM_Create = tElms End Function 'PXE Sub PXE_MTXTram3D(pPx(), pPy(), pPz(), pM(), pMr(), oPx(), oPy(), oPz()) tPe = UBound(pPx) For tPi = 0 To tPe oPx(tPi) = pPx(tPi) * pM(0) + pPy(tPi) * pM(1) + pPz(tPi) * pM(2) + pM(3) oPy(tPi) = pPx(tPi) * pM(4) + pPy(tPi) * pM(5) + pPz(tPi) * pM(6) + pM(7) oPz(tPi) = pPx(tPi) * pM(8) + pPy(tPi) * pM(9) + pPz(tPi) * pM(10) + pM(11) Next End Sub 'FIT Sub FIT_PSV(iPx, iPy, iPz, iVa, iVd, oPx, oPy, oPz, oPs) tPe = UBound(iPx) For tPi = 0 To tPe tZ = iPz(tPi) + iVd oPs(tPi) = tZ / iVd oPx(tPi) = iPx(tPi) * oPs(tPi) oPy(tPi) = iPy(tPi) * oPs(tPi) oPz(tPi) = iPz(tPi) Next End Sub 'MTX Sub MTX_3DMixD(iMx, iMy, iMz, iRx, iRy, iRz, oMx, oMr) MTX_3DPixMove tMtx_MV, oMr, iMx, iMy, iMz MTX_3DPixRotZ tMtx_RTz, oMr, iRz MTX_3DPixRotX tMtx_RTx, oMr, iRx MTX_3DPixRotY tMtx_RTy, oMr, iRy MTX_Multi tMtx_MV, oMr, tMtx_RTz, oMr, tMx, oMr oMx = tMx MTX_Multi oMx, oMr, tMtx_RTx, oMr, tMx, oMr oMx = tMx MTX_Multi oMx, oMr, tMtx_RTy, oMr, tMx, oMr oMx = tMx End Sub Sub MTX_3DMixV(iVx, iVy, iVz, iSc, oMx, oMr) MTX_3DPixMulti tMtx_SC, oMr, iSc MTX_3DPixMove tMtx_VM, oMr, iVx, iVy, iVz MTX_Multi tMtx_SC, oMr, tMtx_VM, oMr, tMx, oMr oMx = tMx End Sub Sub MTX_3DPixMulti(oM(), oMr, iSc) oMr = 4 ReDim oM(15) oM = Array(iSc, 0, 0, 0, 0, iSc, 0, 0, 0, 0, iSc, 0, 0, 0, 0, 1) End Sub Sub MTX_3DPixMove(oM(), oMr, iMx, iMy, iMz) oMr = 4 ReDim oM(15) oM = Array(1, 0, 0, iMx, 0, 1, 0, iMy, 0, 0, 1, iMz, 0, 0, 0, 1) End Sub Sub MTX_3DPixRotZ(oM(), oMr, iA) oMr = 4 ReDim oM(15) tR = Radian(iA) : tSin = sin(tR) : tCos = cos(tR) oM = Array(tCos, -tSin, 0, 0, tSin, tCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1) End Sub Sub MTX_3DPixRotY(oM(), oMr, iA) oMr = 4 ReDim oM(15) tR = Radian(iA) : tSin = sin(tR) : tCos = cos(tR) oM = Array(tCos, 0, tSin, 0, 0, 1, 0, 0, -tSin, 0, tCos, 0, 0, 0, 0, 1) End Sub Sub MTX_3DPixRotX(oM(), oMr, iA) oMr = 4 tR = Radian(iA) : tSin = sin(tR) : tCos = cos(tR) oM = Array(1, 0, 0, 0, 0, tCos, tSin, 0, 0, -tSin, tCos, 0, 0, 0, 0, 1) End Sub Sub MTX_Multi(iMa(), iMar, iMb(), iMbr, oMc(), oMcr) tN = (iMar = ((UBound(iMb) / iMbr) + 1)) And (iMar - 1) If CBool(tN) Then tM = Ubound(iMa) / iMar tP = iMbr - 1 oMcr = tP + 1 ReDim oMc(oMcr * (tM + 1) - 1) For tMi = 0 To tM For tPi = 0 To tP For tNi = 0 To tN tMv = MTX_VGet(oMc, oMcr, tMi, tPi) + MTX_VGet(iMa, iMar, tMi, tNi) * MTX_VGet(iMb, iMbr, tNi, tPi) MTX_VSet oMc, oMcr, tMi, tPi, tMv Next Next Next End If End Sub Sub MTX_GetByTxt(iT, oM(), oMr) tLs = Split(iT, "|") tLe = Ubound(tLs) For tLi = 0 To tLe Next End Sub Sub MTX_VSet(pM(), pMr, pX, pY, pMv) tMi = pY * pMr + pX pM(tMi) = pMv End Sub Function MTX_VGet(pM(), pMr, pX, pY) tMi = pY * pMr + pX MTX_VGet = pM(tMi) End Function Function Radian(pA) Radian = pA * 71 / 4068 End Function </script> </html> 参观 [目前Firefox中好使,其他浏览器需复制到本地,存为html文件看效果]