let out = new cc.Quat();
cc.Quat.rotateAroundLocal(out,this.node.getRotation(),new cc.Vec3(0,1,0),Math.PI/2);
cc.tween(this.node).to(1,{rotation:out}).start();
旋转过程中看着会有缩小的一个过程再回到正常。
let out = new cc.Quat();
cc.Quat.rotateAroundLocal(out,this.node.getRotation(),new cc.Vec3(0,1,0),Math.PI/2);
cc.tween(this.node).to(1,{rotation:out}).start();
旋转过程中看着会有缩小的一个过程再回到正常。
tween 对四元数插值,需要自定义 progress,里面改成用球面插值
或者用欧拉角做旋转
彦祖,能否给个progress的具体参考案例了?
cc.tween().to(1, {
scale: 2,
position: {
value: cc.v3(),
progress: (start, end, current, t) => {
// 注意,传入的属性为 cc.Vec3,所以需要使用 Vec3.lerp 进行插值计算
return start.lerp(end, t, current);
}
}
})
这是官方文档上面的例子,这个实在没看懂怎么用,三个参数都是 vec3 吗? t 时时间?
t 是比例,0 - 1
可以改成用欧拉角