git.asbjorn.biz
/
jquery.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
83b43a1
)
Animations now use a single interval timer, global for all animations. This severely...
author
John Resig
<jeresig@gmail.com>
Sat, 17 Mar 2007 02:02:01 +0000
(
02:02
+0000)
committer
John Resig
<jeresig@gmail.com>
Sat, 17 Mar 2007 02:02:01 +0000
(
02:02
+0000)
src/fx/fx.js
patch
|
blob
|
history
diff --git
a/src/fx/fx.js
b/src/fx/fx.js
index
163f0f6
..
933c9bf
100644
(file)
--- a/
src/fx/fx.js
+++ b/
src/fx/fx.js
@@
-400,6
+400,8
@@
jQuery.extend({
}
},
}
},
+ timers: [],
+
/*
* I originally wrote fx() as a clone of moo.fx and in the process
* of making it small in size the code became illegible to sane
/*
* I originally wrote fx() as a clone of moo.fx and in the process
* of making it small in size the code became illegible to sane
@@
-452,9
+454,20
@@
jQuery.extend({
z.now = from;
z.a();
z.now = from;
z.a();
- z.timer = setInterval(function(){
- z.step(from, to);
- }, 13);
+ jQuery.timers.push(function(){
+ return z.step(from, to);
+ });
+
+ if ( jQuery.timers.length == 1 ) {
+ var timer = setInterval(function(){
+ jQuery.timers = jQuery.grep( jQuery.timers, function(fn){
+ return fn();
+ });
+
+ if ( !jQuery.timers.length )
+ clearInterval( timer );
+ }, 13);
+ }
};
// Simple 'show' function
};
// Simple 'show' function
@@
-516,10
+529,6
@@
jQuery.extend({
var t = (new Date()).getTime();
if (t > options.duration + z.startTime) {
var t = (new Date()).getTime();
if (t > options.duration + z.startTime) {
- // Stop the timer
- clearInterval(z.timer);
- z.timer = null;
-
z.now = lastNum;
z.a();
z.now = lastNum;
z.a();
@@
-555,6
+564,8
@@
jQuery.extend({
if ( done && jQuery.isFunction( options.complete ) )
// Execute the complete function
options.complete.apply( elem );
if ( done && jQuery.isFunction( options.complete ) )
// Execute the complete function
options.complete.apply( elem );
+
+ return false;
} else {
var n = t - this.startTime;
// Figure out where in the animation we are and set the number
} else {
var n = t - this.startTime;
// Figure out where in the animation we are and set the number
@@
-569,6
+580,8
@@
jQuery.extend({
// Perform the next step of the animation
z.a();
}
// Perform the next step of the animation
z.a();
}
+
+ return true;
};
}
};
}