Category: 2D Overlay
Syntax:
b2dFadePalette:Void(imageHandle:Int, toR:Int, toG:Int, toB:Int, amount:Double)
Void
Blends the whole palette towards a colour - a fade to black, a flash to white, a tint.
Takes imageHandle, toR, toG, toB (the colour to fade towards, 0 to 255) and amount (0.0 = no fade, 1.0 = fully that colour; clamped).
Returns nothing.
The fade composes with cycling rather than replacing it - an animated picture keeps animating as it fades. It also affects RGB only and leaves alpha alone, so fading never fills in a sprite's transparent holes.
The fade is a display effect over the stored palette, so b2dResetPalette clears it and the getters are unaffected by it.
View detailed documentation online
; Fade the whole picture to black over one second, then restore it. Local t:Double = 0.0 While t < 1.0 t = t + 0.016 b2dFadePalette(img, 0, 0, 0, t) sysUpdateEvents() b2dCls() b2dDrawImage(img, 0, 0) b2dFlip() Wend b2dResetPalette(img)
BambooBasic © 2026 Michael Denathorn