bottle按压收缩那一节课 无法旋转
来源:7-13 bottle按压收缩的过程

qq_yu_52
2019-05-07
bottle按压收缩那一节课, head, body的动画都没有问题, 唯独人物旋转, 不会动, 不知道问题在哪,
如果body能正常收缩, 证明动画逻辑没有问题
并且通过调试, this.human.rotation.z 都有值, 但就是没有旋转
完整代码
// 瓶子旋转方法
rotate() {
const scale = 1.4;
this.human.rotation.x = this.human.rotation.z = 0;
// this.human.rotation.z = 0;
// x
if(this.direction == 0) {
customAnimation.to(0.14, this.human.rotation, { z: this.human.rotation.z - Math.PI});
customAnimation.to(0.18, this.human.rotation, { z: this.human.rotation.z - (2 * Math.PI) }, 'Linear', 0.14);
customAnimation.to( 0.1, this.head.position, { y: this.head.position.y + 0.9 * scale, x: this.head.position.x + 0.45 * scale });
customAnimation.to( 0.1, this.head.position, { y: this.head.position.y - 0.9 * scale, x: this.head.position.x - 0.45 * scale}, 'Linear', 0.1);
customAnimation.to( 0.15, this.head.position, { y: 7.56, x: 0 }, 'Linear', 0.25)
customAnimation.to(0.1, this.body.scale, { y: Math.max(scale, 1), x: Math.max(Math.min(1 / scale, 1), 0.7), z: Math.max(Math.min(1 / scale, 1), 0.7) })
customAnimation.to(0.1, this.body.scale, { y: Math.min(0.9 / scale, 0.7), x: Math.max(scale, 1.2), z: Math.max(scale, 1.2)}, 'Linear', 0.1)
customAnimation.to(0.3, this.body.scale, { y: 1, x: 1, z: 1 }, 'Linear', 0.2 )
}
}
customAnimation.to = function(duration, from, to, type, deley) {
for(let key in from) {
setTimeout(function (key) {
return function() {
if((to[key] === undefined)){ return }
tweenAnimation(from[key], to[key], duration, type, (value, complete) => {
from[key] = value;
if(complete) {
return;
}
console.log(from[key])
})
}
}(key), deley * 1000)
}
}
写回答
1回答
-
千迦
2019-12-02
需要具体调试一下逻辑 确认一下是不是动画库用的不对?
00
相似问题