|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
( function( factory ) { |
|
"use strict"; |
|
|
|
if ( typeof define === "function" && define.amd ) { |
|
|
|
|
|
define( [ |
|
"jquery", |
|
"../version", |
|
"../effect" |
|
], factory ); |
|
} else { |
|
|
|
|
|
factory( jQuery ); |
|
} |
|
} )( function( $ ) { |
|
"use strict"; |
|
|
|
return $.effects.define( "pulsate", "show", function( options, done ) { |
|
var element = $( this ), |
|
mode = options.mode, |
|
show = mode === "show", |
|
hide = mode === "hide", |
|
showhide = show || hide, |
|
|
|
|
|
anims = ( ( options.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ), |
|
duration = options.duration / anims, |
|
animateTo = 0, |
|
i = 1, |
|
queuelen = element.queue().length; |
|
|
|
if ( show || !element.is( ":visible" ) ) { |
|
element.css( "opacity", 0 ).show(); |
|
animateTo = 1; |
|
} |
|
|
|
|
|
for ( ; i < anims; i++ ) { |
|
element.animate( { opacity: animateTo }, duration, options.easing ); |
|
animateTo = 1 - animateTo; |
|
} |
|
|
|
element.animate( { opacity: animateTo }, duration, options.easing ); |
|
|
|
element.queue( done ); |
|
|
|
$.effects.unshift( element, queuelen, anims + 1 ); |
|
} ); |
|
|
|
} ); |
|
|