36 lines
1.0 KiB
JavaScript
36 lines
1.0 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, '68dcelbAH1Olb54oCMb3sJY', 'shader.flash');
|
||
|
|
// resources/coms/shaders/flash/shader.flash.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
cc.Class({
|
||
|
|
"extends": cc.Component,
|
||
|
|
properties: {
|
||
|
|
_time: 0
|
||
|
|
},
|
||
|
|
// 编辑器特性
|
||
|
|
editor: {
|
||
|
|
// 允许当前组件在编辑器模式下运行
|
||
|
|
executeInEditMode: false,
|
||
|
|
// requireComponent 参数用来指定当前组件的依赖组件
|
||
|
|
requireComponent: cc.RenderComponent,
|
||
|
|
// 当本组件添加到节点上后,禁止同类型(含子类)的组件再添加到同一个节点,防止逻辑发生冲突
|
||
|
|
disallowMultiple: true,
|
||
|
|
// menu 用来将当前组件添加到组件菜单中,方便用户查找
|
||
|
|
menu: "着色器/shader.flash 闪光"
|
||
|
|
},
|
||
|
|
// 载入
|
||
|
|
onLoad: function onLoad() {
|
||
|
|
this.rc = this.node.getComponent(cc.RenderComponent);
|
||
|
|
},
|
||
|
|
update: function update(dt) {
|
||
|
|
this.rc.getMaterial(0).setProperty('Time', this._time);
|
||
|
|
if (this._time > 65535) {
|
||
|
|
this._time = 0;
|
||
|
|
}
|
||
|
|
this._time += dt;
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
cc._RF.pop();
|