(classes, outAnchor, inAnchor)
| 1335 | } |
| 1336 | |
| 1337 | function prepareAnchoredAnimation(classes, outAnchor, inAnchor) { |
| 1338 | var clone = jqLite(getDomNode(outAnchor).cloneNode(true)); |
| 1339 | var startingClasses = filterCssClasses(getClassVal(clone)); |
| 1340 | |
| 1341 | outAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME); |
| 1342 | inAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME); |
| 1343 | |
| 1344 | clone.addClass(NG_ANIMATE_ANCHOR_CLASS_NAME); |
| 1345 | |
| 1346 | rootBodyElement.append(clone); |
| 1347 | |
| 1348 | var animatorIn, animatorOut = prepareOutAnimation(); |
| 1349 | |
| 1350 | // the user may not end up using the `out` animation and |
| 1351 | // only making use of the `in` animation or vice-versa. |
| 1352 | // In either case we should allow this and not assume the |
| 1353 | // animation is over unless both animations are not used. |
| 1354 | if (!animatorOut) { |
| 1355 | animatorIn = prepareInAnimation(); |
| 1356 | if (!animatorIn) { |
| 1357 | return end(); |
| 1358 | } |
| 1359 | } |
| 1360 | |
| 1361 | var startingAnimator = animatorOut || animatorIn; |
| 1362 | |
| 1363 | return { |
| 1364 | start: function() { |
| 1365 | var runner; |
| 1366 | |
| 1367 | var currentAnimation = startingAnimator.start(); |
| 1368 | currentAnimation.done(function() { |
| 1369 | currentAnimation = null; |
| 1370 | if (!animatorIn) { |
| 1371 | animatorIn = prepareInAnimation(); |
| 1372 | if (animatorIn) { |
| 1373 | currentAnimation = animatorIn.start(); |
| 1374 | currentAnimation.done(function() { |
| 1375 | currentAnimation = null; |
| 1376 | end(); |
| 1377 | runner.complete(); |
| 1378 | }); |
| 1379 | return currentAnimation; |
| 1380 | } |
| 1381 | } |
| 1382 | // in the event that there is no `in` animation |
| 1383 | end(); |
| 1384 | runner.complete(); |
| 1385 | }); |
| 1386 | |
| 1387 | runner = new $$AnimateRunner({ |
| 1388 | end: endFn, |
| 1389 | cancel: endFn |
| 1390 | }); |
| 1391 | |
| 1392 | return runner; |
| 1393 | |
| 1394 | function endFn() { |
no test coverage detected