Skip to content

textmode.js / layering / TextmodeLayer / filter

Method: filter()

Call Signature

ts
filter<T>(name, params?): void;

Queue a post-processing filter for this layer.

Filters are applied after the ASCII resolve pass in the order they are called. Call this method within your layer's draw callback to apply effects.

Built-in filters:

  • 'invert' - Inverts all colors
  • 'grayscale' - Converts to grayscale (param: amount 0-1, default 1)
  • 'sepia' - Applies sepia tone (param: amount 0-1, default 1)
  • 'threshold' - Black/white threshold (param: threshold 0-1, default 0.5)

Type Parameters

Type Parameter
T extends BuiltInFilterName

Parameters

ParameterTypeDescription
nameTBuilt-in or registered filter name.
params?BuiltInFilterParams[T]Optional filter parameters.

Returns

void

Example

Call Signature

ts
filter<TParams>(name, params?): void;

Queue a registered custom filter for this layer.

Type Parameters

Type ParameterDefault type
TParamsunknown

Parameters

ParameterTypeDescription
namestringCustom filter name.
params?TParamsOptional filter parameters.

Returns

void