我想实现一个每一帧都去调用一个func的动作
let tw = cc.tween( this );
tw.repeatForever(
tw.delay( 0 )
.call( this.func.bind(this) )
).start()
这样的话 会非常卡 fps只有2 3帧
请问这个该怎么做?
creator版本2.4.3
我想实现一个每一帧都去调用一个func的动作
let tw = cc.tween( this );
tw.repeatForever(
tw.delay( 0 )
.call( this.func.bind(this) )
).start()
这样的话 会非常卡 fps只有2 3帧
请问这个该怎么做?
creator版本2.4.3
每一帧执行放在 update(dt){} 里面
纯nodejs类 并不继承cc.Node或者cc.Component
放到某一个node 脚本的update 里 ,调用你的这个纯node 方法。
试试这样
class Foo{
init(){
cc.director.getScheduler().enableForTarget(this)
cc.director.getScheduler().scheduleUpdate(this,0,false);
}
update(dt){
// 逻辑
}
}
let FPS = 60;
let tw = cc.tween( this );
tw.repeatForever(
tw.delay( 1/FPS )
.call( this.func.bind(this) )
).start()
可以放在update中,cc.tween触发时候维护一个状态,在update中更具状态触发方法,这才是每一帧触发。
纯Nodejs类 不继承cc.Node 也不继承cc.Component