29.01.2010, 08:21
Quote:
Originally Posted by cyber_punk
Hmm, I'll give it a shot, Thanks. Maybe I can finally get rid of the odd flashing purple screen bug, that tends to happen with _Seif's.
|
Colors can't reach outside of the usual spectrum (o-255)
When the math of 'step' doesn't match out it fixes it, for example:
You want the AA to go from 255 to 0 in 100 steps (roughly 10 seconds)
You would take the initial color and subtract the ending color, so 255-0 = 255
then divide by the steps (255/100)
but in programming this doesn't give 2.55, it gives 2 (always rounds down unless specified otherwise)
This means we'll change the color 100 times and subtract 2 from 255 each time, but this comes up with a remainder (255 -(100*2) = 55)
so what I do is add to the steps how much is left using the same subtractee (2)
Remainder (55) divide by our subtractee (2) is how many steps we're gonna need to add (55/2=27,rounded down)
So now there are 127 steps, not 100