( elem, properties, options )
| 8704 | } |
| 8705 | |
| 8706 | function Animation( elem, properties, options ) { |
| 8707 | var result, |
| 8708 | stopped, |
| 8709 | index = 0, |
| 8710 | length = animationPrefilters.length, |
| 8711 | deferred = jQuery.Deferred().always( function() { |
| 8712 | // don't match elem in the :animated selector |
| 8713 | delete tick.elem; |
| 8714 | }), |
| 8715 | tick = function() { |
| 8716 | if ( stopped ) { |
| 8717 | return false; |
| 8718 | } |
| 8719 | var currentTime = fxNow || createFxNow(), |
| 8720 | remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), |
| 8721 | // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497) |
| 8722 | temp = remaining / animation.duration || 0, |
| 8723 | percent = 1 - temp, |
| 8724 | index = 0, |
| 8725 | length = animation.tweens.length; |
| 8726 | |
| 8727 | for ( ; index < length ; index++ ) { |
| 8728 | animation.tweens[ index ].run( percent ); |
| 8729 | } |
| 8730 | |
| 8731 | deferred.notifyWith( elem, [ animation, percent, remaining ]); |
| 8732 | |
| 8733 | if ( percent < 1 && length ) { |
| 8734 | return remaining; |
| 8735 | } else { |
| 8736 | deferred.resolveWith( elem, [ animation ] ); |
| 8737 | return false; |
| 8738 | } |
| 8739 | }, |
| 8740 | animation = deferred.promise({ |
| 8741 | elem: elem, |
| 8742 | props: jQuery.extend( {}, properties ), |
| 8743 | opts: jQuery.extend( true, { specialEasing: {} }, options ), |
| 8744 | originalProperties: properties, |
| 8745 | originalOptions: options, |
| 8746 | startTime: fxNow || createFxNow(), |
| 8747 | duration: options.duration, |
| 8748 | tweens: [], |
| 8749 | createTween: function( prop, end ) { |
| 8750 | var tween = jQuery.Tween( elem, animation.opts, prop, end, |
| 8751 | animation.opts.specialEasing[ prop ] || animation.opts.easing ); |
| 8752 | animation.tweens.push( tween ); |
| 8753 | return tween; |
| 8754 | }, |
| 8755 | stop: function( gotoEnd ) { |
| 8756 | var index = 0, |
| 8757 | // if we are going to the end, we want to run all the tweens |
| 8758 | // otherwise we skip this part |
| 8759 | length = gotoEnd ? animation.tweens.length : 0; |
| 8760 | if ( stopped ) { |
| 8761 | return this; |
| 8762 | } |
| 8763 | stopped = true; |
no test coverage detected