Jump to content
Search Community

animating while DOM manipulation

imp2021 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

I know its dicouraged, and i think its the future. i've read though:

https://greensock.com/forums/topic/15014-add-tweens-on-timeline-for-dom-created-in-timeline/?hl=tweens+changing+dom#entry64670 and stuff.. and I'm new.

 

However, I didn't figure/ see a solution propagated anywhere.

I really really really want dynamically insert elements on my dom, and then animate upon those changed dom.

(respectively: change->animation->change->animation)

 

I have put it on stackoverflow (sry for linking there instead of reformatting it all again and CnP and update upon both.)

and a fiddle

 

any suggestion highly appreciated!

Link to comment
Share on other sites

You can absolutely trigger animations when changing the DOM. 

 

I don't have a lot of time to dig into your code at the moment and I read through it a few times with little success in understanding exactly what you're trying to do, but I'll offer a few comments/questions...

  1. It looks like you're doing some very odd things in the JS, like creating functions inside of a loop, resetting the "old" variable unnecessarily, using empty functions for onComplete, setting immediateRender:false on to() tweens which is unnecessary (it's the default), assigning values to variables that weren't declared anywhere, re-wrapping jQuery objects unnecessarily, etc. It's making it difficult to wrap my head around what you're doing, and I suspect that some of the techniques are getting in the way of things working.
  2. Is there any particular reason you're nesting things in timelines within timelines? I'm struggling to see how it's beneficial in this case, and if you don't understand how the playhead works in timelines, it can get you in trouble in situations like this. I'd strongly recommend getting a solid grasp of the timeline concepts before pressing them into service. 
  3. Can you create a reduced test case (maybe with only 2 cards, and only the absolutely essential pieces of logic in there to reproduce the issue? I think you'd have a much better chance at getting an answer if you do that. 
  • 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...