Phaser API Documentation

  Version: 
addDisplacement([texture], [x], [y])

Description:

Adds a Displacement effect.

The displacement effect is a visual technique that alters the position of pixels in an image or texture based on the values of a displacement map. This effect is used to create the illusion of depth, surface irregularities, or distortion in otherwise flat elements. It can be applied to characters, objects, or backgrounds to enhance realism, convey movement, or achieve various stylistic appearances.

Parameters:

name type arguments Default description
texture string <optional> '__WHITE'

The unique string-based key of the texture to use for displacement, which must exist in the Texture Manager.

x number <optional> 0.005

The amount of horizontal displacement to apply. A very small float number, such as 0.005.

y number <optional> 0.005

The amount of vertical displacement to apply. A very small float number, such as 0.005.

Returns:
Description:

The Displacement FX Controller.

Since: 3.60.0