Referencing and changing DisplayObject's blendMode

blendMode

Sets the DisplayObject's BlendMode. According to the set BlendMode, the DisplayObject and background colors (RGB) are compared, added and subtracted for each corresponding pixel, and drawn based on the result.

Constants and Overview

  • BlendMode.NORMAL(default)

    The DisplayObject will be displayed before the background.

  • BlendMode.ADD

    Adds the value of the DisplayObject's element color to the background color, applying an upper limit of 0xFF in doing so.。

  • BlendMode.ALPHA

    Applies the alpha value of each pixel of the DisplayObject to the background.

  • BlendMode.DARKEN

    Selects the darker (lower value) of the DisplayObject's element color and background color.

  • BlendMode.DIFFERENCE

    Compares the DisplayObject's element color with the background color and subtracts the darker value from the lighter of the two element colors.

  • BlendMode.ERASE

    Erases the background based on the DisplayObject's alpha value.

  • BlendMode.HARDLIGHT

    Adjusts the color of each pixel based on the darkness of the DisplayObject.

  • BlendMode.INVERT

    Inverts the background.

  • BlendMode.LAYER

    Forces the creation of transparency groups related to DisplayObjects.

  • BlendMode.LIGHTEN

    Selects the lighter (higher value) of the DisplayObject's element color and background color.

  • BlendMode.MULTIPLY

    After multiplying the element color value of the DisplayObject by the element color value of the background color, divide by 0xFF to normalize and darken the color.

  • BlendMode.OVERLAY

    Adjusts the color of each pixel based on the darkness of the DisplayObject.

  • BlendMode.SCREEN

    Multiply the complement of the DisplayObject's color (inverse) by the complement of the background color to get the bleach effect.

  • BlendMode.SUBTRACT

    Subtracts the element color value of the display object from its background color value, setting the lower limit of the result to 0.

Example

Next Chapter