Jump to content
Search Community

Rotate 2 classes from only their origin points

michaelsboost
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Posted

I first heard about GreenSock a few years ago but never had a project where I needed it until recently.

 

Anyway I started playing with it for the first time yesterday and really like it. However I'm now stuck and after all the reading I've been doing I can't find any help or solution hence why I registered.

 

My question is simple, "How can I rotate just the eyeballs of my SVG without them changing position?"

 

I've included my Pen via Codepen so you can take a look at the code.

TweenMax.to(".clockexer .eye", 5, {
  y: 0,
  x: 0,
  rotation: 360,
  transformOrigin: "50% 50%",
  yoyo: false, 
  repeat: -1,
  ease: Power0.none
});

See the Pen zYOaVQW by michaelsboost (@michaelsboost) on CodePen.

Posted

Hi and welcome to the forum. :)

 

If I understand your question correctly, I think you need to regroup some of the eye elements and rotate using svgOrigin for the group. Is this what you wanted to happen?

 

See the Pen qBWKeav by PointC (@PointC) on CodePen.

 

Hopefully that helps. Happy tweening.

:)

 

  • Like 4
Posted
12 minutes ago, PointC said:

Hi and welcome to the forum. :)

 

If I understand your question correctly, I think you need to regroup some of the eye elements and rotate using svgOrigin for the group. Is this what you wanted to happen?


Thanks and yes that's correct. 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...