I am sure I must be missing something, but I'm stumped.
I have a TimelineMax instance, composed of Timelines and Tweens. One of the Tweens in this Timeline pads the end of the Timeline with 'dead time', which is implemented by this initialization code:
//laserSequence is a TimelineMax instance which has already had multiple inserts of various sorts
//scale is the full time we want the whole animation to play
//laserSequence.duration is the amount of time occupied by 'meaningful' animation (stuff is happening on the screen)
var deadTime:Number = scale - laserSequence.duration;
var waiting:TweenMax = TweenMax.to(null, deadTime, {});
laserSequence.append(waiting);
I'm forming a 'bigger' animation by putting each individual laserSequence in another TimelineMax, but I don't believe that to be relevant for this problem.
This code works to create the initial Timeline correctly, that is, deadTime is appended to the laserSequence's animation length. However, if I attempt to update the duration of this 'null tween', caused by a scrubber on the front end that lets the user change the duration of an animation sequence, the laserSequence.duration value changes, but it still plays the original duration.
In my situation, deadTime is initially set to 15 seconds, and when I move the scrubber to the other end (which should change deadTime to 30 seconds), a display counter on the screen shows the animation counting down from 30 to 15, at which point it moves on to the next sequence. I would expect it would continue to play for another 15 seconds.
This is the code I'm using to attempt the duration change (I have tried several different alternatives, such as TimelineMax.remove(tween), TimelineMax.append(tween), but the same behavior occurs):
//each of these top level timelines is appended with a 'deadtime' tween
//get it, and replace it with one to match the new scale
var nullTween:TweenMax = timeline.getChildren(false, true, false).pop();
//this calculation determines the new required length of dead time
var deadTime:Number = toolbarInstance.animationScale - (timeline.duration - nullTween.duration);
//update the tween that pads the end of the animation
nullTween.duration = deadTime;
The impression I get is that there's some kind of caching or something that needs to be refreshed, and while changing the duration value actually changes the value, it doesn't seem to be considering that when playing the animation.