Jump to content
GreenSock

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

Incomplete docs for TweenLite.render()

Recommended Posts

Hi,

 

I was going through Blake's

See the Pen ZOgGXB by osublake (@osublake) on CodePen

where he uses render method  as follows

 

animation.render(animation.time(), false, true);

 

In TweenLite docs there is no information about arguments and render method is missing from TweenMax docs. Can you please update the docs?

 

NOTE: animation is TweenMax instance

Link to post
Share on other sites

Sorry about any confusion there, @Sahil, but we purposely didn't document the render() method because:

  1. There are VERY few cases where it'd be useful to the average developer.
  2. It could cause confusion because unlike progress()/time()/totalTime(), it doesn't alter the tween's startTime which means that on the very next "tick", it'll revert. For example, if a tween is at a time of 1, and then you render(2), it will immediately render as if it's at 2 seconds, but on the very next tick, it'll be at like 1.064 (or whatever, slightly later than 1). Some people may find that unintuitive even though it's the correct behavior. 
  3. It is primarily intended for internal use.

Was there something in particular you're trying to accomplish with render()? I bet we can provide a solution that uses a different method. 

 

  • Like 3
Link to post
Share on other sites

Well I was reworking Blake's pen into something responsive and just wanted to know what does render method do, and what each parameter is for.

Link to post
Share on other sites

Got it. Okay, the method signature is like:

 

render( time:Number, suppressEvents:Boolean, force:Boolean )

  • time: time in seconds
  • suppressEvents: if true, none of the callbacks will be fired (like onComplete, onUpdate, etc.)
  • force: by default if you try to render() an animation at the same time twice, it'll skip the 2nd one. In other words, if the last render was at 2 seconds, and you ask it to render at 2 seconds again it'll be like "dude, I'm already rendered at that spot right now - I ain't gonna do all that work to re-render stuff again." but if something maybe changed the values outside of GSAP, you could force the render anyway by setting this value to true. 

Does that help? 

  • Like 1
Link to post
Share on other sites

You know, I honestly don't remember why I did it like that. Probably to avoid killing the animation. Understanding code that I wrote makes no sense to me after a couple of weeks. :wacko:

 

I made that demo in response to a question on the forum, and it was kind of rushed, so I wasn't thinking about making it responsive. I can make a responsive version of it later.

  • Like 1
Link to post
Share on other sites

Thanks Blake, I decided to use your other pen and have posted another question. It is responsive and draggable, I just need some help with wrapping calculation and wrapping while dragging.

 

EDIT: I was able to make it responsive but couldn't convert it into autoplay as you have used single Tween so I wasn't sure if tweens can be tweened partially so decided to use other pen.

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.

×