Commit 791402b4 authored by timmywil's avatar timmywil

Separate raf function definition from passing it to requestAnimationFrame

parent 9db18ddd
...@@ -350,7 +350,8 @@ jQuery.fx.prototype = { ...@@ -350,7 +350,8 @@ jQuery.fx.prototype = {
// Start an animation from one number to another // Start an animation from one number to another
custom: function( from, to, unit ) { custom: function( from, to, unit ) {
var self = this, var self = this,
fx = jQuery.fx; fx = jQuery.fx,
raf;
this.startTime = jQuery.now(); this.startTime = jQuery.now();
this.start = from; this.start = from;
...@@ -369,13 +370,14 @@ jQuery.fx.prototype = { ...@@ -369,13 +370,14 @@ jQuery.fx.prototype = {
// Use requestAnimationFrame instead of setInterval if available // Use requestAnimationFrame instead of setInterval if available
if ( requestAnimationFrame ) { if ( requestAnimationFrame ) {
timerId = 1; timerId = 1;
requestAnimationFrame(function raf() { raf = function() {
// When timerId gets set to null at any point, this stops // When timerId gets set to null at any point, this stops
if ( timerId ) { if ( timerId ) {
requestAnimationFrame( raf ); requestAnimationFrame( raf );
fx.tick(); fx.tick();
} }
}); };
requestAnimationFrame( raf );
} else { } else {
timerId = setInterval( fx.tick, fx.interval ); timerId = setInterval( fx.tick, fx.interval );
} }
......
Subproject commit f12b9309269ba7e705a99efe099f86ed1fe98d58 Subproject commit 80f2b81d1fbc13d62afb91cb87e1452fbbec1ef4
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment