Hello. Tell me how to properly configure tween. There are two rotation functions. One way and the other. But when calling the second function, the object does not return to its original state after the rotation, but first returns to its original state and then does the rotation - repeats the first function. I assume that the case is in this.entity.setLocalEulerAngles(0, 0, 0)
Code Highlight`
Card.prototype.rotate = function(){
// if we are already tweening then stop first
if (this.tween) {
this.tween.stop();
}
// reset our rotation
this.entity.setLocalEulerAngles(0, 0, 0);
// create a new tween using our script attributes
this.tween = this.entity.tween(this.entity.getLocalRotation())
.rotate(new pc.Vec3(0, -180, 0), this.duration, pc[this.easing])
// start the tween
this.tween.start();
}
Card.prototype.rotateBack = function(){
// if we are already tweening then stop first
if (this.tween) {
this.tween.stop();
}
// reset our rotation
this.entity.setLocalEulerAngles(0, -180, 0);
// create a new tween using our script attributes
this.tween = this.entity.tween(this.entity.getLocalRotation())
.rotate(new pc.Vec3(0, 180, 0), this.duration, pc[this.easing])
// start the tween
this.tween.start();
}