霓虹灯

节日快到,发几个霓虹灯的脚本助助兴!

第一个: 
  1<script languate="VBScript" type="text/VBScript">
  2Dim pubS_Pix_x
  3Dim pubS_Pix_y
  4Dim pubS_Pix_z
  5Dim pubS_Pix_cr
  6Dim pubS_Pix_cg
  7Dim pubS_Pix_cb
  8Dim pubD_Mx
  9Dim pubD_My
 10Dim pubD_Mz
 11Dim pubD_Rx
 12Dim pubD_Ry
 13Dim pubD_Rz
 14Dim pubD_Mtx_Mx
 15Dim pubD_Mtx_Mr
 16Dim pubD_Pix_x
 17Dim pubD_Pix_y
 18Dim pubD_Pix_z
 19Dim pubF_Va
 20Dim pubF_Vd
 21Dim pubV_Vx
 22Dim pubV_Vy
 23Dim pubV_Vz
 24Dim pubV_Sc
 25Dim pubV_Mtx_Mx
 26Dim pubV_Mtx_Mr
 27Dim pubV_Pix_x
 28Dim pubV_Pix_y
 29Dim pubV_Pix_z
 30Dim pubElm
 31Dim pubElm_Len
 32Dim pubWeb_Tv
 33Dim pubWeb_Tw
 34Dim pubWeb_WW, pubWeb_WH
 35Dim pubR, pubG, pubB
 36Dim pubOR, pubOG, pubOB
 37'Web DHTML 事件函数
 38Sub window_onload()
 39    MakeModule
 40            
 41    With document.body
 42        pubWeb_WW = .clientWidth 
 43        pubWeb_WH = .clientHeight 
 44    End With 
 45    pubD_Rz = 0
 46    pubD_Rx = 0
 47    pubD_Ry = 0 
 48    pubF_Va = 15
 49    pubF_Vd = 20
 50     
 51    pubV_Vx = pubWeb_WW \ 2
 52    pubV_Vy = pubWeb_WH \ 3
 53    pubV_Vz = 0
 54    pubV_Sc = 10
 55    pubWeb_Tw = 33
 56    MTX_3DMixV pubV_Vx, pubV_Vy, pubV_Vz, pubV_Sc, pubV_Mtx_Mx, pubV_Mtx_Mr
 57    
 58    Web_TimeLoop
 59    
 60End Sub
 61Sub MakeModule
 62    pubElm_Len = 599
 63    pubElm = ELM_Create(pubElm_Len)
 64    ReDim pubS_Pix_x(pubElm_Len), pubS_Pix_y(pubElm_Len), pubS_Pix_z(pubElm_Len)
 65    ReDim pubD_Pix_x(pubElm_Len), pubD_Pix_y(pubElm_Len), pubD_Pix_z(pubElm_Len)
 66    ReDim pubV_Pix_x(pubElm_Len), pubV_Pix_y(pubElm_Len), pubV_Pix_z(pubElm_Len)
 67    ReDim pubS_Pix_cr(pubElm_Len), pubS_Pix_cg(pubElm_Len), pubS_Pix_cb(pubElm_Len)
 68    tH = 100
 69    tR = 0
 70    For tI = 1 To 1500 Step 15
 71        tR = tI * 15 / 1500 + 5
 72        tA = tA + (1000 / (tR * 2 * 3.14))
 73        tZ = 30 - tI * 30 / 1500
 74        tAr = Radian(tA)
 75        For tRd = Int(tR) To Int(tR) - 5 Step -1
 76            tX = Sin(tAr) * tRd 
 77            tY = Cos(tAr) * tRd 
 78            pubS_Pix_x(tAdd) = tX
 79            pubS_Pix_y(tAdd) = tY
 80            pubS_Pix_z(tAdd) = tZ
 81            tAdd = tAdd + 1
 82        Next
 83    Next
 84    'MsgBox tAdd
 85    pubD_Mx = 0
 86    pubD_My = 0
 87    pubD_Mz = 0
 88End Sub
 89Sub Web_TimeLoop()
 90    pubD_Rz = (pubD_Rz + 1Mod 360
 91    pubD_Rx = 45
 92    pubD_Ry = 0
 93    MTX_3DMixD pubD_Mx, pubD_My, pubD_Mz, pubD_Rx, pubD_Ry, pubD_Rz, pubD_Mtx_Mx, pubD_Mtx_Mr
 94    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
 95    FIT_PSV pubD_Pix_x, pubD_Pix_y, pubD_Pix_z, pubF_Va, pubF_Vd, pubD_Pix_x, pubD_Pix_y, pubD_Pix_z
 96    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
 97    
 98    For tI = 0 To 5
 99    For tEi = pubElm_Len To 0 Step -1
100        If CBool(tEi) Then
101                pubS_Pix_cr(tEi) = pubS_Pix_cr(tEi-1)
102                pubS_Pix_cg(tEi) = pubS_Pix_cg(tEi-1)
103                pubS_Pix_cb(tEi) = pubS_Pix_cb(tEi-1)
104            Else
105                If pubR < pubOR Then pubR = pubR + 1
106                If pubR > pubOR Then pubR = pubR - 1
107                If pubG < pubOG Then pubG = pubG + 1
108                If pubG > pubOG Then pubG = pubG - 1
109                If pubB < pubOB Then pubB = pubB + 1
110                If pubB > pubOB Then pubB = pubB - 1
111                If pubR = pubOR And pubB = pubOB And pubG = pubOG Then 
112                    pubOR = Int(Rnd * 32+ 31
113                    pubOG = Int(Rnd * 32+ 31
114                    pubOB = Int(Rnd * 32+ 31
115                End If
116                pubS_Pix_cr(tEi) = pubR*4
117                pubS_Pix_cg(tEi) = pubG*4
118                pubS_Pix_cb(tEi) = pubB*4
119        End If
120    Next
121    Next 
122    For tEi = pubElm_Len To 0 Step -1
123        With pubElm(tEi).style
124            .left = pubV_Pix_x(tEi)
125            .top =    pubV_Pix_y(tEi)
126            tL = tEi Mod 6 + 1
127            .color = rgb(pubS_Pix_cr(tEi)\tL,pubS_Pix_cg(tEi)\tL,pubS_Pix_cb(tEi)\tL)
128        End With
129    Next
130    
131    pubWeb_Tv = window.setTimeout("Web_TimeLoop", pubWeb_Tw)
132End Sub
133Function ELM_Create(pEn)
134    ReDim tElms(pEn)
135    For tEi = 0 To pEn
136        With document
137            Set tElms(tEi) = .createElement("SPAN")
138            .body.insertAdjacentElement "beForeEnd", tElms(tEi)
139        End With
140        With tElms(tEi)
141            .innerText = "*"
142            .style.position = "absolute"
143            .style.color = rgb(0,0,0)
144        End With
145    Next
146    ELM_Create = tElms
147End Function
148Sub PXE_MTXTram2D(pPx(), pPy(), pM(), pMr, oPx(), oPy())
149    tPe = UBound(pPx)
150    For tPi = 0 To tPe
151        oPx(tPi) = pPx(tPi) * pM(0+ pPy(tPi) * pM(1+ pM(2)
152        oPy(tPi) = pPx(tPi) * pM(3+ pPy(tPi) * pM(4+ pM(5)
153    Next
154End Sub
155Sub PXE_MTXTram3D(pPx(), pPy(), pPz(), pM(), pMr(), oPx(), oPy(), oPz())
156    tPe = UBound(pPx)
157    For tPi = 0 To tPe
158        oPx(tPi) = pPx(tPi) * pM(0+ pPy(tPi) * pM(1+ pPz(tPi) * pM(2+ pM(3)
159        oPy(tPi) = pPx(tPi) * pM(4+ pPy(tPi) * pM(5+ pPz(tPi) * pM(6+ pM(7)
160        oPz(tPi) = pPx(tPi) * pM(8+ pPy(tPi) * pM(9+ pPz(tPi) * pM(10+ pM(11)
161    Next
162End Sub
163Sub FIT_PSV(iPx, iPy, iPz, iVa, iVd, oPx, oPy, oPz)
164    tPe = UBound(iPx)
165    For tPi = 0 To tPe
166        tVr = Sin(Radian(iVa))
167        tZ = iPz(tPi) + iVd
168        oPx(tPi) = iPx(tPi) * tVr * tZ / (tVr * iVd)
169        oPy(tPi) = iPy(tPi) * tVr * tZ / (tVr * iVd)
170        oPz(tPi) 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值