MCPcopy Create free account
hub / github.com/angular-ui/ui-router / prepareFromToAnchorAnimation

Function prepareFromToAnchorAnimation

test/angular/1.4/angular-animate.js:1715–1766  ·  view source on GitHub ↗
(from, to, classes, anchors)

Source from the content-addressed store, hash-verified

1713 }
1714
1715 function prepareFromToAnchorAnimation(from, to, classes, anchors) {
1716 var fromAnimation = prepareRegularAnimation(from, noop);
1717 var toAnimation = prepareRegularAnimation(to, noop);
1718
1719 var anchorAnimations = [];
1720 forEach(anchors, function(anchor) {
1721 var outElement = anchor['out'];
1722 var inElement = anchor['in'];
1723 var animator = prepareAnchoredAnimation(classes, outElement, inElement);
1724 if (animator) {
1725 anchorAnimations.push(animator);
1726 }
1727 });
1728
1729 // no point in doing anything when there are no elements to animate
1730 if (!fromAnimation && !toAnimation && anchorAnimations.length === 0) return;
1731
1732 return {
1733 start: function() {
1734 var animationRunners = [];
1735
1736 if (fromAnimation) {
1737 animationRunners.push(fromAnimation.start());
1738 }
1739
1740 if (toAnimation) {
1741 animationRunners.push(toAnimation.start());
1742 }
1743
1744 forEach(anchorAnimations, function(animation) {
1745 animationRunners.push(animation.start());
1746 });
1747
1748 var runner = new $$AnimateRunner({
1749 end: endFn,
1750 cancel: endFn // CSS-driven animations cannot be cancelled, only ended
1751 });
1752
1753 $$AnimateRunner.all(animationRunners, function(status) {
1754 runner.complete(status);
1755 });
1756
1757 return runner;
1758
1759 function endFn() {
1760 forEach(animationRunners, function(runner) {
1761 runner.end();
1762 });
1763 }
1764 }
1765 };
1766 }
1767
1768 function prepareRegularAnimation(animationDetails) {
1769 var element = animationDetails.element;

Callers 1

angular-animate.jsFile · 0.70

Calls 3

prepareRegularAnimationFunction · 0.70
forEachFunction · 0.70
prepareAnchoredAnimationFunction · 0.70

Tested by

no test coverage detected