...

View Full Version : Javascript color changing code...How is this done?



bruceleeroy
09-02-2011, 08:17 PM
Hey guys,
I have been trying to get better at my javascript as of late and there is this one particular color fading technique I have found that I am having trouble dissecting.

The following code appears to be how they are making a rollover go from a dark gray to a subtle light gray with a nice fade but I can't exactly tell whats going on from the code. Is it just telling it to add a rgb point in so many seconds?

Any professional help would be greatly appreciated.


colorInit=
true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],0),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],0),255),0)+")"}});

Old Pedant
09-02-2011, 09:09 PM
Part of the code is missing.

The starting point can't possibly be

colorInit=true}

Syntax error right at that point.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum