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