Jump to content
Search Community

Bezier curve tween not happening from transform center

anotheruser test
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

Hi,

 

 

I have been trying to tween an svg using bezier curve  , In that example i created a path where i am trying to tween this , But i cannot tween from center or create an offset , what happens now is it moves to the left corner and then start tweening along the path , but i want to tween as it is , Yes i know that i can set xPercent, but no I do not want that , because it changes the position of the svg. 

 

Also  I would be using dynamic SVG so i cant be using morphsvg plugin

 

I worked in flash before using the following code

Now i need the same for JS

 

 

 

See the Pen rpPxXm?editors=1010 by jeffin417 (@jeffin417) on CodePen

Link to comment
Share on other sites

You're placing a bunch of unnecessary restrictions on your animation. And I see transforms in your html that do the same thing as xPercent/yPercent.

 

Transform origin does not affect x and y. If you want to move something from the center instead of the top left corner, then offset your points half the width and height of the object your animating.

  • Like 4
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...