Jump to content
Search Community

lazyTween makes tweened element stay 1 frame even if I called pause(0);

yanhkim 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 experts,

 

var tl = new TimelineMax({ useFrames: true });
var el = $('.tweened')[0];
tl.add(TweenLite.to(el, 10, { width: 300 }), 0);
 
tl.addCallback(function() {
  tl.pause(0);
}, 0);
 
expect: .tweened element rendered as frame 0
result: .tweened element rendered as frame 1
 
You can find working testcase in
 
----
 
As far as I inspected, TimelineLite.pause(0) triggers rendering lazyTween that is saved in frame 1. That makes .tweened element rendered as 1 frame. Even if timeline's time() returns 0.
 
I want to play timeline in advance, so I attached callback to make that remain in 0 frame.
 
 
Regards,
Namhoon
 

See the Pen vOrobO by yanhkim (@yanhkim) on CodePen

Link to comment
Share on other sites

Good catch - we did need to alter one thing in the codebase to accommodate that edge case. It'll be fixed in the next version (you can preview an uncompressed version of TweenMax at https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/TweenMax-latest-beta.js). In the mean time, you can simply add TweenLite.render(); below your code, or just set lazy:false on that tween - either solution is fine in the current version. 

  • Like 4
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...