Phaser API Documentation

  Version: 
getPixelAlpha(x, y, key, [frame])

Description:

Given a Texture and an x and y coordinate this method will return a value between 0 and 255 corresponding to the alpha value of the pixel at that location in the Texture. If the coordinate is out of bounds it will return null.

Parameters:

name type arguments description
x number

The x coordinate of the pixel within the Texture.

y number

The y coordinate of the pixel within the Texture.

key string

The unique string-based key of the Texture.

frame string | number <optional>

The string or index of the Frame.

Returns:
Description:

A value between 0 and 255, or null if the coordinates were out of bounds.

Type:
  • number
Since: 3.10.0