Namespace: filters

filters

Classes

AlphaFilter
BlurFilterPass
ColorMatrixFilter
DisplacementFilter
Filter
NoiseFilter
ShockwaveFilter

Interface Definitions

AlphaFilterOptions

Options for AlphaFilter

Properties:
Name Type Default Description
alpha number 1

Amount of alpha from 0 to 1, where 0 is transparent

BlurFilterOptions

Options for BlurFilter

Properties:
Name Type Default Description
kernelSize number 5

The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15.

quality number 4

The quality of the blur filter.

resolution number

The resolution of the blur filter.

strength number 8

The strength of the blur filter.

BlurFilterPassOptions

Options for BlurFilterPass

Properties:
Name Type Description
horizontal boolean

Do pass along the x-axis (true) or y-axis (false).

DisplacementFilterOptions

Options for DisplacementFilter

Properties:
Name Type Description
scale number | PointData

The scale of the displacement.

sprite Sprite

The texture used for the displacement map.

FilterOptions

The options to use when creating a new filter.

Properties:
Name Type Description
antialias FilterAntialias | boolean

If true the filter will make use of antialiasing. Although it looks better this can have a performance impact. By default, the filter will detect the antialiasing of the renderer and change this automatically. Definitely don't set this to true if the renderer has antialiasing set to false. As it will antialias, but you won't see the difference.

This can be a boolean or FilterAntialias string.

blendMode BLEND_MODES

optional blend mode used by the filter when rendererig (defaults to 'normal')

blendRequired boolean

If this is set to true, the filter system will grab a snap shot oif the are being rendered to and pass this into the shader. This is useful for blend modes that need to be aware of the pixels they are rendering to. Only use if you need that data, otherwise its an extra gpu copy you don't need! (default false)

padding number

the amount of pixels to pad the container with when applying the filter. For example a blur extends the container out as it blurs, so padding is applied to ensure that extra detail is rendered as well without clipping occurring. (default 0)

resolution number

the resolution the filter should be rendered at. The lower the resolution, the more performant the filter will be, but the lower the quality of the output. (defaults to the renderers resolution) Consider lowering this for things like blurs filters

NoiseFilterOptions

Options for NoiseFilter

Properties:
Name Type Description
noise number

The amount of noise to apply, this value should be in the range (0, 1].

seed number

A seed value to apply to the random noise generation. Math.random() is a good value to use.

ShockwaveFilterOptions

Options for ShockwaveFilter

Properties:
Name Type Default Description
amplitude number 30

The amplitude of the shockwave

brightness number 1

The brightness of the shockwave

center PointData [0,0]

The x and y center coordinates to change the position of the center of the circle of effect.

radius number -1

The maximum radius of shockwave. less than 0 means the max is an infinite distance

speed number 500

The speed about the shockwave ripples out. The unit is pixel-per-second

wavelength number 160

The wavelength of the shockwave

Type Definitions

5x4 matrix for transforming RGBA color and alpha

FilterAntialias

The antialiasing mode of the filter. This can be either:

  • on - the filter is always antialiased regardless of the renderer settings
  • off - the filter is never antialiased regardless of the renderer settings
  • inherit - (default) the filter uses the antialias settings of the renderer