Skip to content

macodeth/CocosColorMatrix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Color Matrix filters in Cocos Creator

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published