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

Function prepareFromToAnchorAnimation

test/angular/1.6/angular-animate.js:1704–1755  ·  view source on GitHub ↗
(from, to, classes, anchors)

Source from the content-addressed store, hash-verified

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