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