Jump to content
Search Community

Interactive Nested Timelines

Amnesicat test
Moderator Tag

Go to solution Solved by mvaneijgen,

Recommended Posts

Hi,

I'm trying to emulate something like this - I tried doing a forEach to dynamically capture all item elements, create fromTo tweens into separate child timelines and then add them to a main timeline to enable expand all items etc. (see codepen), but it's not working as intended. The item animations work fine on there own but when I add them to the main timeline they mess everything up. Can you control nested GSAP timelines individually like this, or is there a better way to do it?

 

Any guidance or examples on how to do this properly would be greatly appreciated.

 

Thanks a lot,

Alan

 

See the Pen gOQygvm by Amnesicat (@Amnesicat) on CodePen

Link to comment
Share on other sites

  • Solution

Hi @Amnesicat I would just collect all the timelines in an array and then just play the timelines or reverse them. This is just a quick example, you could certainly build it to always reverse first if any timeline has already played. And check if all timelines are played then set the played value to true and then it will reverse them all, but I'll leave that to you. Hope it helps and happy tweening! 

 

See the Pen JjeVyXK?editors=0010 by mvaneijgen (@mvaneijgen) on CodePen

  • Like 4
Link to comment
Share on other sites

wow, @mvaneijgen came in hot 🔥 with a super solution!

 

I was working slower on something very similar so I'll just share it also

 

See the Pen gOQyxMv?editors=0110 by snorkltv (@snorkltv) on CodePen

 

Also, there are times when you want to open one thing and close whatever other this currently open.

I have video lesson on this in my GSAP video training, but here's the demo if you want to study the technique.

 

See the Pen YzGpXWO by snorkltv (@snorkltv) on CodePen

 

  • Like 3
  • Haha 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...