Hello, so I have been trying to wrap my head around this exact problem for couple of weeks myself (I’m also new to three.js) and have come up with this solution:
I’m rotating and animating the pivot around the respective axis, adjusting the position and rotation of the cube and finally resetting the the rotation of the pivot.
I hope this helps