Jump to content


Regex bug in KineticPlugin

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

I'm using the KineticPlugin and DirectionalRotationPlugin with a Timeline, and I noticed that the first timeline rotation works, but the subsequent one did not. Debugging the KineticPlugin.js source, I noticed that 


would evaluate to true on the first timeline 'to' action, and then false on the second one, even for the exact same value. This is what was causing the second action to fail to rotate.


I'm not Regex expert, but it appears to be due to the the global flag on the regex. See: http://stackoverflow.com/questions/1520800/why-regexp-with-global-flag-in-javascript-give-wrong-results


When I remove the 'g' from the regex definition, or recreate the regex inside the plugin definition, the test passes as expected, and everything works as expected.


Have I indeed found a 'bug', or is there something I'm doing wrong to cause this to happen?  My code looks something like this:

var tl = new TimelineMax();

tl.to(obj, 2, {
  kinetic: { rotationDeg: 270 + '_cw' },

tl.to(obj, 2, {
  kinetic: { rotationDeg: 290 + '_cw' },



Link to comment
Share on other sites

Great catch - we'll get that patched in the next push. 

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.