Jump to content
GreenSock

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

Regex bug in KineticPlugin

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 

_directionalRotationExp.test(val)

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' },
});

tl.play();

thanks!  

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