( elem, properties, options )
| 8890 | } |
| 8891 | |
| 8892 | function Animation( elem, properties, options ) { |
| 8893 | var result, |
| 8894 | stopped, |
| 8895 | index = 0, |
| 8896 | length = animationPrefilters.length, |
| 8897 | deferred = jQuery.Deferred().always( function() { |
| 8898 | // don't match elem in the :animated selector |
| 8899 | delete tick.elem; |
| 8900 | }), |
| 8901 | tick = function() { |
| 8902 | if ( stopped ) { |
| 8903 | return false; |
| 8904 | } |
| 8905 | var currentTime = fxNow || createFxNow(), |
| 8906 | remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), |
| 8907 | // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497) |
| 8908 | temp = remaining / animation.duration || 0, |
| 8909 | percent = 1 - temp, |
| 8910 | index = 0, |
| 8911 | length = animation.tweens.length; |
| 8912 | |
| 8913 | for ( ; index < length ; index++ ) { |
| 8914 | animation.tweens[ index ].run( percent ); |
| 8915 | } |
| 8916 | |
| 8917 | deferred.notifyWith( elem, [ animation, percent, remaining ]); |
| 8918 | |
| 8919 | if ( percent < 1 && length ) { |
| 8920 | return remaining; |
| 8921 | } else { |
| 8922 | deferred.resolveWith( elem, [ animation ] ); |
| 8923 | return false; |
| 8924 | } |
| 8925 | }, |
| 8926 | animation = deferred.promise({ |
| 8927 | elem: elem, |
| 8928 | props: jQuery.extend( {}, properties ), |
| 8929 | opts: jQuery.extend( true, { specialEasing: {} }, options ), |
| 8930 | originalProperties: properties, |
| 8931 | originalOptions: options, |
| 8932 | startTime: fxNow || createFxNow(), |
| 8933 | duration: options.duration, |
| 8934 | tweens: [], |
| 8935 | createTween: function( prop, end ) { |
| 8936 | var tween = jQuery.Tween( elem, animation.opts, prop, end, |
| 8937 | animation.opts.specialEasing[ prop ] || animation.opts.easing ); |
| 8938 | animation.tweens.push( tween ); |
| 8939 | return tween; |
| 8940 | }, |
| 8941 | stop: function( gotoEnd ) { |
| 8942 | var index = 0, |
| 8943 | // if we are going to the end, we want to run all the tweens |
| 8944 | // otherwise we skip this part |
| 8945 | length = gotoEnd ? animation.tweens.length : 0; |
| 8946 | if ( stopped ) { |
| 8947 | return this; |
| 8948 | } |
| 8949 | stopped = true; |
no test coverage detected