@@ 7734-7848 (lines=115) @@ | ||
7731 | } |
|
7732 | } |
|
7733 | ||
7734 | function Animation( elem, properties, options ) { |
|
7735 | var result, |
|
7736 | stopped, |
|
7737 | index = 0, |
|
7738 | length = Animation.prefilters.length, |
|
7739 | deferred = jQuery.Deferred().always( function() { |
|
7740 | ||
7741 | // don't match elem in the :animated selector |
|
7742 | delete tick.elem; |
|
7743 | } ), |
|
7744 | tick = function() { |
|
7745 | if ( stopped ) { |
|
7746 | return false; |
|
7747 | } |
|
7748 | var currentTime = fxNow || createFxNow(), |
|
7749 | remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), |
|
7750 | ||
7751 | // Support: Android 2.3 |
|
7752 | // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) |
|
7753 | temp = remaining / animation.duration || 0, |
|
7754 | percent = 1 - temp, |
|
7755 | index = 0, |
|
7756 | length = animation.tweens.length; |
|
7757 | ||
7758 | for ( ; index < length ; index++ ) { |
|
7759 | animation.tweens[ index ].run( percent ); |
|
7760 | } |
|
7761 | ||
7762 | deferred.notifyWith( elem, [ animation, percent, remaining ] ); |
|
7763 | ||
7764 | if ( percent < 1 && length ) { |
|
7765 | return remaining; |
|
7766 | } else { |
|
7767 | deferred.resolveWith( elem, [ animation ] ); |
|
7768 | return false; |
|
7769 | } |
|
7770 | }, |
|
7771 | animation = deferred.promise( { |
|
7772 | elem: elem, |
|
7773 | props: jQuery.extend( {}, properties ), |
|
7774 | opts: jQuery.extend( true, { |
|
7775 | specialEasing: {}, |
|
7776 | easing: jQuery.easing._default |
|
7777 | }, options ), |
|
7778 | originalProperties: properties, |
|
7779 | originalOptions: options, |
|
7780 | startTime: fxNow || createFxNow(), |
|
7781 | duration: options.duration, |
|
7782 | tweens: [], |
|
7783 | createTween: function( prop, end ) { |
|
7784 | var tween = jQuery.Tween( elem, animation.opts, prop, end, |
|
7785 | animation.opts.specialEasing[ prop ] || animation.opts.easing ); |
|
7786 | animation.tweens.push( tween ); |
|
7787 | return tween; |
|
7788 | }, |
|
7789 | stop: function( gotoEnd ) { |
|
7790 | var index = 0, |
|
7791 | ||
7792 | // if we are going to the end, we want to run all the tweens |
|
7793 | // otherwise we skip this part |
|
7794 | length = gotoEnd ? animation.tweens.length : 0; |
|
7795 | if ( stopped ) { |
|
7796 | return this; |
|
7797 | } |
|
7798 | stopped = true; |
|
7799 | for ( ; index < length ; index++ ) { |
|
7800 | animation.tweens[ index ].run( 1 ); |
|
7801 | } |
|
7802 | ||
7803 | // resolve when we played the last frame |
|
7804 | // otherwise, reject |
|
7805 | if ( gotoEnd ) { |
|
7806 | deferred.notifyWith( elem, [ animation, 1, 0 ] ); |
|
7807 | deferred.resolveWith( elem, [ animation, gotoEnd ] ); |
|
7808 | } else { |
|
7809 | deferred.rejectWith( elem, [ animation, gotoEnd ] ); |
|
7810 | } |
|
7811 | return this; |
|
7812 | } |
|
7813 | } ), |
|
7814 | props = animation.props; |
|
7815 | ||
7816 | propFilter( props, animation.opts.specialEasing ); |
|
7817 | ||
7818 | for ( ; index < length ; index++ ) { |
|
7819 | result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); |
|
7820 | if ( result ) { |
|
7821 | if ( jQuery.isFunction( result.stop ) ) { |
|
7822 | jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = |
|
7823 | jQuery.proxy( result.stop, result ); |
|
7824 | } |
|
7825 | return result; |
|
7826 | } |
|
7827 | } |
|
7828 | ||
7829 | jQuery.map( props, createTween, animation ); |
|
7830 | ||
7831 | if ( jQuery.isFunction( animation.opts.start ) ) { |
|
7832 | animation.opts.start.call( elem, animation ); |
|
7833 | } |
|
7834 | ||
7835 | jQuery.fx.timer( |
|
7836 | jQuery.extend( tick, { |
|
7837 | elem: elem, |
|
7838 | anim: animation, |
|
7839 | queue: animation.opts.queue |
|
7840 | } ) |
|
7841 | ); |
|
7842 | ||
7843 | // attach callbacks from options |
|
7844 | return animation.progress( animation.opts.progress ) |
|
7845 | .done( animation.opts.done, animation.opts.complete ) |
|
7846 | .fail( animation.opts.fail ) |
|
7847 | .always( animation.opts.always ); |
|
7848 | } |
|
7849 | ||
7850 | jQuery.Animation = jQuery.extend( Animation, { |
|
7851 |
@@ 6687-6800 (lines=114) @@ | ||
6684 | } |
|
6685 | } |
|
6686 | ||
6687 | function Animation( elem, properties, options ) { |
|
6688 | var result, |
|
6689 | stopped, |
|
6690 | index = 0, |
|
6691 | length = Animation.prefilters.length, |
|
6692 | deferred = jQuery.Deferred().always( function() { |
|
6693 | ||
6694 | // Don't match elem in the :animated selector |
|
6695 | delete tick.elem; |
|
6696 | } ), |
|
6697 | tick = function() { |
|
6698 | if ( stopped ) { |
|
6699 | return false; |
|
6700 | } |
|
6701 | var currentTime = fxNow || createFxNow(), |
|
6702 | remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), |
|
6703 | ||
6704 | // Support: Android 2.3 |
|
6705 | // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) |
|
6706 | temp = remaining / animation.duration || 0, |
|
6707 | percent = 1 - temp, |
|
6708 | index = 0, |
|
6709 | length = animation.tweens.length; |
|
6710 | ||
6711 | for ( ; index < length ; index++ ) { |
|
6712 | animation.tweens[ index ].run( percent ); |
|
6713 | } |
|
6714 | ||
6715 | deferred.notifyWith( elem, [ animation, percent, remaining ] ); |
|
6716 | ||
6717 | if ( percent < 1 && length ) { |
|
6718 | return remaining; |
|
6719 | } else { |
|
6720 | deferred.resolveWith( elem, [ animation ] ); |
|
6721 | return false; |
|
6722 | } |
|
6723 | }, |
|
6724 | animation = deferred.promise( { |
|
6725 | elem: elem, |
|
6726 | props: jQuery.extend( {}, properties ), |
|
6727 | opts: jQuery.extend( true, { |
|
6728 | specialEasing: {}, |
|
6729 | easing: jQuery.easing._default |
|
6730 | }, options ), |
|
6731 | originalProperties: properties, |
|
6732 | originalOptions: options, |
|
6733 | startTime: fxNow || createFxNow(), |
|
6734 | duration: options.duration, |
|
6735 | tweens: [], |
|
6736 | createTween: function( prop, end ) { |
|
6737 | var tween = jQuery.Tween( elem, animation.opts, prop, end, |
|
6738 | animation.opts.specialEasing[ prop ] || animation.opts.easing ); |
|
6739 | animation.tweens.push( tween ); |
|
6740 | return tween; |
|
6741 | }, |
|
6742 | stop: function( gotoEnd ) { |
|
6743 | var index = 0, |
|
6744 | ||
6745 | // If we are going to the end, we want to run all the tweens |
|
6746 | // otherwise we skip this part |
|
6747 | length = gotoEnd ? animation.tweens.length : 0; |
|
6748 | if ( stopped ) { |
|
6749 | return this; |
|
6750 | } |
|
6751 | stopped = true; |
|
6752 | for ( ; index < length ; index++ ) { |
|
6753 | animation.tweens[ index ].run( 1 ); |
|
6754 | } |
|
6755 | ||
6756 | // Resolve when we played the last frame; otherwise, reject |
|
6757 | if ( gotoEnd ) { |
|
6758 | deferred.notifyWith( elem, [ animation, 1, 0 ] ); |
|
6759 | deferred.resolveWith( elem, [ animation, gotoEnd ] ); |
|
6760 | } else { |
|
6761 | deferred.rejectWith( elem, [ animation, gotoEnd ] ); |
|
6762 | } |
|
6763 | return this; |
|
6764 | } |
|
6765 | } ), |
|
6766 | props = animation.props; |
|
6767 | ||
6768 | propFilter( props, animation.opts.specialEasing ); |
|
6769 | ||
6770 | for ( ; index < length ; index++ ) { |
|
6771 | result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); |
|
6772 | if ( result ) { |
|
6773 | if ( jQuery.isFunction( result.stop ) ) { |
|
6774 | jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = |
|
6775 | jQuery.proxy( result.stop, result ); |
|
6776 | } |
|
6777 | return result; |
|
6778 | } |
|
6779 | } |
|
6780 | ||
6781 | jQuery.map( props, createTween, animation ); |
|
6782 | ||
6783 | if ( jQuery.isFunction( animation.opts.start ) ) { |
|
6784 | animation.opts.start.call( elem, animation ); |
|
6785 | } |
|
6786 | ||
6787 | jQuery.fx.timer( |
|
6788 | jQuery.extend( tick, { |
|
6789 | elem: elem, |
|
6790 | anim: animation, |
|
6791 | queue: animation.opts.queue |
|
6792 | } ) |
|
6793 | ); |
|
6794 | ||
6795 | // attach callbacks from options |
|
6796 | return animation.progress( animation.opts.progress ) |
|
6797 | .done( animation.opts.done, animation.opts.complete ) |
|
6798 | .fail( animation.opts.fail ) |
|
6799 | .always( animation.opts.always ); |
|
6800 | } |
|
6801 | ||
6802 | jQuery.Animation = jQuery.extend( Animation, { |
|
6803 | tweeners: { |