36 lines
1.0 KiB
JavaScript
36 lines
1.0 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, 'eca6e2uhshFmbjUG9diX117', 'shader.fluxay');
|
||
|
|
// resources/coms/shaders/fluxay/shader.fluxay.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
cc.Class({
|
||
|
|
"extends": cc.Component,
|
||
|
|
properties: {
|
||
|
|
_time: 0
|
||
|
|
},
|
||
|
|
// 编辑器特性
|
||
|
|
editor: {
|
||
|
|
// 允许当前组件在编辑器模式下运行
|
||
|
|
executeInEditMode: true,
|
||
|
|
// requireComponent 参数用来指定当前组件的依赖组件
|
||
|
|
requireComponent: cc.RenderComponent,
|
||
|
|
// 当本组件添加到节点上后,禁止同类型(含子类)的组件再添加到同一个节点,防止逻辑发生冲突
|
||
|
|
disallowMultiple: true,
|
||
|
|
// menu 用来将当前组件添加到组件菜单中,方便用户查找
|
||
|
|
menu: "着色器/shader.fluxay 流光"
|
||
|
|
},
|
||
|
|
// 载入
|
||
|
|
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();
|