ÿþ/ / M o u s e   D o o d l e   2     -   h t t p : / / w w w . b t i n t e r n e t . c o m / ~ k u r t . g r i g g / j a v a s c r i p t  
  
 i f   ( ( t y p e o f   w i n d o w . e v e n t )   & &  
 w i n d o w . a t t a c h E v e n t   & &  
 d o c u m e n t . g e t E l e m e n t B y I d   & &  
 d o c u m e n t . f i r s t C h i l d   & &    
 d o c u m e n t . f i r s t C h i l d . f i l t e r s ) {  
  
 ( f u n c t i o n ( ) {  
 v a r   c o l o u r s   =   n e w   A r r a y ( " # 9 B 8 1 B 3 " , " # 6 6 6 6 9 9 " , " # 9 B 8 1 B 3 " , " # 6 6 6 6 9 9 " , " # 9 9 0 0 C C " , " # 9 9 0 0 C C " , " # 9 B 8 1 B 3 " ) ;  
 v a r   n   =   c o l o u r s . l e n g t h ;  
 v a r   d y   =   0 ;  
 v a r   d x   =   0 ;  
 v a r   r y   =   0 ;  
 v a r   r x   =   0 ;  
 v a r   v 1   =   0 . 0 8 ;  
 v a r   v 2   =   0 ;  
 v a r   y   =   0 ;  
 v a r   x   =   0 ;  
 v a r   r e f   =   [ ] ;  
 v a r   p u l s e C o u n t e r   =   [ ] ;  
 v a r   p u l s e P a t h   =   [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 1 0 , 1 1 , 1 2 , 1 3 , 1 4 , 1 5 , 3 0 , 1 5 , 1 4 , 1 3 , 1 2 , 1 1 , 1 0 , 9 , 8 , 7 , 6 , 5 , 4 , 3 , 2 , 1 ] ;  
 v a r   p u l s e   =   [ ] ;  
 v a r   r e f 2   =   d o c u m e n t . d o c u m e n t E l e m e n t | | d o c u m e n t . b o d y ;  
 v a r   i d x   =   d o c u m e n t . g e t E l e m e n t s B y T a g N a m e ( ' d i v ' ) . l e n g t h ;  
 v a r   p i x   =   " p x " ;  
  
 d o c u m e n t . w r i t e ( ' < d i v   i d = " c o n ' + i d x + ' "   s t y l e = " p o s i t i o n : a b s o l u t e ; t o p : 0 p x ; l e f t : 0 p x ; " > '  
 + ' < d i v   s t y l e = " p o s i t i o n : r e l a t i v e " > ' ) ;  
  
 f o r   ( i   =   0 ;   i   <   n ;   i + + ) {  
 d o c u m e n t . w r i t e ( ' < d i v   i d = " l i g h t s ' + ( i d x + i ) + ' "   s t y l e = " p o s i t i o n : a b s o l u t e ; '  
 + ' t o p : 0 p x ; l e f t : 0 p x ; h e i g h t : 5 0 p x ; w i d t h : 5 0 p x ; f o n t - f a m i l y : C o u r i e r   N e w ; '  
 + ' f o n t - s i z e : 1 0 p x ; c o l o r : # f f f f f f ; p a d d i n g - t o p : 1 8 p x ; t e x t - a l i g n : c e n t e r " > . < \ / d i v > ' ) ;  
 }  
  
 d o c u m e n t . w r i t e ( ' < \ / d i v > < \ / d i v > ' ) ;  
  
 f o r   ( i   =   0 ;   i   <   n ;   i + + ) {  
 r e f [ i ]   =   d o c u m e n t . g e t E l e m e n t B y I d ( " l i g h t s " + ( i d x + i ) ) . s t y l e ;  
 p u l s e C o u n t e r [ i ]   =   i   *   4 ;  
 }  
  
 f u n c t i o n   m o u s e ( ) {  
 y   =   w i n d o w . e v e n t . c l i e n t Y ;  
 x   =   w i n d o w . e v e n t . c l i e n t X   -   1 6 ;  
 }  
 d o c u m e n t . a t t a c h E v e n t ( " o n m o u s e m o v e " , m o u s e ) ;  
  
 f u n c t i o n   s t a r s ( ) {  
 f o r   ( i   =   0 ;   i   <   n ;   i + + ) {  
   p u l s e C o u n t e r [ i ] + + ;  
   i f   ( p u l s e C o u n t e r [ i ]   > =   p u l s e P a t h . l e n g t h ) {  
     p u l s e C o u n t e r [ i ]   =   0 ;    
   }  
   p u l s e [ i ]   =   p u l s e P a t h [ p u l s e C o u n t e r [ i ] ] ;  
   r e f [ i ] . f i l t e r   =   ' g l o w ( c o l o r = ' + c o l o u r s [ i ] + ' ,   s t r e n g t h = ' + p u l s e [ i ] + ' ) ' ;  
   r e f [ i ] . t o p   =   r y   +   M a t h . c o s ( ( 2 0 * M a t h . s i n ( v 2 / 2 0 ) ) + i * 7 0 ) * 1 0 0 * ( M a t h . s i n ( 1 0 + v 2 / 1 0 ) + 0 . 2 ) * M a t h . c o s ( ( v 2 + i * 2 5 ) / 1 0 )   +   p i x ;    
   r e f [ i ] . l e f t   =   r x   +   M a t h . s i n ( ( 2 0 * M a t h . s i n ( v 2 / 2 0 ) ) + i * 7 0 ) * 1 8 0 * ( M a t h . s i n ( 1 0 + v 2 / 1 0 ) + 0 . 2 ) * M a t h . c o s ( ( v 2 + i * 2 5 ) / 1 0 )   +   p i x ;    
 }  
 v 2   + =   v 1 ;  
 d o c u m e n t . g e t E l e m e n t B y I d ( " c o n " + i d x ) . s t y l e . t o p   =   r e f 2 . s c r o l l T o p   +   p i x ;    
 }  
  
 f u n c t i o n   d e l a y ( ) {  
 r y   =   d y   + =   ( y - d y )   *   0 . 0 5 ;  
 r x   =   d x   + =   ( x - d x )   *   0 . 0 5 ;  
 s t a r s ( ) ;  
 s e t T i m e o u t ( d e l a y , 4 0 ) ;  
 }  
 d e l a y ( ) ;  
 } ) ( ) ;  
 } 
