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