Forum Discussion
WilliamRyan-dba
26 days agoCommunity Member
Rotate object trigger
Hi All, I'm looking for a way to rotate an object with a trigger, but it's a little more complicated than just the standard animation. It would look like this: Trigger 1: Totate object counter-cloc...
- 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 });
WilliamRyan-dba
Community Member
It took some digging to find the object reference, but I could finally do it. Great solution, thanks!
LoriSmith-7e9ce
2 days agoCommunity Member
How do you find the object reference?