霓虹灯

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

第一个: 
  1 < script languate = " VBScript "  type = " text/VBScript " >
  2 Dim  pubS_Pix_x
  3 Dim  pubS_Pix_y
  4 Dim  pubS_Pix_z
  5 Dim  pubS_Pix_cr
  6 Dim  pubS_Pix_cg
  7 Dim  pubS_Pix_cb
  8 Dim  pubD_Mx
  9 Dim  pubD_My
 10 Dim  pubD_Mz
 11 Dim  pubD_Rx
 12 Dim  pubD_Ry
 13 Dim  pubD_Rz
 14 Dim  pubD_Mtx_Mx
 15 Dim  pubD_Mtx_Mr
 16 Dim  pubD_Pix_x
 17 Dim  pubD_Pix_y
 18 Dim  pubD_Pix_z
 19 Dim  pubF_Va
 20 Dim  pubF_Vd
 21 Dim  pubV_Vx
 22 Dim  pubV_Vy
 23 Dim  pubV_Vz
 24 Dim  pubV_Sc
 25 Dim  pubV_Mtx_Mx
 26 Dim  pubV_Mtx_Mr
 27 Dim  pubV_Pix_x
 28 Dim  pubV_Pix_y
 29 Dim  pubV_Pix_z
 30 Dim  pubElm
 31 Dim  pubElm_Len
 32 Dim  pubWeb_Tv
 33 Dim  pubWeb_Tw
 34 Dim  pubWeb_WW, pubWeb_WH
 35 Dim  pubR, pubG, pubB
 36 Dim  pubOR, pubOG, pubOB
 37 ' Web DHTML 事件函数
 38 Sub  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     
 60 End Sub
 61 Sub  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
 88 End Sub
 89 Sub  Web_TimeLoop()
 90     pubD_Rz  =  (pubD_Rz  +   1 Mod   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)
