Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid now and tween.now values on animate step callback #80

Open
danielocdh opened this issue Aug 20, 2015 · 2 comments
Open

invalid now and tween.now values on animate step callback #80

danielocdh opened this issue Aug 20, 2015 · 2 comments

Comments

@danielocdh
Copy link

I was a bit surprised I couldn't find the issue anywhere, sample here:
https://jsfiddle.net/apcso9gw/

@ryanneufeld
Copy link
Member

Seems legit.

@gnarf
Copy link
Member

gnarf commented Jan 14, 2016

step is called before the property set hook is called.

https://github.com/jquery/jquery/blob/dbc4608ed10bd1347649e6f1514f459957cda003/src/effects/Tween.js#L37-L43

Try using progress instead which is called after, and guarnteed to be once per element per frame instead of once per property per element per frame, though since

jQuery.fx.step[ hook ] = function( fx ) {
if ( !fx.colorInit ) {
fx.start = color( fx.elem, hook );
fx.end = color( fx.end );
fx.colorInit = true;
}
jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
};
doesn't update the tween.now it will still be this invalid thing.

We could update the tween.now or possibly use a custom tween in newer versions of jQuery - this hasn't been updated since jQuery 1.8 put in the new tween hooks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants