PIXI.filters.ColorReplaceFilter

class ColorReplaceFilter extends PIXI.Filter

ColorReplaceFilter, originally by mishaa, updated by timetocode http://www.html5gamedevs.com/topic/10640-outline-a-sprite-change-certain-colors/?p=69966
originalfilter


  // replaces true red with true blue
  someSprite.filters = [new ColorReplaceFilter(
   [1, 0, 0],
   [0, 0, 1],
   0.001
   )];
  // replaces the RGB color 220, 220, 220 with the RGB color 225, 200, 215
  someOtherSprite.filters = [new ColorReplaceFilter(
   [220/255.0, 220/255.0, 220/255.0],
   [225/255.0, 200/255.0, 215/255.0],
   0.001
   )];
  // replaces the RGB color 220, 220, 220 with the RGB color 225, 200, 215
  someOtherSprite.filters = [new ColorReplaceFilter(0xdcdcdc, 0xe1c8d7, 0.001)];
See:

Constructor


new PIXI.filters.ColorReplaceFilter(originalColor: number | number<Array> | Float32Array, newColor: number | number<Array> | Float32Array, epsilon: number) → {}
Parameters:
Name Type Attributes Default Description
originalColor number | number<Array> | Float32Array

<optional>

0xFF0000

The color that will be changed, as a 3 component RGB e.g. [1.0, 1.0, 1.0]

newColor number | number<Array> | Float32Array

<optional>

0x000000

The resulting color, as a 3 component RGB e.g. [1.0, 0.5, 1.0]

epsilon number

<optional>

0.4

Tolerance/sensitivity of the floating-point comparison between colors (lower = more exact, higher = more inclusive)

Summary


Properties from ColorReplaceFilter

number
epsilon = 0.4
number | number<Array> | Float32Array
newColor = 0x000000
number | number<Array> | Float32Array
originalColor = 0xFF0000

Properties inherited from Filter

boolean
autoFit = true
PIXI.BLEND_MODES
blendMode = PIXI.BLEND_MODES.NORMAL
boolean
enabled

If enabled is true the filter is applied, if false it will not.

boolean
legacy
PIXI.MSAA_QUALITY
multisample

The samples of the filter.

number
padding
number
resolution
PIXI.State
state

The WebGL state the filter requires to render.

Properties inherited from Shader

PIXI.Program
program

Program that the shader uses.

Dict<any>
uniforms

Methods inherited from Filter

void
apply(filterManager: PIXI.FilterSystem, input: PIXI.RenderTexture, output: PIXI.RenderTexture, clearMode: PIXI.CLEAR_MODES, _currentState: object)

Public Properties


epsilon ColorReplaceFilter.ts:113
epsilon: number = 0.4

Tolerance/sensitivity of the floating-point comparison between colors (lower = more exact, higher = more inclusive)

newColor ColorReplaceFilter.ts:86
newColor: number | number<Array> | Float32Array = 0x000000

The resulting color, as a 3 component RGB e.g. [1.0, 0.5, 1.0]

originalColor ColorReplaceFilter.ts:59
originalColor: number | number<Array> | Float32Array = 0xFF0000

The color that will be changed, as a 3 component RGB e.g. [1.0, 1.0, 1.0]


Powered by webdoc!