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

Function start

test/angular/1.6/angular-animate.js:1347–1521  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1345 }
1346
1347 function start() {
1348 if (animationClosed) return;
1349 if (!node.parentNode) {
1350 close();
1351 return;
1352 }
1353
1354 // even though we only pause keyframe animations here the pause flag
1355 // will still happen when transitions are used. Only the transition will
1356 // not be paused since that is not possible. If the animation ends when
1357 // paused then it will not complete until unpaused or cancelled.
1358 var playPause = function(playAnimation) {
1359 if (!animationCompleted) {
1360 animationPaused = !playAnimation;
1361 if (timings.animationDuration) {
1362 var value = blockKeyframeAnimations(node, animationPaused);
1363 if (animationPaused) {
1364 temporaryStyles.push(value);
1365 } else {
1366 removeFromArray(temporaryStyles, value);
1367 }
1368 }
1369 } else if (animationPaused && playAnimation) {
1370 animationPaused = false;
1371 close();
1372 }
1373 };
1374
1375 // checking the stagger duration prevents an accidentally cascade of the CSS delay style
1376 // being inherited from the parent. If the transition duration is zero then we can safely
1377 // rely that the delay value is an intentional stagger delay style.
1378 var maxStagger = itemIndex > 0
1379 && ((timings.transitionDuration && stagger.transitionDuration === 0) ||
1380 (timings.animationDuration && stagger.animationDuration === 0))
1381 && Math.max(stagger.animationDelay, stagger.transitionDelay);
1382 if (maxStagger) {
1383 $timeout(triggerAnimationStart,
1384 Math.floor(maxStagger * itemIndex * ONE_SECOND),
1385 false);
1386 } else {
1387 triggerAnimationStart();
1388 }
1389
1390 // this will decorate the existing promise runner with pause/resume methods
1391 runnerHost.resume = function() {
1392 playPause(true);
1393 };
1394
1395 runnerHost.pause = function() {
1396 playPause(false);
1397 };
1398
1399 function triggerAnimationStart() {
1400 // just incase a stagger animation kicks in when the animation
1401 // itself was cancelled entirely
1402 if (animationClosed) return;
1403
1404 applyBlocking(false);

Callers

nothing calls this directly

Calls 3

closeFunction · 0.70
triggerAnimationStartFunction · 0.70
playPauseFunction · 0.70

Tested by

no test coverage detected