Separate raf function definition from passing it to requestAnimationFrame
This commit is contained in:
parent
9db18ddd84
commit
791402b453
2 changed files with 6 additions and 4 deletions
8
src/effects.js
vendored
8
src/effects.js
vendored
|
@ -350,7 +350,8 @@ jQuery.fx.prototype = {
|
|||
// Start an animation from one number to another
|
||||
custom: function( from, to, unit ) {
|
||||
var self = this,
|
||||
fx = jQuery.fx;
|
||||
fx = jQuery.fx,
|
||||
raf;
|
||||
|
||||
this.startTime = jQuery.now();
|
||||
this.start = from;
|
||||
|
@ -369,13 +370,14 @@ jQuery.fx.prototype = {
|
|||
// Use requestAnimationFrame instead of setInterval if available
|
||||
if ( requestAnimationFrame ) {
|
||||
timerId = 1;
|
||||
requestAnimationFrame(function raf() {
|
||||
raf = function() {
|
||||
// When timerId gets set to null at any point, this stops
|
||||
if ( timerId ) {
|
||||
requestAnimationFrame( raf );
|
||||
fx.tick();
|
||||
}
|
||||
});
|
||||
};
|
||||
requestAnimationFrame( raf );
|
||||
} else {
|
||||
timerId = setInterval( fx.tick, fx.interval );
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit f12b9309269ba7e705a99efe099f86ed1fe98d58
|
||||
Subproject commit 80f2b81d1fbc13d62afb91cb87e1452fbbec1ef4
|
Loading…
Reference in a new issue