Jump to content
Search Community

Offsetting the center point for an element moving along a bezier

SammyC123 test
Moderator Tag

Go to solution Solved by OSUblake,

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

I don't believe a Codepen is necessary for this question, although I can build one if someone needs to see precisely what I'm talking about.

 

If you have a very long (width-wise) element you want to animate along a bezier curve, and you're using autoRotate, it automatically calculates the center of that element and rotates it around that point.  How can I offset that center point, say, 50px to the right?

Link to comment
Share on other sites

Nice one Diaco!

 

That feature was added after I made that pen, but nice to know it has the same effect. The hardest thing for me was dialing in the correct transform origin and offsets. But even if you not using the MorphSVGPlugin, you can still do that. Just loop through your array of Bezier values add the offset to each point.

See the Pen WwpmKo?editors=0010 by osublake (@osublake) on CodePen

  • Like 1
Link to comment
Share on other sites

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...