Article

Blending a Sprite with Different Interpretations of Alpha

Reinterpret a sprite's alpha property to react differently to the objects below it.

Overview

The final stage of rendering is to blend the sprite’s texture into its destination frame buffer. The default behavior uses the alpha values of the texture to blend the texture with the destination pixels. However, you can use other blend modes when you want to add other special effects to a scene.

You control the sprite’s blending behavior using the blendMode property. For example, an additive blend mode is useful to combine multiple sprites together, for effects such as for fire or lighting. The following code shows how to change the blend mode to use an additive blend.

lightFlareSprite.blendMode = SKBlendModeAdd;

See Also

Configuring Alpha Blendling

blendMode

The blend mode used to draw the sprite into the parent’s framebuffer.

SKBlendMode

The modes that describe how the source and destination pixel colors are used to calculate the new destination color.