Jump to content
Search Community

Goliath

Members
  • Posts

    3
  • Joined

  • Last visited

Goliath's Achievements

  1. Thanks for the feedback. I would respond to that insertion suggestion by saying that it is the responsibility of the programmer on what will happen if they insert a new tween before or after an existing one. If it messes negatively with other intersecting/nested tweens inside the timeline, well, the programmer should have known better and not do the insert in the first place. In my case, I do not have any intersecting/nested tweens. They are all added 1 after another and only 1 is animated at any given time inside a single timeline. To put it into a simple example, I have lets say 5 DOM (A, B, C, D, E) elements and I'm basically tweening from 1 DOM element to the next in the order they were added. Suddenly I have a new DOM element (F) that I want to add right after element 2 for example. My timeline would then look like A, B, F, C, D E and the timeline will play in that order from that point on. GSAP would take care of doing all the children shifts needed so that the new tween F does not overlap the target tween (ie: the one we specified in the insertBefore() or insertAfter() function call) in the timeline. Those functions can accept optional parameters that can control whether the insertion should shift any tween child forward to make room for the new tween. Be default, it would not make room in order to keep the same logic as your current GSAP positional add(). Of course, I could write my own 2 insert functions that will do all those calculations, but I think this should be a built-in functionality of GSAP. You already have the time position option in the add() function. We just need a way to specify the tween index to add before or after, like maybe <[3] or >[3], would respectively to an insert before and after the 4th tween in the timeline. I hope my current project will make it big soon and GSAP has played a big role in making it become reality. Stay tuned...
  2. Thank you. I guess I have to use the shiftChildren(). I was hoping there would be something like insertBefore() or insertAfter() functions that can take the current playhead, a tween or even an array position (since I assume the tweens are stored into an array internally...?) as a parameter that would do the automatic checks and calculations to insert the new tween. Seems like that would be a common operation.
  3. I have a timeline that has many tweens added to it. I would like to be able to insert a new tween in between 2 tweens without overlapping any of them. How would I do that? also, similar to that question, how would I prepend new tweens in a timeline instead of adding them at the end of it? Do I need to create a label like "Beginning" and shift all children by the duration of the new tween then insert it after that label? Thank you.
×
×
  • Create New...