()
| 1117 | } |
| 1118 | |
| 1119 | function start() { |
| 1120 | if (animationClosed) return; |
| 1121 | if (!node.parentNode) { |
| 1122 | close(); |
| 1123 | return; |
| 1124 | } |
| 1125 | |
| 1126 | var startTime, events = []; |
| 1127 | |
| 1128 | // even though we only pause keyframe animations here the pause flag |
| 1129 | // will still happen when transitions are used. Only the transition will |
| 1130 | // not be paused since that is not possible. If the animation ends when |
| 1131 | // paused then it will not complete until unpaused or cancelled. |
| 1132 | var playPause = function(playAnimation) { |
| 1133 | if (!animationCompleted) { |
| 1134 | animationPaused = !playAnimation; |
| 1135 | if (timings.animationDuration) { |
| 1136 | var value = blockKeyframeAnimations(node, animationPaused); |
| 1137 | animationPaused |
| 1138 | ? temporaryStyles.push(value) |
| 1139 | : removeFromArray(temporaryStyles, value); |
| 1140 | } |
| 1141 | } else if (animationPaused && playAnimation) { |
| 1142 | animationPaused = false; |
| 1143 | close(); |
| 1144 | } |
| 1145 | }; |
| 1146 | |
| 1147 | // checking the stagger duration prevents an accidently cascade of the CSS delay style |
| 1148 | // being inherited from the parent. If the transition duration is zero then we can safely |
| 1149 | // rely that the delay value is an intential stagger delay style. |
| 1150 | var maxStagger = itemIndex > 0 |
| 1151 | && ((timings.transitionDuration && stagger.transitionDuration === 0) || |
| 1152 | (timings.animationDuration && stagger.animationDuration === 0)) |
| 1153 | && Math.max(stagger.animationDelay, stagger.transitionDelay); |
| 1154 | if (maxStagger) { |
| 1155 | $timeout(triggerAnimationStart, |
| 1156 | Math.floor(maxStagger * itemIndex * ONE_SECOND), |
| 1157 | false); |
| 1158 | } else { |
| 1159 | triggerAnimationStart(); |
| 1160 | } |
| 1161 | |
| 1162 | // this will decorate the existing promise runner with pause/resume methods |
| 1163 | runnerHost.resume = function() { |
| 1164 | playPause(true); |
| 1165 | }; |
| 1166 | |
| 1167 | runnerHost.pause = function() { |
| 1168 | playPause(false); |
| 1169 | }; |
| 1170 | |
| 1171 | function triggerAnimationStart() { |
| 1172 | // just incase a stagger animation kicks in when the animation |
| 1173 | // itself was cancelled entirely |
| 1174 | if (animationClosed) return; |
| 1175 | |
| 1176 | applyBlocking(false); |
nothing calls this directly
no test coverage detected