我有一个通过new PIXI.Sprite.fromImage(path)
创建的精灵,我怎样才能实时提高它的亮度?
答案 0 :(得分:9)
您可以使用PIXI ColorMatrixFilter:
执行此操作var colorMatrix = [
1,0,0,0,
0,1,0,0,
0,0,1,0,
0,0,0,1
];
var filter = new PIXI.ColorMatrixFilter();
filter.matrix = colorMatrix;
stage.filters = [filter];
较暗:
var colorMatrix = [
1,0,0,-0.5,
0,1,0,-0.5,
0,0,1,-0.5,
0,0,0,1
];
打火机:
var colorMatrix = [
1,0,0,0.5,
0,1,0,0.5,
0,0,1,0.5,
0,0,0,1
];
请在此处查看快速演示:http://codepen.io/ianmcgregor/pen/LcjBw