Jump to content
Search Community

How to animate an object created as a path?

Ling Li test
Moderator Tag

Go to solution Solved by mvaneijgen,

Recommended Posts

Hi,

 

I'm trying to animate an object that I have created using svg path. The path is wrapped around a "g" group with a class attached to it.

In the example code pen, I can animate the circle, but the custom object does not animate.


What am I doing wrong? I'm a registered greenshock member, so do let me know if I need to use a specific plugin for this work?


Thanks,

Ling

 

See the Pen MWVzzoR by lingster (@lingster) on CodePen

Link to comment
Share on other sites

  • Solution

Hi @Ling Li welcome to the forum!

 

You don't need to target the attr, they are exposed directly within GSAP.  There is also no need to call tl.play(), the timeline plays automatically if you do not define otherwise.

 

A few other things

  • Your closing </g> tag was outside the </svg> 
  • There was an x="0"  attr on your circle, with didn't do anything

 

See the Pen bGvZByp?editors=1011 by mvaneijgen (@mvaneijgen) 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...