( elem, properties, options )
| 7282 | } |
| 7283 | |
| 7284 | function Animation( elem, properties, options ) { |
| 7285 | var result, |
| 7286 | stopped, |
| 7287 | index = 0, |
| 7288 | length = animationPrefilters.length, |
| 7289 | deferred = jQuery.Deferred().always( function() { |
| 7290 | // don't match elem in the :animated selector |
| 7291 | delete tick.elem; |
| 7292 | }), |
| 7293 | tick = function() { |
| 7294 | if ( stopped ) { |
| 7295 | return false; |
| 7296 | } |
| 7297 | var currentTime = fxNow || createFxNow(), |
| 7298 | remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), |
| 7299 | // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497) |
| 7300 | temp = remaining / animation.duration || 0, |
| 7301 | percent = 1 - temp, |
| 7302 | index = 0, |
| 7303 | length = animation.tweens.length; |
| 7304 | |
| 7305 | for ( ; index < length ; index++ ) { |
| 7306 | animation.tweens[ index ].run( percent ); |
| 7307 | } |
| 7308 | |
| 7309 | deferred.notifyWith( elem, [ animation, percent, remaining ]); |
| 7310 | |
| 7311 | if ( percent < 1 && length ) { |
| 7312 | return remaining; |
| 7313 | } else { |
| 7314 | deferred.resolveWith( elem, [ animation ] ); |
| 7315 | return false; |
| 7316 | } |
| 7317 | }, |
| 7318 | animation = deferred.promise({ |
| 7319 | elem: elem, |
| 7320 | props: jQuery.extend( {}, properties ), |
| 7321 | opts: jQuery.extend( true, { specialEasing: {} }, options ), |
| 7322 | originalProperties: properties, |
| 7323 | originalOptions: options, |
| 7324 | startTime: fxNow || createFxNow(), |
| 7325 | duration: options.duration, |
| 7326 | tweens: [], |
| 7327 | createTween: function( prop, end ) { |
| 7328 | var tween = jQuery.Tween( elem, animation.opts, prop, end, |
| 7329 | animation.opts.specialEasing[ prop ] || animation.opts.easing ); |
| 7330 | animation.tweens.push( tween ); |
| 7331 | return tween; |
| 7332 | }, |
| 7333 | stop: function( gotoEnd ) { |
| 7334 | var index = 0, |
| 7335 | // if we are going to the end, we want to run all the tweens |
| 7336 | // otherwise we skip this part |
| 7337 | length = gotoEnd ? animation.tweens.length : 0; |
| 7338 | if ( stopped ) { |
| 7339 | return this; |
| 7340 | } |
| 7341 | stopped = true; |
no test coverage detected