Cocos Creator 实现按钮图标的流光特效(Shader)
cocos creator如何使用shader可以参考:
代码
流光效果脚本组件代码:
/*************************************************************
* 流光效果 shader挂件
* -----------------------------------------------------------
* author : saint | email : 1053128593@qq.com
*
* create : 2017/09/12
* -----------------------------------------------------------
*
* CopyRight(C) 2017- | All Right Reserved
**************************************************************/
let vert_file = require("../ShaderFile/bright_vert.js");
let frag_file = require("../ShaderFile/bright_frag.js");
cc.Class({
extends : cc.Component,
properties : {
_time : 0.0,
},
onLoad : function(){
this._time = 0;
this._sin = 0;
this._use();
},
_use : function(){
this._program = new cc.GLProgram();
this._program.initWithVertexShaderByteArray( vert_file, frag_file);