MCPcopy
hub / github.com/angular-ui/ui-router / start

Function start

test/angular/1.4/angular-animate.js:1358–1530  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

closeFunction · 0.70
triggerAnimationStartFunction · 0.70
playPauseFunction · 0.70

Tested by

no test coverage detected