|
thanks guys!
sheesh.. asians are good at math? who knew? i'm white, i love math.. it's the language of the universe. and DJing, has a lot of math to it, the 4 beat structures, the different speeds..
anyway.. thanks for your answers and time. i actually found a simpler solution though.. now, i just need to optimize it.
this is not PHP, i just used that tag so it would come out formatted properly. now, i will use the code one. what i am doing is a javascript mouseover. it has to swap images.
I did it one way, but it was inefficient, and tough to update. i wanted a more elegant solution, and i saw the relations between the numbers.
this is what i started with:
code:
and this is how i [i]optimized it:
code:
some people would say i am crazy, but i think i can make it even tighter. these 6 lines here:
code:
if ((aryImages.length / 2) == (Math.round(aryImages.length / 2))) {
document['imgDisplay'].src = aryImages[imgNum + aryImages.length / 2];
}
else {
document['imgDisplay'].src = aryImages[imgNum + (aryImages.length+1) / 2];
}
can be shrunk down to 1, they are so similar. all i am doing is adding one to the length, if the array has an odd number of elements.. there is a way of doing that inline, in know there is, it's a simple thing.
i just can't FIND it.. grr.. I am INSANE!
Last edited by JohnSmith on Apr-17-2002 at 15:55
|