MCPcopy
hub / github.com/layui/layui / Animation

Function Animation

src/modules/jquery.js:7596–7733  ·  view source on GitHub ↗
(elem, properties, options)

Source from the content-addressed store, hash-verified

7594 }
7595
7596 function Animation(elem, properties, options) {
7597 var result,
7598 stopped,
7599 index = 0,
7600 length = Animation.prefilters.length,
7601 deferred = jQuery.Deferred().always(function () {
7602 // Don't match elem in the :animated selector
7603 delete tick.elem;
7604 }),
7605 tick = function () {
7606 if (stopped) {
7607 return false;
7608 }
7609 var currentTime = fxNow || createFxNow(),
7610 remaining = Math.max(
7611 0,
7612 animation.startTime + animation.duration - currentTime
7613 ),
7614 // Support: Android 2.3 only
7615 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (trac-12497)
7616 temp = remaining / animation.duration || 0,
7617 percent = 1 - temp,
7618 index = 0,
7619 length = animation.tweens.length;
7620
7621 for (; index < length; index++) {
7622 animation.tweens[index].run(percent);
7623 }
7624
7625 deferred.notifyWith(elem, [animation, percent, remaining]);
7626
7627 // If there's more to do, yield
7628 if (percent < 1 && length) {
7629 return remaining;
7630 }
7631
7632 // If this was an empty animation, synthesize a final progress notification
7633 if (!length) {
7634 deferred.notifyWith(elem, [animation, 1, 0]);
7635 }
7636
7637 // Resolve the animation and report its conclusion
7638 deferred.resolveWith(elem, [animation]);
7639 return false;
7640 },
7641 animation = deferred.promise({
7642 elem: elem,
7643 props: jQuery.extend({}, properties),
7644 opts: jQuery.extend(
7645 true,
7646 {
7647 specialEasing: {},
7648 easing: jQuery.easing._default
7649 },
7650 options
7651 ),
7652 originalProperties: properties,
7653 originalOptions: options,

Callers 1

doAnimationFunction · 0.85

Calls 3

createFxNowFunction · 0.85
propFilterFunction · 0.85
isFunctionFunction · 0.85

Tested by

no test coverage detected