( elem, properties, options )
| 3910 | } |
| 3911 | |
| 3912 | function Animation( elem, properties, options ) { |
| 3913 | var result, |
| 3914 | stopped, |
| 3915 | index = 0, |
| 3916 | length = animationPrefilters.length, |
| 3917 | deferred = jQuery.Deferred().always( function() { |
| 3918 | // don't match elem in the :animated selector |
| 3919 | delete tick.elem; |
| 3920 | }), |
| 3921 | tick = function() { |
| 3922 | if ( stopped ) { |
| 3923 | return false; |
| 3924 | } |
| 3925 | var currentTime = fxNow || createFxNow(), |
| 3926 | remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), |
| 3927 | // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497) |
| 3928 | temp = remaining / animation.duration || 0, |
| 3929 | percent = 1 - temp, |
| 3930 | index = 0, |
| 3931 | length = animation.tweens.length; |
| 3932 | |
| 3933 | for ( ; index < length ; index++ ) { |
| 3934 | animation.tweens[ index ].run( percent ); |
| 3935 | } |
| 3936 | |
| 3937 | deferred.notifyWith( elem, [ animation, percent, remaining ]); |
| 3938 | |
| 3939 | if ( percent < 1 && length ) { |
| 3940 | return remaining; |
| 3941 | } else { |
| 3942 | deferred.resolveWith( elem, [ animation ] ); |
| 3943 | return false; |
| 3944 | } |
| 3945 | }, |
| 3946 | animation = deferred.promise({ |
| 3947 | elem: elem, |
| 3948 | props: jQuery.extend( {}, properties ), |
| 3949 | opts: jQuery.extend( true, { specialEasing: {} }, options ), |
| 3950 | originalProperties: properties, |
| 3951 | originalOptions: options, |
| 3952 | startTime: fxNow || createFxNow(), |
| 3953 | duration: options.duration, |
| 3954 | tweens: [], |
| 3955 | createTween: function( prop, end ) { |
| 3956 | var tween = jQuery.Tween( elem, animation.opts, prop, end, |
| 3957 | animation.opts.specialEasing[ prop ] || animation.opts.easing ); |
| 3958 | animation.tweens.push( tween ); |
| 3959 | return tween; |
| 3960 | }, |
| 3961 | stop: function( gotoEnd ) { |
| 3962 | var index = 0, |
| 3963 | // if we are going to the end, we want to run all the tweens |
| 3964 | // otherwise we skip this part |
| 3965 | length = gotoEnd ? animation.tweens.length : 0; |
| 3966 | if ( stopped ) { |
| 3967 | return this; |
| 3968 | } |
| 3969 | stopped = true; |
no test coverage detected