MCPcopy
hub / github.com/jquery/jquery / Animation

Function Animation

test/data/jquery-3.7.1.js:7422–7545  ·  view source on GitHub ↗
( elem, properties, options )

Source from the content-addressed store, hash-verified

7420}
7421
7422function Animation( elem, properties, options ) {
7423 var result,
7424 stopped,
7425 index = 0,
7426 length = Animation.prefilters.length,
7427 deferred = jQuery.Deferred().always( function() {
7428
7429 // Don't match elem in the :animated selector
7430 delete tick.elem;
7431 } ),
7432 tick = function() {
7433 if ( stopped ) {
7434 return false;
7435 }
7436 var currentTime = fxNow || createFxNow(),
7437 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
7438
7439 // Support: Android 2.3 only
7440 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (trac-12497)
7441 temp = remaining / animation.duration || 0,
7442 percent = 1 - temp,
7443 index = 0,
7444 length = animation.tweens.length;
7445
7446 for ( ; index < length; index++ ) {
7447 animation.tweens[ index ].run( percent );
7448 }
7449
7450 deferred.notifyWith( elem, [ animation, percent, remaining ] );
7451
7452 // If there's more to do, yield
7453 if ( percent < 1 && length ) {
7454 return remaining;
7455 }
7456
7457 // If this was an empty animation, synthesize a final progress notification
7458 if ( !length ) {
7459 deferred.notifyWith( elem, [ animation, 1, 0 ] );
7460 }
7461
7462 // Resolve the animation and report its conclusion
7463 deferred.resolveWith( elem, [ animation ] );
7464 return false;
7465 },
7466 animation = deferred.promise( {
7467 elem: elem,
7468 props: jQuery.extend( {}, properties ),
7469 opts: jQuery.extend( true, {
7470 specialEasing: {},
7471 easing: jQuery.easing._default
7472 }, options ),
7473 originalProperties: properties,
7474 originalOptions: options,
7475 startTime: fxNow || createFxNow(),
7476 duration: options.duration,
7477 tweens: [],
7478 createTween: function( prop, end ) {
7479 var tween = jQuery.Tween( elem, animation.opts, prop, end,

Callers 1

doAnimationFunction · 0.70

Calls 3

isFunctionFunction · 0.85
createFxNowFunction · 0.70
propFilterFunction · 0.70

Tested by

no test coverage detected