Forum Discussion
Rotate object trigger
- 26 days ago
The code in GSAP will be as simple as possible. You need to find the desired object (the one you want to rotate), and it's best to do this by the object's ID.
Then, you create the animation. For example, a rotation of 90 degrees will look like this:
gsap.to(yourObject, { rotation: 90, duration: 1 });
A more interesting animation, where the object slightly tilts in the opposite direction and then rotates 90 degrees, will look like this:
gsap.to(yourObject, { rotation: -30, duration: 0.5, ease: "power2.out" }) gsap.to(yourObject, { rotation: 120, duration: 0.5, ease: "power2.out", delay: 0.5 });
Will this work if the object I want to rotate is actually a group of objects? How do I find the object ID of a group?
Learning Dojo has a good video about this on YouTube. I could rotate a group by scrolling higher through the code to find the object reference.
Custom Storyline Animations Made Easy