Pixi.js: ColorMatrixFilter 如何按颜色使用

创建于 2018-01-14  ·  3评论  ·  资料来源: pixijs/pixi.js

你好,我想通过使用颜色为“#e73b37”的ColorMatrixFilter来使用图片,我如何通过矩阵数组使用,如何计算? 多谢

最有用的评论

不完全确定您在寻找什么,但是:

这是一种使用 ColorMatrixFilter 基本上复制tint方法。

const color = new PIXI.filters.ColorMatrixFilter();
const tint = 0xe73b37;
const r = tint >> 16 & 0xFF;
const g = tint >> 8 & 0xFF;
const b = tint & 0xFF;
color.matrix[0] = r / 255;
color.matrix[6] = g / 255;
color.matrix[12] = b / 255;

https://jsfiddle.net/bigtimebuddy/4612gq30/1/

我对 PixiAnimate 使用了一种方法: https :

上面的代码将允许您进行加色和多色。

所有3条评论

不完全确定您在寻找什么,但是:

这是一种使用 ColorMatrixFilter 基本上复制tint方法。

const color = new PIXI.filters.ColorMatrixFilter();
const tint = 0xe73b37;
const r = tint >> 16 & 0xFF;
const g = tint >> 8 & 0xFF;
const b = tint & 0xFF;
color.matrix[0] = r / 255;
color.matrix[6] = g / 255;
color.matrix[12] = b / 255;

https://jsfiddle.net/bigtimebuddy/4612gq30/1/

我对 PixiAnimate 使用了一种方法: https :

上面的代码将允许您进行加色和多色。

@bigtimebuddy我的问题已成功解决! 非常感谢! 衷心祝愿你

由于关闭后没有任何近期活动,因此该线程已自动锁定。 请为相关错误打开一个新问题。

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

distinctdan picture distinctdan  ·  3评论

gaccob picture gaccob  ·  3评论

Makio64 picture Makio64  ·  3评论

SebastienFPRousseau picture SebastienFPRousseau  ·  3评论

readygosports picture readygosports  ·  3评论