MCPcopy Index your code
hub / github.com/angular-ui/ui-router / prepareAnchoredAnimation

Function prepareAnchoredAnimation

test/angular/1.6/angular-animate.js:1577–1702  ·  view source on GitHub ↗
(classes, outAnchor, inAnchor)

Source from the content-addressed store, hash-verified

1575 }
1576
1577 function prepareAnchoredAnimation(classes, outAnchor, inAnchor) {
1578 var clone = jqLite(getDomNode(outAnchor).cloneNode(true));
1579 var startingClasses = filterCssClasses(getClassVal(clone));
1580
1581 outAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME);
1582 inAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME);
1583
1584 clone.addClass(NG_ANIMATE_ANCHOR_CLASS_NAME);
1585
1586 rootBodyElement.append(clone);
1587
1588 var animatorIn, animatorOut = prepareOutAnimation();
1589
1590 // the user may not end up using the `out` animation and
1591 // only making use of the `in` animation or vice-versa.
1592 // In either case we should allow this and not assume the
1593 // animation is over unless both animations are not used.
1594 if (!animatorOut) {
1595 animatorIn = prepareInAnimation();
1596 if (!animatorIn) {
1597 return end();
1598 }
1599 }
1600
1601 var startingAnimator = animatorOut || animatorIn;
1602
1603 return {
1604 start: function() {
1605 var runner;
1606
1607 var currentAnimation = startingAnimator.start();
1608 currentAnimation.done(function() {
1609 currentAnimation = null;
1610 if (!animatorIn) {
1611 animatorIn = prepareInAnimation();
1612 if (animatorIn) {
1613 currentAnimation = animatorIn.start();
1614 currentAnimation.done(function() {
1615 currentAnimation = null;
1616 end();
1617 runner.complete();
1618 });
1619 return currentAnimation;
1620 }
1621 }
1622 // in the event that there is no `in` animation
1623 end();
1624 runner.complete();
1625 });
1626
1627 runner = new $$AnimateRunner({
1628 end: endFn,
1629 cancel: endFn
1630 });
1631
1632 return runner;
1633
1634 function endFn() {

Callers 1

Calls 6

getDomNodeFunction · 0.70
filterCssClassesFunction · 0.70
getClassValFunction · 0.70
prepareOutAnimationFunction · 0.70
prepareInAnimationFunction · 0.70
endFunction · 0.70

Tested by

no test coverage detected