allanbreyes
Content Type
Profiles
Forums
Store
Blog
Product
Showcase
FAQ
Downloads
Posts posted by allanbreyes
-
-
Ah, I didn't search hard enough... looks like there is some prior art on this:
QuoteFor performance reasons, every tween in a timeline has its starting and ending values recorded internally after the first time they render.
QuoteIf you allow the user to monkey with the end value of tween1 by dragging the red thing to end at an x value of 400 in the GUI then tween2 is not going to automatically update its start value to be 400 the next time the animation plays. You would have to manage that tween as well or invalidate() the timeline. See the dilemma?I think you may ultimately find the easiest route to manage is what you already tried: destroy and create the main timeline every time you need to run an animation showing a recent change. Keep in mind that tween creation is relatively cheap. You can create 1000 tweens in just a few milliseconds.
Similar question:
-
Ah I see! I was changing each individual tween's time scales. For my particular application, each of these tweens have different durations, so unfortunately, I can't scale the whole thing...
See the Pen XExMgN by allanbreyes (@allanbreyes) on CodePen
-
I was just trying that! It appears to suffer from the same effect (start times do not change, and the parent timeline does not expand/contract). I was hopeful for TweenMax.updateTo, but it appears that can only update `vars` and not duration... Thanks for the suggestion, though!
-
Thanks @Shaun Gorneau! Pending a better solution, I'll give this a shot. I'd rather not clear the timeline since there's a mix of other tweens... maybe I can try swapping it out afterwards.
-
Problem
I'm noticing some very strange behavior when I'm updating a timeline's children tween durations. This is problematic for instances where I need to set the duration of the tween after initialization. e.g. an audio clip needs to download before knowing what the desired duration is.
Observations
The codepen demonstrates this. I construct 10 tweens at 0.2 duration each to a timeline (2s total). When I update each of the tweens' durations to 0.4, several unexpected things are observed:
1. Parent timeline only goes to 2.2
2. The tweens become "choppy" with overlap.
It appears that only the last tween expands the timeline, but an interval of 0.2 is still placed between each tween. How can I correct this after updating the duration?
Thanks!
See the Pen mxzVrj by allanbreyes (@allanbreyes) on CodePen
How can I update a parent timeline when child tweens/timelines durations are updated?
in GSAP
Posted
Thanks @GreenSock!!!