( elem, properties, options )
| 8060 | } |
| 8061 | |
| 8062 | function Animation( elem, properties, options ) { |
| 8063 | var result, |
| 8064 | stopped, |
| 8065 | index = 0, |
| 8066 | length = animationPrefilters.length, |
| 8067 | deferred = jQuery.Deferred().always( function() { |
| 8068 | // don't match elem in the :animated selector |
| 8069 | delete tick.elem; |
| 8070 | }), |
| 8071 | tick = function() { |
| 8072 | if ( stopped ) { |
| 8073 | return false; |
| 8074 | } |
| 8075 | var currentTime = fxNow || createFxNow(), |
| 8076 | remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), |
| 8077 | // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497) |
| 8078 | temp = remaining / animation.duration || 0, |
| 8079 | percent = 1 - temp, |
| 8080 | index = 0, |
| 8081 | length = animation.tweens.length; |
| 8082 | |
| 8083 | for ( ; index < length ; index++ ) { |
| 8084 | animation.tweens[ index ].run( percent ); |
| 8085 | } |
| 8086 | |
| 8087 | deferred.notifyWith( elem, [ animation, percent, remaining ]); |
| 8088 | |
| 8089 | if ( percent < 1 && length ) { |
| 8090 | return remaining; |
| 8091 | } else { |
| 8092 | deferred.resolveWith( elem, [ animation ] ); |
| 8093 | return false; |
| 8094 | } |
| 8095 | }, |
| 8096 | animation = deferred.promise({ |
| 8097 | elem: elem, |
| 8098 | props: jQuery.extend( {}, properties ), |
| 8099 | opts: jQuery.extend( true, { specialEasing: {} }, options ), |
| 8100 | originalProperties: properties, |
| 8101 | originalOptions: options, |
| 8102 | startTime: fxNow || createFxNow(), |
| 8103 | duration: options.duration, |
| 8104 | tweens: [], |
| 8105 | createTween: function( prop, end ) { |
| 8106 | var tween = jQuery.Tween( elem, animation.opts, prop, end, |
| 8107 | animation.opts.specialEasing[ prop ] || animation.opts.easing ); |
| 8108 | animation.tweens.push( tween ); |
| 8109 | return tween; |
| 8110 | }, |
| 8111 | stop: function( gotoEnd ) { |
| 8112 | var index = 0, |
| 8113 | // if we are going to the end, we want to run all the tweens |
| 8114 | // otherwise we skip this part |
| 8115 | length = gotoEnd ? animation.tweens.length : 0; |
| 8116 | if ( stopped ) { |
| 8117 | return this; |
| 8118 | } |
| 8119 | stopped = true; |
no test coverage detected