law Posted March 20, 2009 Share Posted March 20, 2009 OK, I found this javascript equalizer. It woks great. I cut it all up with php. I intend to make it easily editable. I am awful with javascript. I can't figure out how to flip this code. I would like the equalizer to operate upside down. The effect would look similar to filter: flipv; except be cross browser compatible. <?php //Number of Cols $col = 10; //0 is the starting number $cols = $cols - 1; //Number of Rows $row = 10; ?> <html> <head> <script language="JavaScript"> <!-- color=new Array(); <?php for ($i=0;$i<$col;$i++){ ?> color[<?php echo $i;?>]="blue.gif"; <?php } ?> h=new Array(); for(var i=0;i<<?php echo $col;?>;i++) h[i]=-1; function d_rand() { for(var i=0;i<<?php echo $col;?>;i++) { var h_old=h[i]; var sgn=1; var rndm=0; if(h[i]==-1) { h[i]= Math.floor(Math.random()*10) h_old=9; } else { rndm=Math.floor(Math.random()*3); sgn=Math.floor(Math.random()*2); if(sgn==0) { var h_old=h[i] h[i]+=rndm; if(h[i]>9) h[i]=9; } else { var h_old=h[i] h[i]-=rndm; if(h[i]<0) h[i]=0; } } if(sgn==0) { for(var j=h_old;j<=h[i];j++) document.images[i+j*<?php echo $col;?>].src = "black.gif"; } else { for(var j=h_old;j>=h[i];j--) document.images[i+j*<?php echo $col;?>].src = color[i]; } } timerId=setTimeout("d_rand()",270) } //--> </script> <title>UpsideDown - JavaScript - Equalizer</title> </head> <body onload="d_rand()" bgcolor="Black" leftmargin=30 text="White" marginwidth=30 vlink=silver> <table border="0" cellspacing="0" cellpadding="0"> <?php for ($i=0;$i<$row;$i++){ ?> <tr> <?php for ($ii=0;$ii<$col;$ii++){ ?> <td><img src="black.gif" width="40" height="20"></td> <?php } ?> </tr> <?php } ?> </body> </html> Quote Link to comment Share on other sites More sharing options...
law Posted March 22, 2009 Author Share Posted March 22, 2009 ** UPDATE ** I'm an idiot.. i just inverted the black.gif and the orange.gif.. it gave the visual look as if I had placed the EQ upside down.. Apparently my brain isn't as useless as i had thought! Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted March 22, 2009 Share Posted March 22, 2009 mark as solved please Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.