(from, to, classes, anchors)
| 1696 | } |
| 1697 | |
| 1698 | function prepareFromToAnchorAnimation(from, to, classes, anchors) { |
| 1699 | var fromAnimation = prepareRegularAnimation(from, noop); |
| 1700 | var toAnimation = prepareRegularAnimation(to, noop); |
| 1701 | |
| 1702 | var anchorAnimations = []; |
| 1703 | forEach(anchors, function(anchor) { |
| 1704 | var outElement = anchor['out']; |
| 1705 | var inElement = anchor['in']; |
| 1706 | var animator = prepareAnchoredAnimation(classes, outElement, inElement); |
| 1707 | if (animator) { |
| 1708 | anchorAnimations.push(animator); |
| 1709 | } |
| 1710 | }); |
| 1711 | |
| 1712 | // no point in doing anything when there are no elements to animate |
| 1713 | if (!fromAnimation && !toAnimation && anchorAnimations.length === 0) return; |
| 1714 | |
| 1715 | return { |
| 1716 | start: function() { |
| 1717 | var animationRunners = []; |
| 1718 | |
| 1719 | if (fromAnimation) { |
| 1720 | animationRunners.push(fromAnimation.start()); |
| 1721 | } |
| 1722 | |
| 1723 | if (toAnimation) { |
| 1724 | animationRunners.push(toAnimation.start()); |
| 1725 | } |
| 1726 | |
| 1727 | forEach(anchorAnimations, function(animation) { |
| 1728 | animationRunners.push(animation.start()); |
| 1729 | }); |
| 1730 | |
| 1731 | var runner = new $$AnimateRunner({ |
| 1732 | end: endFn, |
| 1733 | cancel: endFn // CSS-driven animations cannot be cancelled, only ended |
| 1734 | }); |
| 1735 | |
| 1736 | $$AnimateRunner.all(animationRunners, function(status) { |
| 1737 | runner.complete(status); |
| 1738 | }); |
| 1739 | |
| 1740 | return runner; |
| 1741 | |
| 1742 | function endFn() { |
| 1743 | forEach(animationRunners, function(runner) { |
| 1744 | runner.end(); |
| 1745 | }); |
| 1746 | } |
| 1747 | } |
| 1748 | }; |
| 1749 | } |
| 1750 | |
| 1751 | function prepareRegularAnimation(animationDetails) { |
| 1752 | var element = animationDetails.element; |
no test coverage detected