Jump to content
Search Community

Incomplete docs for TweenLite.render()

Sahil test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

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