Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
chrisgannon

onRepeat firing when immediateRender is true

Recommended Posts

Hey Jack,

 

Here's a snippet of my code. It's a set of 3D rotating pages whose rotationX property should be reset to 0 onRepeat. FYI this code is actually in a for..loop - it creates 6 tweens and pushes them into a TimelineMax instance.

 

 var tm = TweenMax.fromTo(temp_symbol_JS,10, {immediateRender:true,rotationX:rotationIncrement*i},
	  {rotationX:(rotationIncrement*i)+360,
	  ease:Linear.easeNone,
	  onStart:initWebKit,
	  onStartParams:["{self}", i],
	  onUpdate:positionPage,
	  onUpdateParams:["{self}"],
	  repeat:-1,
	  onRepeat:resetRotation,
	  onRepeatParams:["{self}"]});
timeline.insert(tm);

//later

function resetRotation (tween){
console.log("I repeated");
}

 

I need 'immediateRender:true' in order to set the initial rotationX of each page. However I am finding that the onRepeat function is fired 6 times immediately.

 

Is this expected behaviour or have I totally missed something?

 

Cheers,

 

Chris

Link to post
Share on other sites

Hmmm...I couldn't reproduce that issue - could you post a simple HTML file that demonstrates the behavior?

 

A few comments:

  1. All the special properties (like immediateRender, ease, onComplete, etc.) belong in the "toVars" parameter, but you had set immediateRender in the "fromVars" parameter.
  2. I wonder if maybe time elapsed between when you created your TimelineMax instance and when you inserted your tweens. Remember, by default insert() puts things at a time of 0 (meaning the beginning of the timeline) and timelines (like tweens) begin running immediately when you create them. So let's say you created your TimelineMax and then 5 seconds later you inserted a 1-second tween at a time of 0. Well, since the timeline started 5 seconds ago, the virtual playhead would be at the 5-second spot so if your tween was inserted at 0, that means it would render as though it is now finished. See what I mean? You can, of course, make the timeline jump to any spot anytime with seek() or time() or totalTime(). Or use restart() to start from the beginning. Lots of options. Or you can insert() your tween at the timeline's time() (which would be its current time). There are LOTS of ways to handle this, so let me know what you need and I can help. Once I see your code, I'm sure it'll make more sense.

Link to post
Share on other sites

Sorry Jack I totally missed your response on this. I'll dig out that project again and see if I can create a demo of it (not working). Once again apologies - I must have missed the little Notifications bell!

Link to post
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.

×