Jump to content
Search Community

Animating individual items included through svg use

remopini test
Moderator Tag

Go to solution Solved by OSUblake,

Recommended Posts

I would like to INDIVIDUALLY animate some bars. If I create those bars with cut-copy-paste, it works fine, but it's a nightmare to manage.

If I define them as a "defs" and then insert them using "use", they seem to become "ganged". I assume that is, because GSAP is actually modifying the underlying base object, not the virtual copies? Is there a way to get to the properties of the instanced copies instead of the base object? I'd like to avoid having to paste them (there are a lot of them).

See the Pen OJppyyV by remo-pini (@remo-pini) on CodePen

Link to comment
Share on other sites

  • Solution
5 minutes ago, remopini said:

If I define them as a "defs" and then insert them using "use", they seem to become "ganged". I assume that is, because GSAP is actually modifying the underlying base object, not the virtual copies?

 

That's not a GSAP issue. That's how <use> elements work. You really change much internally besides some colors and CSS variables.

 

If you don't like pasting, then let JavaScript do it for you.

 

See the Pen 4deb6be7951e9a8c80cea2746021371f by osublake (@osublake) on CodePen

 

 

 

 

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