MCPcopy Create free account
hub / github.com/PrairieLearn/PrairieLearn / Animation

Function Animation

public/localscripts/calculationQuestion/jquery.js:7939–8041  ·  view source on GitHub ↗
( elem, properties, options )

Source from the content-addressed store, hash-verified

7937}
7938
7939function Animation( elem, properties, options ) {
7940 var result,
7941 stopped,
7942 index = 0,
7943 length = animationPrefilters.length,
7944 deferred = jQuery.Deferred().always( function() {
7945 // don't match elem in the :animated selector
7946 delete tick.elem;
7947 }),
7948 tick = function() {
7949 if ( stopped ) {
7950 return false;
7951 }
7952 var currentTime = fxNow || createFxNow(),
7953 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
7954 // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
7955 temp = remaining / animation.duration || 0,
7956 percent = 1 - temp,
7957 index = 0,
7958 length = animation.tweens.length;
7959
7960 for ( ; index < length ; index++ ) {
7961 animation.tweens[ index ].run( percent );
7962 }
7963
7964 deferred.notifyWith( elem, [ animation, percent, remaining ]);
7965
7966 if ( percent < 1 && length ) {
7967 return remaining;
7968 } else {
7969 deferred.resolveWith( elem, [ animation ] );
7970 return false;
7971 }
7972 },
7973 animation = deferred.promise({
7974 elem: elem,
7975 props: jQuery.extend( {}, properties ),
7976 opts: jQuery.extend( true, { specialEasing: {} }, options ),
7977 originalProperties: properties,
7978 originalOptions: options,
7979 startTime: fxNow || createFxNow(),
7980 duration: options.duration,
7981 tweens: [],
7982 createTween: function( prop, end ) {
7983 var tween = jQuery.Tween( elem, animation.opts, prop, end,
7984 animation.opts.specialEasing[ prop ] || animation.opts.easing );
7985 animation.tweens.push( tween );
7986 return tween;
7987 },
7988 stop: function( gotoEnd ) {
7989 var index = 0,
7990 // if we are going to the end, we want to run all the tweens
7991 // otherwise we skip this part
7992 length = gotoEnd ? animation.tweens.length : 0;
7993 if ( stopped ) {
7994 return this;
7995 }
7996 stopped = true;

Callers 1

doAnimationFunction · 0.85

Calls 5

createFxNowFunction · 0.85
propFilterFunction · 0.85
runMethod · 0.80
callMethod · 0.80
doneMethod · 0.80

Tested by

no test coverage detected