Jump to content
Search Community

TweenMax.set and yoyo/repeat issue

Blueshell 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

Hey, I've recently begun trying out the Tween and Timeline libraries. Looks mostly nice, definitely a time saver.


I just came across an issue while using the TweenMax.set method with KineticPlugin. When I put a repeat, repeatDelay and yoyo on it, the object on the canvas does not change (immediately) in the repeatDelay intervals. Only the last repeat result is displayed. In contrast, a normal TweenMax.to works normally.


I made a fiddle here for demonstration: http://jsfiddle.net/blueshell/5rwYs/


Do tell if I'm thinking this wrong and there's an easier method to achieve the same purpose. I just want a shape to have its values updated instantly (seen on the canvas) between some intervals.

Link to comment
Share on other sites

Zero-duration tweens are VERY tricky architecturally because they're not really "tweens" (as that implies a beginning and an end and some inbetween states). For example, if the playhead lands directly on top of where a zero-duration tween sits on its parent timeline, what should be rendered? The beginning state or the end state? Of course we do some things internally to accommodate these in the most intuitive way we can (usually sensing direction of the parent timeline's playhead), but it's not as simple as it may seem. 


The simple solution to your dilemma is to just use a regular to() with a very small duration:

TweenMax.set(circle1, { kinetic: { x: 300, y: 300 }, immediateRender: false, repeat: 4, yoyo: true, repeatDelay: 1, paused: true });

TweenMax.to(circle1, 0.0001,{ kinetic: { x: 300, y: 300 }, repeat: 4, yoyo: true, repeatDelay: 1, paused: true });
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...