PIXI.filters.DisplacementFilter
class DisplacementFilter extends PIXI.Filter
The DisplacementFilter class uses the pixel values from the specified texture (called the displacement map) to perform a displacement of an object.
You can use this filter to apply all manor of crazy warping effects.
Currently the r
property of the texture is used to offset the x
and the g
property of the texture is used to offset the y
.
The way it works is it uses the values of the displacement map to look up the
correct pixels to output. This means it's not technically moving the original.
Instead, it's starting at the output and asking "which pixel from the original goes here".
For example, if a displacement map pixel has red = 1
and the filter scale is 20
,
this filter will output the pixel approximately 20 pixels to the right of the original.
Constructor
new PIXI.filters.DisplacementFilter(sprite: PIXI.Sprite, scale: number) → {}
Name | Type | Attributes | Description |
---|---|---|---|
sprite | PIXI.Sprite |
The sprite used for the displacement map. (make sure its added to the scene!) |
|
scale | number |
<optional> |
The scale of the displacement |
Summary
Properties from DisplacementFilter
PIXI.Texture |
The texture used for the displacement map. Must be power of 2 sized texture. |
PIXI.Point |
|
Methods from DisplacementFilter
void |
|
Properties inherited from Filter
boolean |
|
PIXI.BLEND_MODES |
|
boolean |
If enabled is true the filter is applied, if false it will not. |
boolean |
|
PIXI.MSAA_QUALITY |
The samples of the filter. |
number |
|
number |
|
PIXI.State |
The WebGL state the filter requires to render. |
Properties inherited from Shader
PIXI.Program |
Program that the shader uses. |
Dict<any> |
|
Public Properties
map: PIXI.Texture
The texture used for the displacement map. Must be power of 2 sized texture.
Public Methods
apply(filterManager: PIXI.FilterSystem, input: PIXI.RenderTexture, output: PIXI.RenderTexture, clearMode: PIXI.CLEAR_MODES) → {void}
Applies the filter.
Name | Type | Description |
---|---|---|
filterManager | PIXI.FilterSystem |
The manager. |
input | PIXI.RenderTexture |
The input target. |
output | PIXI.RenderTexture |
The output target. |
clearMode | PIXI.CLEAR_MODES |
clearMode. |
Type | Description |
---|---|
void |