Properly animate rotation with GSAP

Hi everyone, I have a problem, basically I wanted to create a smooth transition between the current rotation of a model and another rotation. Problem is that the direction of the rotation is really ugly, it basically goes counterclock. I know gsap has functions like “_cw” “_ccw” “_short” but if I use them it messes up the values of the location.

This is the function to rotate the object:

gsap.to(peeler_model.rotation, {
    x: degToRad(129.2),
    y: degToRad(-1.9),
    z: degToRad(-25.2),
    duration: 2,
})

This is what happens:

You can use quaternion slerp to do shortest path between 2 rotations.

object.quaternion.slerp( target.quaternion , .1 )

1 Like

Yes basically this is the solution, I made a long reply into the gsap forum, so for everyone struggling with this problem I made a post there with the solution, just follow this link: