#83504 - Roembout - Tue May 16, 2006 6:23 pm
Hi there,
I'm trying out some stuff to fade in/out the palette of a tiled background. I found this routine on this forum:
It works fine for fading out to white, but I can't get it to work for fading in from white.
Anybody knows how I can get it to work?
Thx, in advance.[/code]
Last edited by Roembout on Tue May 16, 2006 6:33 pm; edited 2 times in total
I'm trying out some stuff to fade in/out the palette of a tiled background. I found this routine on this forum:
Code: |
int readX, step;
float red, green, blue; u16 sourceColor, targetColor; targetColor = WHITE; int fadeSteps = 30; for( step = 0; step <= fadeSteps; step++ ) { swiWaitForVBlank( ); for( readX = 0; readX < 256; readX++ ) { sourceColor = BG_PALETTE_SUB[readX]; red = ( ( REDVALUE ( sourceColor ) * ( fadeSteps - step ) ) + ( REDVALUE ( targetColor ) * step ) ) / fadeSteps; green = ( ( GREENVALUE( sourceColor ) * ( fadeSteps - step ) ) + ( GREENVALUE( targetColor ) * step ) ) / fadeSteps; blue = ( ( BLUEVALUE ( sourceColor ) * ( fadeSteps - step ) ) + ( BLUEVALUE ( targetColor ) * step ) ) / fadeSteps; BG_PALETTE_SUB[readX] = RGB( (int)red , (int)green , (int)blue ); } } |
It works fine for fading out to white, but I can't get it to work for fading in from white.
Anybody knows how I can get it to work?
Thx, in advance.[/code]
Last edited by Roembout on Tue May 16, 2006 6:33 pm; edited 2 times in total