MCPcopy Create free account
hub / github.com/tree-sitter/tree-sitter-javascript / Animation

Function Animation

examples/jquery.js:6506–6608  ·  view source on GitHub ↗
( elem, properties, options )

Source from the content-addressed store, hash-verified

6504}
6505
6506function Animation( elem, properties, options ) {
6507 var result,
6508 stopped,
6509 index = 0,
6510 length = animationPrefilters.length,
6511 deferred = jQuery.Deferred().always( function() {
6512 // don't match elem in the :animated selector
6513 delete tick.elem;
6514 }),
6515 tick = function() {
6516 if ( stopped ) {
6517 return false;
6518 }
6519 var currentTime = fxNow || createFxNow(),
6520 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
6521 // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
6522 temp = remaining / animation.duration || 0,
6523 percent = 1 - temp,
6524 index = 0,
6525 length = animation.tweens.length;
6526
6527 for ( ; index < length ; index++ ) {
6528 animation.tweens[ index ].run( percent );
6529 }
6530
6531 deferred.notifyWith( elem, [ animation, percent, remaining ]);
6532
6533 if ( percent < 1 && length ) {
6534 return remaining;
6535 } else {
6536 deferred.resolveWith( elem, [ animation ] );
6537 return false;
6538 }
6539 },
6540 animation = deferred.promise({
6541 elem: elem,
6542 props: jQuery.extend( {}, properties ),
6543 opts: jQuery.extend( true, { specialEasing: {} }, options ),
6544 originalProperties: properties,
6545 originalOptions: options,
6546 startTime: fxNow || createFxNow(),
6547 duration: options.duration,
6548 tweens: [],
6549 createTween: function( prop, end ) {
6550 var tween = jQuery.Tween( elem, animation.opts, prop, end,
6551 animation.opts.specialEasing[ prop ] || animation.opts.easing );
6552 animation.tweens.push( tween );
6553 return tween;
6554 },
6555 stop: function( gotoEnd ) {
6556 var index = 0,
6557 // if we are going to the end, we want to run all the tweens
6558 // otherwise we skip this part
6559 length = gotoEnd ? animation.tweens.length : 0;
6560 if ( stopped ) {
6561 return this;
6562 }
6563 stopped = true;

Callers 1

doAnimationFunction · 0.85

Calls 3

createFxNowFunction · 0.85
propFilterFunction · 0.85
runMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…