MCPcopy Index your code
hub / github.com/angular-ui/ui-router / animateRun

Function animateRun

test/angular/1.3/angular-animate.js:1829–1982  ·  view source on GitHub ↗
(animationEvent, element, className, activeAnimationComplete, styles)

Source from the content-addressed store, hash-verified

1827 }
1828
1829 function animateRun(animationEvent, element, className, activeAnimationComplete, styles) {
1830 var node = extractElementNode(element);
1831 var elementData = element.data(NG_ANIMATE_CSS_DATA_KEY);
1832 if (node.getAttribute('class').indexOf(className) == -1 || !elementData) {
1833 activeAnimationComplete();
1834 return;
1835 }
1836
1837 var activeClassName = '';
1838 var pendingClassName = '';
1839 forEach(className.split(' '), function(klass, i) {
1840 var prefix = (i > 0 ? ' ' : '') + klass;
1841 activeClassName += prefix + '-active';
1842 pendingClassName += prefix + '-pending';
1843 });
1844
1845 var style = '';
1846 var appliedStyles = [];
1847 var itemIndex = elementData.itemIndex;
1848 var stagger = elementData.stagger;
1849 var staggerTime = 0;
1850 if (itemIndex > 0) {
1851 var transitionStaggerDelay = 0;
1852 if (stagger.transitionDelay > 0 && stagger.transitionDuration === 0) {
1853 transitionStaggerDelay = stagger.transitionDelay * itemIndex;
1854 }
1855
1856 var animationStaggerDelay = 0;
1857 if (stagger.animationDelay > 0 && stagger.animationDuration === 0) {
1858 animationStaggerDelay = stagger.animationDelay * itemIndex;
1859 appliedStyles.push(CSS_PREFIX + 'animation-play-state');
1860 }
1861
1862 staggerTime = Math.round(Math.max(transitionStaggerDelay, animationStaggerDelay) * 100) / 100;
1863 }
1864
1865 if (!staggerTime) {
1866 $$jqLite.addClass(element, activeClassName);
1867 if (elementData.blockTransition) {
1868 blockTransitions(node, false);
1869 }
1870 }
1871
1872 var eventCacheKey = elementData.cacheKey + ' ' + activeClassName;
1873 var timings = getElementAnimationDetails(element, eventCacheKey);
1874 var maxDuration = Math.max(timings.transitionDuration, timings.animationDuration);
1875 if (maxDuration === 0) {
1876 $$jqLite.removeClass(element, activeClassName);
1877 animateClose(element, className);
1878 activeAnimationComplete();
1879 return;
1880 }
1881
1882 if (!staggerTime && styles && Object.keys(styles).length > 0) {
1883 if (!timings.transitionDuration) {
1884 element.css('transition', timings.animationDuration + 's linear all');
1885 appliedStyles.push('transition');
1886 }

Callers 1

animateAfterFunction · 0.70

Calls 8

blockAnimationsFunction · 0.85
extractElementNodeFunction · 0.70
forEachFunction · 0.70
blockTransitionsFunction · 0.70
animateCloseFunction · 0.70
onEndFunction · 0.70
animationCloseHandlerFunction · 0.70

Tested by

no test coverage detected