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

throttle animation ticks #334

Closed
wants to merge 5 commits into from

Conversation

Projects
None yet
3 participants
@louisremi
Copy link
Contributor

commented Apr 18, 2011

9384
Throttles ticks to provide interval behavior for RAF.

@@ -415,7 +415,7 @@ jQuery.fx.prototype = {
};
requestAnimationFrame( raf );
} else {
timerId = setInterval( fx.tick, fx.interval );
timerId = setInterval( fx.tick, 16.6 );

This comment has been minimized.

Copy link
@jboesch

jboesch Apr 21, 2011

Contributor

magic number? :)

This comment has been minimized.

Copy link
@louisremi

louisremi Apr 21, 2011

Author Contributor

60fps is 16.6666666666666666666666666666666666666666666666666666666ms
But I should definitely use an integer here.

while ( i-- ) {
if ( !timers[i]() ) {
timers.splice(i, 1);
if ( this.throttle == 1 || ++ticks >= this.throttle && !( ticks = 0 ) ) {

This comment has been minimized.

Copy link
@timmywil

timmywil Jun 7, 2011

Member

Need a === in the throttle check and ticks always resets to 0 here.

This comment has been minimized.

Copy link
@louisremi

louisremi Jun 8, 2011

Author Contributor

ticks should only reset to 0 when the previous test is true, isn't it?

This comment has been minimized.

Copy link
@timmywil

timmywil Jun 8, 2011

Member

Yea, I wasn't sure that's what you wanted though. ticks never seems to get higher than 1, but maybe that's ok.

This comment has been minimized.

Copy link
@louisremi

louisremi Jun 8, 2011

Author Contributor

It will, if developers choose to throttle the animation mechanism
jQuery.fx.throttle = 2 // animation will run at a maximum of 30fps

This comment has been minimized.

Copy link
@timmywil

timmywil Jun 8, 2011

Member

You're right, forgive my confusion. Need to sleep more. ;)

This comment has been minimized.

Copy link
@timmywil

timmywil Jun 8, 2011

Member

Still, let's work out some test cases for this.

This comment has been minimized.

Copy link
@louisremi

louisremi Jun 15, 2011

Author Contributor

I'll do it asap.

@timmywil

This comment has been minimized.

Copy link
Member

commented Jun 7, 2011

needs test cases

@louisremi

This comment has been minimized.

Copy link
Contributor Author

commented Jul 21, 2011

Alright, here are your tests!

@timmywil

This comment has been minimized.

Copy link
Member

commented Jul 21, 2011

thanks dawg!

@timmywil

This comment has been minimized.

Copy link
Member

commented Sep 19, 2011

Thanks for your work @louisremi! Please keep this issue in mind for when raf is eventually reintegrated.

@timmywil timmywil closed this Sep 19, 2011

@lock lock bot locked as resolved and limited conversation to collaborators Jan 21, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.