()
| 1323 | } |
| 1324 | |
| 1325 | function start() { |
| 1326 | if (animationClosed) return; |
| 1327 | if (!node.parentNode) { |
| 1328 | close(); |
| 1329 | return; |
| 1330 | } |
| 1331 | |
| 1332 | // even though we only pause keyframe animations here the pause flag |
| 1333 | // will still happen when transitions are used. Only the transition will |
| 1334 | // not be paused since that is not possible. If the animation ends when |
| 1335 | // paused then it will not complete until unpaused or cancelled. |
| 1336 | var playPause = function(playAnimation) { |
| 1337 | if (!animationCompleted) { |
| 1338 | animationPaused = !playAnimation; |
| 1339 | if (timings.animationDuration) { |
| 1340 | var value = blockKeyframeAnimations(node, animationPaused); |
| 1341 | if (animationPaused) { |
| 1342 | temporaryStyles.push(value); |
| 1343 | } else { |
| 1344 | removeFromArray(temporaryStyles, value); |
| 1345 | } |
| 1346 | } |
| 1347 | } else if (animationPaused && playAnimation) { |
| 1348 | animationPaused = false; |
| 1349 | close(); |
| 1350 | } |
| 1351 | }; |
| 1352 | |
| 1353 | // checking the stagger duration prevents an accidentally cascade of the CSS delay style |
| 1354 | // being inherited from the parent. If the transition duration is zero then we can safely |
| 1355 | // rely that the delay value is an intentional stagger delay style. |
| 1356 | var maxStagger = itemIndex > 0 |
| 1357 | && ((timings.transitionDuration && stagger.transitionDuration === 0) || |
| 1358 | (timings.animationDuration && stagger.animationDuration === 0)) |
| 1359 | && Math.max(stagger.animationDelay, stagger.transitionDelay); |
| 1360 | if (maxStagger) { |
| 1361 | $timeout(triggerAnimationStart, |
| 1362 | Math.floor(maxStagger * itemIndex * ONE_SECOND), |
| 1363 | false); |
| 1364 | } else { |
| 1365 | triggerAnimationStart(); |
| 1366 | } |
| 1367 | |
| 1368 | // this will decorate the existing promise runner with pause/resume methods |
| 1369 | runnerHost.resume = function() { |
| 1370 | playPause(true); |
| 1371 | }; |
| 1372 | |
| 1373 | runnerHost.pause = function() { |
| 1374 | playPause(false); |
| 1375 | }; |
| 1376 | |
| 1377 | function triggerAnimationStart() { |
| 1378 | // just incase a stagger animation kicks in when the animation |
| 1379 | // itself was cancelled entirely |
| 1380 | if (animationClosed) return; |
| 1381 | |
| 1382 | applyBlocking(false); |
nothing calls this directly
no test coverage detected