Jump to content
Search Community

Try to animate vertical svg line

Katapub test
Moderator Tag

Recommended Posts

Hi, 

 

I'm very new to Gsap animation. I'm trying to do something simple, but it doesn't work, even though I started from this very simple example. Maybe I'm not converting it to gsap 3 correctly... 

 

See the Pen mJyZdj by MAW (@MAW) on CodePen

 

Since my start line is vertical, I only have x and y coordinates, and the final result is with a "d" attributes. Is it not working because I am trying to work with apples and oranges? 

 

Thanks for your help.

See the Pen eYZKKZJ by cepheide (@cepheide) on CodePen

Link to comment
Share on other sites

36 minutes ago, Katapub said:

Is it not working because I am trying to work with apples and oranges? 

Correct. Your lines have x1/x2/y1/y2 attributes but no d attribute. You'd want to convert those to paths in your vector software or use GSAP to convert them. The morph plugin can do that for you. You'd simply load that plugin and use this code before your tweens.

 

MorphSVGPlugin.convertToPath("line");

More info:

https://greensock.com/docs/v3/Plugins/MorphSVGPlugin/static.convertToPath()

 

Happy tweening and welcome to the forum.

:)

 

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