Jump to content
Search Community

TweenMax [renderTime][delay]

DivisionBoy test
Moderator Tag

Recommended Posts

What exactly are you trying to accomplish? renderTime() isn't a documented method. If you want to start your tween after a certain amount of time, why not just alter the delay? Either of these could work:

TweenLite.delayedCall(2, function() {
    yourTween.restart();
});

//or 

yourTween.delay(2).restart(true);
Link to comment
Share on other sites

I recorded a short video to make it easier to understand what I mean. 

http://www.youtube.com/watch?v=lD9ZjlTwgjg

I'm writing a simple video editor. For any object on the track, you can add motion effects, which I implemented using TweenMax. 
 
The problem is that when I move the slider on the timeline I need to show the effect of either forward or backward, depends on which way to move the slider. 
 
For this I use the method renderTime() and all is well, but the animation effect is not correct, because renderTime () do not support the "delay" property. 
 
In the video is clearly seen as part of the picture move synchronously, while should take into account the interval (delay) before each of the parts of the picture.
 
 

private	function prepareTween():void {
	var tweenM:TweenMax = TweenMax.to(arrSlice[j], currentSpeed, {alpha:alphaTween, x:arrSliceX[j], y:arrSliceY[j], rotation: rotateTween, scaleX: scaleXTween, scaleY: scaleYTween, delay:(currentDelay * d) / 10, ease:arrTweens[currentTween], blurFilter:{blurX:blurXTween, blurY:blurYTween, qality:2, remove:true}, onComplete:endEffect, onReverseComplete:endEffectReverse} );

	arrTweens.push(tweenM);
	j++
			
}
//when I move the slider on the timeline
public function moveSlider(time:Number):void {
	for (var i:int = 0; i < arrTweens.length; i++ ) {
				
		arrTweens[i].renderTime(time);
				
	}			
}
Link to comment
Share on other sites

Oh, goodness, are you familiar with TimelineLite or TimelineMax? These would be PERFECT for this scenario. They'd save you a ton of effort (if I understand your goals correctly). You can drop your tweens into a timeline (or actually, just use the convenience methods like staggerTo()) and it'll position things on the timeline so that you can then call timeline.time(yourTime) whenever you want, or timeline.progress() for a percentage or whatever. It's amazingly flexible. You can play forward or backward and it does all of the work for you. 

 

To answer your question, the delay impacts the tween's startTime, so you can measure the offset from there if you like, but again, TimelineLite/Max would resolve all of this for you. I suppose you could do renderTime(time + tween.delay);

 

Lastly, it looks like you're using a very old version of TweenMax. I would highly recommend upgrading as there are lots of new features, enhancements, and even speed improvements. http://www.greensock.com/v12/

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...