code: function selectionAnimationFinished(element, details) {
  
    // When the last animation completes, show the next item in the direction
    // we're going. Waiting to that until this point is a bit of a hack to avoid
    // having a next item that's higher in the natural z-order obscure other items
    // during animation.
    const nextUpIndex = details.nextUpIndex;
    if (nextUpIndex != null) {
      if (element[animationSymbol][nextUpIndex]) {
        // Cancel existing selection animation so we can construct a new one.
        element[animationSymbol][nextUpIndex].cancel();
        element[animationSymbol][nextUpIndex] = null;
      }
      const animationFraction = details.forward ? 0 : 1;
      setAnimationFraction(element, nextUpIndex, animationFraction);
      showItem(element.items[nextUpIndex], true);
    }
  
    element[lastAnimationSymbol].onfinish = null;
    element[playingAnimationSymbol] = false;
  }
docs: /*
  The last animation in our selection animation has completed. Clean up.