MCPcopy Create free account
hub / github.com/sql-js/sql.js / Animation

Function Animation

documentation/javascript/application.js:9374–9468  ·  view source on GitHub ↗
( elem, properties, options )

Source from the content-addressed store, hash-verified

9372}
9373
9374function Animation( elem, properties, options ) {
9375 var result,
9376 index = 0,
9377 tweenerIndex = 0,
9378 length = animationPrefilters.length,
9379 deferred = jQuery.Deferred().always( function() {
9380 // don't match elem in the :animated selector
9381 delete tick.elem;
9382 }),
9383 tick = function() {
9384 var currentTime = fxNow || createFxNow(),
9385 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
9386 percent = 1 - ( remaining / animation.duration || 0 ),
9387 index = 0,
9388 length = animation.tweens.length;
9389
9390 for ( ; index < length ; index++ ) {
9391 animation.tweens[ index ].run( percent );
9392 }
9393
9394 deferred.notifyWith( elem, [ animation, percent, remaining ]);
9395
9396 if ( percent < 1 && length ) {
9397 return remaining;
9398 } else {
9399 deferred.resolveWith( elem, [ animation ] );
9400 return false;
9401 }
9402 },
9403 animation = deferred.promise({
9404 elem: elem,
9405 props: jQuery.extend( {}, properties ),
9406 opts: jQuery.extend( true, { specialEasing: {} }, options ),
9407 originalProperties: properties,
9408 originalOptions: options,
9409 startTime: fxNow || createFxNow(),
9410 duration: options.duration,
9411 tweens: [],
9412 createTween: function( prop, end, easing ) {
9413 var tween = jQuery.Tween( elem, animation.opts, prop, end,
9414 animation.opts.specialEasing[ prop ] || animation.opts.easing );
9415 animation.tweens.push( tween );
9416 return tween;
9417 },
9418 stop: function( gotoEnd ) {
9419 var index = 0,
9420 // if we are going to the end, we want to run all the tweens
9421 // otherwise we skip this part
9422 length = gotoEnd ? animation.tweens.length : 0;
9423
9424 for ( ; index < length ; index++ ) {
9425 animation.tweens[ index ].run( 1 );
9426 }
9427
9428 // resolve when we played the last frame
9429 // otherwise, reject
9430 if ( gotoEnd ) {
9431 deferred.resolveWith( elem, [ animation, gotoEnd ] );

Callers 1

doAnimationFunction · 0.85

Calls 3

createFxNowFunction · 0.85
propFilterFunction · 0.85
createTweensFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…