Skip to content

Latest commit

 

History

History
32 lines (31 loc) · 1.94 KB

README.md

File metadata and controls

32 lines (31 loc) · 1.94 KB

Color Matrix filters in Cocos Creator 3.8+

Transform colors using matrix to make cool effects!
Currently have 20+ presets, implementation and filters based on various sources (see References)

Presets

Usage

Setup

Effects can be applied to Sprite or Spine skeleton
For Sprite, change Custom Material to color-matrix-sprite.mtl, then add component 2D/ColorMatrixSprite
For Spine skeleton (sp.Skeleton), change Custom Material to color-matrix-spine.mtl, then add component 2D/ColorMatrixSpine

Coding

To apply filter from code, get reference to ColorMatrix* component and use its function, it's possible to animate the effect by changing filter continuously
Function list:

Function Usage
reset Remove all effects
overrideMatrix Override current matrix data
multiply Multiply current matrix with a custom matrix
[effectName]filter Apply an effect, if multiply = true, then multiply this effect on top of current matrix, else set current matrix to this effect

References

Phaser's Color Matrix FX
rn-color-matrices
Affine HSV color manipulation