[]使用滤镜报错
我在图集json获取shzview.autoBtn这个按钮,然后对按钮进行滤镜处理enable_false(shzview.autoBtn);
// 灰色滤镜
var grayfilter = [
0.3086, 0.6094, 0.0820, 0, 0,//R
0.3086, 0.6094, 0.0820, 0, 0,//G
0.3086, 0.6094, 0.0820, 0, 0,//B
0, 0, 0, 1, 0 //A
];
var grayscaleMatN = 0.8;
var grayscaleMat = [
0.3086 * (1 - grayscaleMatN) + grayscaleMatN, 0.6094 * (1 - grayscaleMatN), 0.0820 * (1 - grayscaleMatN), 0, -40,//R
0.3086 * (1 - grayscaleMatN), 0.6094 * (1 - grayscaleMatN) + grayscaleMatN, 0.0820 * (1 - grayscaleMatN), 0, -40,//G
0.3086 * (1 - grayscaleMatN), 0.6094 * (1 - grayscaleMatN), 0.0820 * (1 - grayscaleMatN) + grayscaleMatN, 0, -40,//B
0, 0, 0, 1, 0 //A
];
var grayscaleFilter = new Laya.ColorFilter(grayscaleMat);
//按钮置灰
function enable_false(v) {
v.filters = [grayscaleFilter];
v.mouseEnabled = false;
}
//按钮恢复
function enable_true(v) {
v.filters = null;
v.mouseEnabled = true;
}
报错日志:
TypeError: f.action.setValue is not a function
at TextureSV.__proto.setFilters (file:///E:/FS_Project/trunk/LAYA/PFX12/H5_SHZ/bin/libs/laya.core.js:22308:15)
at TextureSV.__proto.setValue (file:///E:/FS_Project/trunk/LAYA/PFX12/H5_SHZ/bin/libs/laya.core.js:23986:23)
at Function.SubmitTexture.create (file:///E:/FS_Project/trunk/LAYA/PFX12/H5_SHZ/bin/libs/laya.core.js:23049:18)
at WebGLContext2D.__proto._drawTextureM (file:///E:/FS_Project/trunk/LAYA/PFX12/H5_SHZ/bin/libs/laya.core.js:21451:26)
at WebGLContext2D.__proto.drawTexture (file:///E:/FS_Project/trunk/LAYA/PFX12/H5_SHZ/bin/libs/laya.core.js:21355:9)
at RenderContext._drawTexture (file:///E:/FS_Project/trunk/LAYA/PFX12/H5_SHZ/bin/libs/laya.core.js:4555:33)
at AutoBitmap.__proto._renderOneImg (file:///E:/FS_Project/trunk/LAYA/PFX12/H5_SHZ/bin/libs/laya.core.js:1849:21)
at RenderSprite3D.__proto._graphics (file:///E:/FS_Project/trunk/LAYA/PFX12/H5_SHZ/bin/libs/laya.core.js:5125:41)
at RenderSprite3D.Filter._filter [as _fun] (file:///E:/FS_Project/trunk/LAYA/PFX12/H5_SHZ/bin/libs/laya.core.js:20771:17)
at RenderSprite3D.RenderSprite._initRenderFun [as _fun] (file:///E:/FS_Project/trunk/LAYA/PFX12/H5_SHZ/bin/libs/laya.core.js:5317:6)
// 灰色滤镜
var grayfilter = [
0.3086, 0.6094, 0.0820, 0, 0,//R
0.3086, 0.6094, 0.0820, 0, 0,//G
0.3086, 0.6094, 0.0820, 0, 0,//B
0, 0, 0, 1, 0 //A
];
var grayscaleMatN = 0.8;
var grayscaleMat = [
0.3086 * (1 - grayscaleMatN) + grayscaleMatN, 0.6094 * (1 - grayscaleMatN), 0.0820 * (1 - grayscaleMatN), 0, -40,//R
0.3086 * (1 - grayscaleMatN), 0.6094 * (1 - grayscaleMatN) + grayscaleMatN, 0.0820 * (1 - grayscaleMatN), 0, -40,//G
0.3086 * (1 - grayscaleMatN), 0.6094 * (1 - grayscaleMatN), 0.0820 * (1 - grayscaleMatN) + grayscaleMatN, 0, -40,//B
0, 0, 0, 1, 0 //A
];
var grayscaleFilter = new Laya.ColorFilter(grayscaleMat);
//按钮置灰
function enable_false(v) {
v.filters = [grayscaleFilter];
v.mouseEnabled = false;
}
//按钮恢复
function enable_true(v) {
v.filters = null;
v.mouseEnabled = true;
}
报错日志:
TypeError: f.action.setValue is not a function
at TextureSV.__proto.setFilters (file:///E:/FS_Project/trunk/LAYA/PFX12/H5_SHZ/bin/libs/laya.core.js:22308:15)
at TextureSV.__proto.setValue (file:///E:/FS_Project/trunk/LAYA/PFX12/H5_SHZ/bin/libs/laya.core.js:23986:23)
at Function.SubmitTexture.create (file:///E:/FS_Project/trunk/LAYA/PFX12/H5_SHZ/bin/libs/laya.core.js:23049:18)
at WebGLContext2D.__proto._drawTextureM (file:///E:/FS_Project/trunk/LAYA/PFX12/H5_SHZ/bin/libs/laya.core.js:21451:26)
at WebGLContext2D.__proto.drawTexture (file:///E:/FS_Project/trunk/LAYA/PFX12/H5_SHZ/bin/libs/laya.core.js:21355:9)
at RenderContext._drawTexture (file:///E:/FS_Project/trunk/LAYA/PFX12/H5_SHZ/bin/libs/laya.core.js:4555:33)
at AutoBitmap.__proto._renderOneImg (file:///E:/FS_Project/trunk/LAYA/PFX12/H5_SHZ/bin/libs/laya.core.js:1849:21)
at RenderSprite3D.__proto._graphics (file:///E:/FS_Project/trunk/LAYA/PFX12/H5_SHZ/bin/libs/laya.core.js:5125:41)
at RenderSprite3D.Filter._filter [as _fun] (file:///E:/FS_Project/trunk/LAYA/PFX12/H5_SHZ/bin/libs/laya.core.js:20771:17)
at RenderSprite3D.RenderSprite._initRenderFun [as _fun] (file:///E:/FS_Project/trunk/LAYA/PFX12/H5_SHZ/bin/libs/laya.core.js:5317:6)
没有找到相关结果
已邀请:
要回复问题请先登录
2 个回复
cuixueying
赞同来自:
vincent
赞同来自: