aboutsummaryrefslogtreecommitdiffstats
path: root/ui/effect-pulsate.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/effect-pulsate.js')
-rw-r--r--ui/effect-pulsate.js51
1 files changed, 18 insertions, 33 deletions
diff --git a/ui/effect-pulsate.js b/ui/effect-pulsate.js
index 0e82761a3..c28da9ff8 100644
--- a/ui/effect-pulsate.js
+++ b/ui/effect-pulsate.js
@@ -28,51 +28,36 @@
}
}(function( $ ) {
-return $.effects.effect.pulsate = function( o, done ) {
- var elem = $( this ),
- mode = $.effects.setMode( elem, o.mode || "show" ),
+return $.effects.define( "pulsate", "show", function( options, done ) {
+ var element = $( this ),
+ mode = options.mode,
show = mode === "show",
hide = mode === "hide",
- showhide = ( show || mode === "hide" ),
+ showhide = show || hide,
- // showing or hiding leaves of the "last" animation
- anims = ( ( o.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),
- duration = o.duration / anims,
+ // Showing or hiding leaves off the "last" animation
+ anims = ( ( options.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),
+ duration = options.duration / anims,
animateTo = 0,
- queue = elem.queue(),
- queuelen = queue.length,
- i;
+ i = 1,
+ queuelen = element.queue().length;
- if ( show || !elem.is(":visible")) {
- elem.css( "opacity", 0 ).show();
+ if ( show || !element.is( ":visible" ) ) {
+ element.css( "opacity", 0 ).show();
animateTo = 1;
}
- // anims - 1 opacity "toggles"
- for ( i = 1; i < anims; i++ ) {
- elem.animate({
- opacity: animateTo
- }, duration, o.easing );
+ // Anims - 1 opacity "toggles"
+ for ( ; i < anims; i++ ) {
+ element.animate( { opacity: animateTo }, duration, options.easing );
animateTo = 1 - animateTo;
}
- elem.animate({
- opacity: animateTo
- }, duration, o.easing);
+ element.animate( { opacity: animateTo }, duration, options.easing );
- elem.queue(function() {
- if ( hide ) {
- elem.hide();
- }
- done();
- });
+ element.queue( done );
- // We just queued up "anims" animations, we need to put them next in the queue
- if ( queuelen > 1 ) {
- queue.splice.apply( queue,
- [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
- }
- elem.dequeue();
-};
+ $.effects.unshift( element, queuelen, anims + 1 );
+});
}));