Jump to content
Search Community

Question on animation joints/pins through HTML parent nesting

franklylate 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 all, in AfterEffects you're able to pin animation pieces together at joints and they inherit transforms and I couldn't find any documentation on how to do a similar workflow properly in GSAP. I started picking apart the "Howl's moving castle" animation example and saw that the divs contain img elements and nested again within other divs and positioned using absolute so the transforms flow down properly to smaller elements. Tried out my own version on a simple scale animation.

 

Works fine, but got me thinking: is this the most effect way to animate complex components or is there a GSAP structure I should be using?

 

e.g.: nested containers and graphics for "torso > leg > thigh > shin > foot" vs "foot pinned at x,y to shin pinned at x,y to..."

 

Any guides or reassurances would be appreciated!

 

Thanks

See the Pen rgQyPy by jcollette (@jcollette) on CodePen

Link to comment
Share on other sites

36 minutes ago, franklylate said:

Hi all, in AfterEffects you're able to pin animation pieces together at joints and they inherit transforms and I couldn't find any documentation on how to do a similar workflow properly in GSAP.

 

GSAP just animates stuff, so there is no workflow, but nesting elements makes the most sense for DOM elements.

 

If you're animating SVG, you can use <g> elements to nest other elements. A simple demo I made a while ago to demonstrate that. Figuring out the position of child elements and transform origins is the hardest part.

 

See the Pen ooYgWg by osublake (@osublake) on CodePen

 

 

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

That makes a lot of sense -- I completely blanked on <g> elements since my Illustrator was set to minify the svg. I put together another prototype and dropped a circle as the anchor and used its xy coordinates as the svgOrigin for the part. This cleaned up everything really nicely!

 

Thanks

 

See the Pen GawLgy by jcollette (@jcollette) 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...