Creator 版本是 v2.4.6
想要实现的效果很简单,在 Creator 编辑器中,预览一下自己写的 tween 的效果。
查了一下文档,找到了 executeInEditMode ,于是试了一下,加了这个属性然后再 update 函数里:
this.node.x += 1;
试了一下,马上就能在编辑器中看到节点慢慢向左移动了。于是接着试了下调用 cc.tween:
update(dt) {
if (!this.isTweenCalled) {
cc.tween(this.node)
.to(1, { position: cc.v2(100, 100), rotation: 360 })
.to(1, { scale: 2 })
.start();
this.isTweenCalled = true;
cc.log("cc.tween called"):
}
}
修改代码后,在编辑器的输出日志中,可以看到输出的日志
cc.tween called
但是场景上的节点却是一动不动,想问下有没有朋友遇到过类似的问题。