132 End Sub
133 Function  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
147 End Function
148 Sub  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
154 End Sub
155 Sub  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
162 End Sub
163 Sub  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)  =  iPz(tPi)
171      Next
172 End Sub
173 Sub  MTX_2DPixMulti(iSc, oM(), oMr)
174     oMr  =   3
175      ReDim  oM( 8 )
176     oM  =   Array (iSc,  0 0 0 , iSc,  0 0 0 1 )
177 End Sub
178 Sub  MTX_2DPixMove(iMx, iMy, oM(), oMr)
179     oMr  =   3
180      ReDim  oM( 8 )
181     oM  =   Array ( 1 0 , iMx,  0 1 , iMy,  0 0 1 )
182 End Sub
183 Sub  MTX_2DRot(iA, oM(), oMr)
184     tR  =  Radian(iA)
185     oMr  =   3
186      ReDim  oM( 8 )
187     oM  =   Array ( cos (tR),  - sin (tR),  0 sin (tR),  cos (tR),  0 0 0 1 )
188 End Sub
189 Sub  MTX_3DMixD(iMx, iMy, iMz, iRx, iRy, iRz, oMx, oMr)
190     MTX_3DPixMove tMtx_MV, oMr, iMx, iMy, iMz
191     MTX_3DPixRotZ tMtx_RTz, oMr, iRz
192     MTX_3DPixRotX tMtx_RTx, oMr, iRx
193     MTX_3DPixRotY tMtx_RTy, oMr, iRy
194     MTX_Multi tMtx_MV, oMr, tMtx_RTz, oMr, tMx, oMr
195     oMx  =  tMx
196     MTX_Multi oMx, oMr, tMtx_RTx, oMr, tMx, oMr
197     oMx  =  tMx
198     MTX_Multi oMx, oMr, tMtx_RTy, oMr, tMx, oMr
199     oMx  =  tMx
200 End Sub
201 Sub  MTX_3DMixV(iVx, iVy, iVz, iSc, oMx, oMr)
202     MTX_3DPixMulti tMtx_SC, oMr, iSc
203     MTX_3DPixMove tMtx_VM, oMr, iVx, iVy, iVz
204     MTX_Multi tMtx_SC, oMr, tMtx_VM, oMr, tMx, oMr
205     oMx  =  tMx
206 End Sub
207 Sub  MTX_3DPixMulti(oM(), oMr, iSc)
208     oMr  =   4
209      ReDim  oM( 15 )    
210     oM  =   Array (iSc,  0 0 0 0 , iSc,  0 0 0 0 , iSc,  0 0 0 0 1 )
211 End Sub
212 Sub  MTX_3DPixMove(oM(), oMr, iMx, iMy, iMz)
213     oMr  =   4
214      ReDim  oM( 15 )    
215     oM  =   Array ( 1 0 0 , iMx,  0 1 0 , iMy,  0 0 1 , iMz,  0 0 0 1 )
216 End Sub
217 Sub  MTX_3DPixRotZ(oM(), oMr, iA)
218     oMr  =   4
219      ReDim  oM( 15 )
220     tR  =  Radian(iA) : tSin  =   sin (tR) : tCos  =   cos (tR)
221     oM  =   Array (tCos,  - tSin,  0 0 , tSin, tCos,  0 0 0 0 1 0 0 0 0 1 )    
222 End Sub
223 Sub  MTX_3DPixRotY(oM(), oMr, iA)
224     oMr  =   4
225      ReDim  oM( 15 )    
226     tR  =  Radian(iA) : tSin  =   sin (tR) : tCos  =   cos (tR)
227     oM  =   Array (tCos,  0 , tSin,  0 0 1 0 0 - tSin,  0 , tCos,  0 0 0 0 1 )
228 End Sub
229 Sub  MTX_3DPixRotX(oM(), oMr, iA)
230     oMr  =   4
231     tR  =  Radian(iA)    
232     tR  =  Radian(iA) : tSin  =   sin (tR) : tCos  =   cos (tR)    
233     oM  =   Array ( 1 0 0 0 0 , tCos, tSin,  0 0 - tSin, tCos,  0 0 0 0 1 )
234 End Sub
235 Sub  MTX_Multi(iMa(), iMar, iMb(), iMbr, oMc(), oMcr)
236     tN  =  (iMar  =  (( UBound (iMb)  \  iMbr)  +   1 ))  And  (iMar  -   1 )
237     
238      If   CBool (tN)  Then
239     
240         tM  =   Ubound (iMa)  \  iMar
241         tP  =  iMbr  -   1
242         
243         oMcr  =  tP  +   1
244                 
245          ReDim  oMc(oMcr  *  (tM  +   1 -   1 )
246         
247          For  tMi  =   0   To  tM
248              For  tPi  =   0   To  tP
249                  For  tNi  =   0   To  tN
250                     tMv  =  MTX_VGet(oMc, oMcr, tMi, tPi)  +  MTX_VGet(iMa, iMar, tMi, tNi)  *  MTX_VGet(iMb, iMbr, tNi, tPi)
251                     MTX_VSet oMc, oMcr, tMi, tPi, tMv
252                     
253                  Next
254              Next
255          Next
256         
257      End   If
258         
259 End Sub
260 Sub  MTX_VSet(pM(), pMr, pX, pY, pMv)
261     tMi  =  pY  *  pMr  +  pX
262     pM(tMi)  =  pMv
263 End Sub
264 Function  MTX_VGet(pM(), pMr, pX, pY)
265     tMi  =  pY  *  pMr  +  pX
266     MTX_VGet  =  pM(tMi)
267 End Function
268 Function  Radian(pA)
269     Radian  =  pA  *   71   /   4068
270 End Function
271 </ script >
第二个:
  1 < script languate = " VBScript "  type = " text/VBScript " >
  2 Dim  pubS_Pix_x
  3 Dim  pubS_Pix_y
  4 Dim  pubS_Pix_z
  5 Dim  pubS_Pix_c
  6 Dim  pubD_Mx
  7 Dim  pubD_My
  8 Dim  pubD_Mz
  9 Dim  pubD_Rx
 10 Dim  pubD_Ry
 11 Dim  pubD_Rz
 12 Dim  pubD_Mtx_Mx
 13 Dim  pubD_Mtx_Mr
 14 Dim  pubD_Pix_x
 15 Dim  pubD_Pix_y
 16 Dim  pubD_Pix_z
 17 Dim  pubF_Va
 18 Dim  pubF_Vd
 19 Dim  pubV_Vx
 20 Dim  pubV_Vy
 21 Dim  pubV_Vz
 22 Dim  pubV_Sc
 23 Dim  pubV_Mtx_Mx
 24 Dim  pubV_Mtx_Mr
 25 Dim  pubV_Pix_x
 26 Dim  pubV_Pix_y
 27 Dim  pubV_Pix_z
 28 Dim  pubElm
 29 Dim  pubElm_Len
 30 Dim  pubWeb_Tv
 31 Dim  pubWeb_Tw
 32 Dim  pubWeb_WW, pubWeb_WH
 33 Dim  pubR, pubG, pubB
 34 Dim  pubOR, pubOG, pubOB
 35 ' Web DHTML 事件函数
 36 Sub  window_onload()
 37     MakeModule
 38             
 39      With  document.body
 40         pubWeb_WW  =  .clientWidth 
 41         pubWeb_WH  =  .clientHeight 
 42      End   With  
 43     pubD_Rz  =   0
 44     pubD_Rx  =   0
 45     pubD_Ry  =   0  
 46     pubF_Va  =   15
 47     pubF_Vd  =   20
 48     
 49     pubV_Vx  =  pubWeb_WW  \   2
 50     pubV_Vy  =  pubWeb_WH  *   1.3   \   2
 51     pubV_Vz  =   0
 52     pubV_Sc  =   12
 53     pubWeb_Tw  =   33
 54     MTX_3DMixV pubV_Vx, pubV_Vy, pubV_Vz, pubV_Sc, pubV_Mtx_Mx, pubV_Mtx_Mr
 55     
 56     Web_TimeLoop
 57     
 58 End Sub
 59 Sub  MakeModule
 60     pubElm_Len  =   919
 61     pubElm  =  ELM_Create(pubElm_Len)
 62      ReDim  pubS_Pix_x(pubElm_Len), pubS_Pix_y(pubElm_Len), pubS_Pix_z(pubElm_Len)
 63      ReDim  pubD_Pix_x(pubElm_Len), pubD_Pix_y(pubElm_Len), pubD_Pix_z(pubElm_Len)
 64      ReDim  pubV_Pix_x(pubElm_Len), pubV_Pix_y(pubElm_Len), pubV_Pix_z(pubElm_Len)
 65      ReDim  pubS_Pix_c(pubElm_Len)
 66     tH  =   100
 67     tR  =   0
 68      For  tI  =   1   To   1500  Step  15
 69         tR  =  tR  +   0.1
 70         tA  =  tA  +  ( 5   /  tR  *   2   *   3.14 )
 71         tH  =   30   -   5   *  tR  ' 2 * tR
 72         tAr  =  Radian(tA)
 73         tX  =   Sin (tAr)  *  tR  *   3
 74         tY  =   Cos (tAr)  *  tR  *   3
 75          For  tZ  =   Int (tH)  To   0  Step  - 1
 76             pubS_Pix_x(tAdd)  =  tX
 77             pubS_Pix_y(tAdd)  =  tY
 78             pubS_Pix_z(tAdd)  =  tZ
 79             tAdd  =  tAdd  +   1
 80          Next
 81      Next
 82         
 83     pubD_Mx  =   0
 84     pubD_My  =   0
 85     pubD_Mz  =   0
 86 End Sub
 87 Sub  Web_TimeLoop()
 88     pubD_Rz  =  (pubD_Rz  +   5 Mod   360
 89     pubD_Rx  =   - 45
 90     pubD_Ry  =   0
 91     MTX_3DMixD pubD_Mx, pubD_My, pubD_Mz, pubD_Rx, pubD_Ry, pubD_Rz, pubD_Mtx_Mx, pubD_Mtx_Mr
 92     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
 93     FIT_PSV pubD_Pix_x, pubD_Pix_y, pubD_Pix_z, pubF_Va, pubF_Vd, pubD_Pix_x, pubD_Pix_y, pubD_Pix_z
 94     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
 95     
 96      For  tI  =   0   To   10
 97      For  tEi  =  pubElm_Len  To   0  Step  - 1
 98          If   CBool (tEi)  Then
 99                 pubS_Pix_c(tEi)  =  pubS_Pix_c(tEi - 1 )
100              Else
101                  If  pubR  <  pubOR  Then  pubR  =  pubR  +   1
102                  If  pubR  >  pubOR  Then  pubR  =  pubR  -   1
103                  If  pubG  <  pubOG  Then  pubG  =  pubG  +   1
104                  If  pubG  >  pubOG  Then  pubG  =  pubG  -   1
105                  If  pubB  <  pubOB  Then  pubB  =  pubB  +   1
106                  If  pubB  >  pubOB  Then  pubB  =  pubB  -   1
107                  If  pubR  =  pubOR  And  pubB  =  pubOB  And  pubG  =  pubOG  Then  
108                     pubOR  =   Int ( Rnd   *   128 +   127
109                     pubOG  =   Int ( Rnd   *   128 +   127
110                     pubOB  =   Int ( Rnd   *   128 +   127
111                  End   If
112                 pubS_Pix_c(tEi)  =   rgb (pubR, pubG, pubB)
113          End   If
114      Next
115      Next  
116      For  tEi  =  pubElm_Len  To   0  Step  - 1
117          With  pubElm(tEi).style
118             .left  =  pubV_Pix_x(tEi)
119             .top  =     pubV_Pix_y(tEi)
120             .color  =  pubS_Pix_c(tEi)
121          End   With
122      Next
123     
124     pubWeb_Tv  =  window.setTimeout( " Web_TimeLoop " , pubWeb_Tw)
125 End Sub
126 Function  ELM_Create(pEn)
127      ReDim  tElms(pEn)
128      For  tEi  =   0   To  pEn
129          With  document
130              Set  tElms(tEi)  =  .createElement( " SPAN " )
131             .body.insertAdjacentElement  " beForeEnd " , tElms(tEi)
132          End   With
133          With  tElms(tEi)
134             .innerText  =   " * "
135             .style.position  =   " absolute "
136             .style.color  =   rgb ( 0 , 0 , 0 )
137          End   With
138      Next
139     ELM_Create  =  tElms
140 End Function
141 Sub  PXE_MTXTram2D(pPx(), pPy(), pM(), pMr, oPx(), oPy())
142     tPe  =   UBound (pPx)
143      For  tPi  =   0   To  tPe
144         oPx(tPi)  =  pPx(tPi)  *  pM( 0 +  pPy(tPi)  *  pM( 1 +  pM( 2 )
145         oPy(tPi)  =  pPx(tPi)  *  pM( 3 +  pPy(tPi)  *  pM( 4 +  pM( 5 )
146      Next
147 End Sub
148 Sub  PXE_MTXTram3D(pPx(), pPy(), pPz(), pM(), pMr(), oPx(), oPy(), oPz())
149     tPe  =   UBound (pPx)
150      For  tPi  =   0   To  tPe
151         oPx(tPi)  =  pPx(tPi)  *  pM( 0 +  pPy(tPi)  *  pM( 1 +  pPz(tPi)  *  pM( 2 +  pM( 3 )
152         oPy(tPi)  =  pPx(tPi)  *  pM( 4 +  pPy(tPi)  *  pM( 5 +  pPz(tPi)  *  pM( 6 +  pM( 7 )
153         oPz(tPi)  =  pPx(tPi)  *  pM( 8 +  pPy(tPi)  *  pM( 9 +  pPz(tPi)  *  pM( 10 +  pM( 11 )
154      Next
155 End Sub
156 Sub  FIT_PSV(iPx, iPy, iPz, iVa, iVd, oPx, oPy, oPz)
157     tPe  =   UBound (iPx)
158      For  tPi  =   0   To  tPe
159         tVr  =   Sin (Radian(iVa))
160         tZ  =  iPz(tPi)  +  iVd
161         oPx(tPi)  =  iPx(tPi)  *  tVr  *  tZ  /  (tVr  *  iVd)
162         oPy(tPi)  =  iPy(tPi)  *  tVr  *  tZ  /  (tVr  *  iVd)
163         oPz(tPi)  =  iPz(tPi)
164      Next
165 End Sub
166 Sub  MTX_2DPixMulti(iSc, oM(), oMr)
167     oMr  =   3
168      ReDim  oM( 8 )
169     oM  =   Array (iSc,  0 0 0 , iSc,  0 0 0 1 )
170 End Sub
171 Sub  MTX_2DPixMove(iMx, iMy, oM(), oMr)
172     oMr  =   3
173      ReDim  oM( 8 )
174     oM  =   Array ( 1 0 , iMx,  0 1 , iMy,  0 0 1 )
175 End Sub
176 Sub  MTX_2DRot(iA, oM(), oMr)
177     tR  =  Radian(iA)
178     oMr  =   3
179      ReDim  oM( 8 )
180     oM  =   Array ( cos (tR),  - sin (tR),  0 sin (tR),  cos (tR),  0 0 0 1 )
181 End Sub
182 Sub  MTX_3DMixD(iMx, iMy, iMz, iRx, iRy, iRz, oMx, oMr)
183     MTX_3DPixMove tMtx_MV, oMr, iMx, iMy, iMz
184     MTX_3DPixRotZ tMtx_RTz, oMr, iRz
185     MTX_3DPixRotX tMtx_RTx, oMr, iRx
186     MTX_3DPixRotY tMtx_RTy, oMr, iRy
187     MTX_Multi tMtx_MV, oMr, tMtx_RTz, oMr, tMx, oMr
188     oMx  =  tMx
189     MTX_Multi oMx, oMr, tMtx_RTx, oMr, tMx, oMr
190     oMx  =  tMx
191     MTX_Multi oMx, oMr, tMtx_RTy, oMr, tMx, oMr
192     oMx  =  tMx
193 End Sub
194 Sub  MTX_3DMixV(iVx, iVy, iVz, iSc, oMx, oMr)
195     MTX_3DPixMulti tMtx_SC, oMr, iSc
196     MTX_3DPixMove tMtx_VM, oMr, iVx, iVy, iVz
197     MTX_Multi tMtx_SC, oMr, tMtx_VM, oMr, tMx, oMr
198     oMx  =  tMx
199 End Sub
200 Sub  MTX_3DPixMulti(oM(), oMr, iSc)
201     oMr  =   4
202      ReDim  oM( 15 )    
203     oM  =   Array (iSc,  0 0 0 0 , iSc,  0 0 0 0 , iSc,  0 0 0 0 1 )
204 End Sub
205 Sub  MTX_3DPixMove(oM(), oMr, iMx, iMy, iMz)
206     oMr  =   4
207      ReDim  oM( 15 )    
208     oM  =   Array ( 1 0 0 , iMx,  0 1 0 , iMy,  0 0 1 , iMz,  0 0 0 1 )
209 End Sub
210 Sub  MTX_3DPixRotZ(oM(), oMr, iA)
211     oMr  =   4
212      ReDim  oM( 15 )
213     tR  =  Radian(iA) : tSin  =   sin (tR) : tCos  =   cos (tR)
214     oM  =   Array (tCos,  - tSin,  0 0 , tSin, tCos,  0 0 0 0 1 0 0 0 0 1 )    
215 End Sub
216 Sub  MTX_3DPixRotY(oM(), oMr, iA)
217     oMr  =   4
218      ReDim  oM( 15 )    
219     tR  =  Radian(iA) : tSin  =   sin (tR) : tCos  =   cos (tR)
220     oM  =   Array (tCos,  0 , tSin,  0 0 1 0 0 - tSin,  0 , tCos,  0 0 0 0 1 )
221 End Sub
222 Sub  MTX_3DPixRotX(oM(), oMr, iA)
223     oMr  =   4
224     tR  =  Radian(iA)    
225     tR  =  Radian(iA) : tSin  =   sin (tR) : tCos  =   cos (tR)    
226     oM  =   Array ( 1 0 0 0 0 , tCos, tSin,  0 0 - tSin, tCos,  0 0 0 0 1 )
227 End Sub
228 Sub  MTX_Multi(iMa(), iMar, iMb(), iMbr, oMc(), oMcr)
229     tN  =  (iMar  =  (( UBound (iMb)  \  iMbr)  +   1 ))  And  (iMar  -   1 )
230     
231      If   CBool (tN)  Then
232     
233         tM  =   Ubound (iMa)  \  iMar
234         tP  =  iMbr  -   1
235         
236         oMcr  =  tP  +   1
237                 
238          ReDim  oMc(oMcr  *  (tM  +   1 -   1 )
239         
240          For  tMi  =   0   To  tM
241              For  tPi  =   0   To  tP
242                  For  tNi  =   0   To  tN
243                     tMv  =  MTX_VGet(oMc, oMcr, tMi, tPi)  +  MTX_VGet(iMa, iMar, tMi, tNi)  *  MTX_VGet(iMb, iMbr, tNi, tPi)
244                     MTX_VSet oMc, oMcr, tMi, tPi, tMv
245                     
246                  Next
247              Next
248          Next
249         
250      End   If
251         
252 End Sub
253 Sub  MTX_VSet(pM(), pMr, pX, pY, pMv)
254     tMi  =  pY  *  pMr  +  pX
255     pM(tMi)  =  pMv
256 End Sub
257 Function  MTX_VGet(pM(), pMr, pX, pY)
258     tMi  =  pY  *  pMr  +  pX
259     MTX_VGet  =  pM(tMi)
260 End Function
261 Function  Radian(pA)
262     Radian  =  pA  *   71   /   4068
263 End Function
264 </ script >

你可能感兴趣的:(霓虹灯)