LayaBOX添加颜色滤镜
来源:互联网 发布:命令模式入门 java 编辑:程序博客网 时间:2024/06/07 13:37
/初始化舞台
Laya.init(1334,750,Laya.WebGL);
//设置舞台背景色
Laya.stage.bgColor= "#ffffff";
//原始位图
createImg(100,50);
//红色滤镜
creteRedFilter();
//灰色滤镜
createGrayFilter();
/**创建位图**/
function createImg(w,h){
var Img = newLaya.Sprite();
//添加到舞台
Laya.stage.addChild(Img);
//加载显示图片
Img.loadImage("res/tt.png",w,h);
Img.width=50;
Img.height=50;
return Img;
}
/**创建红色滤镜位图**/
function creteRedFilter(){
//颜色滤镜矩阵,红色
var colorMatrix =
[
1, 0, 0, 0, 0,//R
0, 0, 0, 0, 0,//G
0, 0, 0, 0, 0,//B
0, 0, 0, 1, 0,//A
];
//创建红色颜色滤镜
var redFilter = new Laya.ColorFilter(colorMatrix);
//在坐标280,50位置创建一个位图
var img = createImg(280,50);
//添加红色颜色滤镜效果
img.filters= [redFilter];
}
/**创建灰色滤镜位图**/
function createGrayFilter(){
//颜色滤镜矩阵,灰色
var colorMatrix =
[
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 GrayFilter = new Laya.ColorFilter(colorMatrix);
//在坐标460,50位置创建一个位图
var img = createImg(460,50);
//添加灰色颜色滤镜效果
img.filters= [GrayFilter];
}
阅读全文
0 0
- LayaBOX添加颜色滤镜
- CSS滤镜:颜色渐变
- ColorMatrixFilter--颜色矩阵滤镜
- ColorMatrixFilter--颜色矩阵滤镜
- 颜色矩阵滤镜-ColorMatrixFilter
- ColorMatrixFilter--颜色矩阵滤镜
- 滤镜之颜色特效
- 滤镜和颜色通道
- 颜色矩阵滤镜理解
- 图片添加滤镜
- Layabox简介
- 为ffmpeg添加自定义滤镜
- 为ffmpeg添加自定义滤镜
- 为ffmpeg添加自定义滤镜
- 为ffmpeg添加自定义滤镜
- 为UIImage添加滤镜效果
- 给GPUImage 添加滤镜组
- PS菜鸟入门 -- 添加滤镜
- MySql 批量更新语句
- 关于global index、local index、global partition index的适用场景
- idea debug技巧
- TPL
- 安装m4, autoconf, automake, libtool
- LayaBOX添加颜色滤镜
- 哥德巴赫猜想
- Ext.NET学习
- 蚁群算法、遗传算法、模拟退火算法介绍
- 指针指向变量的首地址
- getClass()与getName()和getSimpleName()的区别
- 洛谷的群号
- 8.10 直播回顾 | 一个小时内,我们用UWA GOT解决了这些问题...
- bat文件获取管理员权限