Shader effect
Introduction¶
Shader effect of camera.
- Author: Richard Davey
Usage¶
Register post-fx pipeline¶
- Register post-fx pipeline in game config
import PostFxClass from 'path'; var config = { // ... pipeline: [PostFxClass] // ... }; var game = new Phaser.Game(config);
Some post-fx pipelines:
- Glow-filter: Glow post processing filter.
- Gray-scale: Gray scale post processing filter.
- Hsl-adjust: Adjust color in HSL domain, post processing filter.
- Inverse: Inverse color post processing filter.
- Outline: Outline post processing filter.
- Pixelation: Pixelation post processing filter.
- Toonify: Draw outlines and quantize color in HSV domain, post processing filter.
- Swirl: Swirl post processing filter.
Add post-fx pipeline¶
camera.setPostPipeline(PostFxClass);
PostFxClass
: Class of post-fx pipeline.
Remove post-fx pipeline¶
- Remove a kind of post-fx pipeline
camera.removePostPipeline(PostFxClass);
- Remove all post-fx pipelines
or
camera.resetPipeline(true);
camera.postPipelines = []; camera.hasPostPipeline = false;
Get post-fx pipeline¶
var pipelineInstance = camera.getPostPipeline(PostFxClass);
pipelineInstance
:- A pipeline instance
- An array of pipeline instances