private void animateView(UIView view, CGPoint targetPosition, Runnable completion) {
    CGSize size = view.getFrame().getSize();
    CGSize grow = new CGSize(size.getWidth() * 1.7, size.getHeight() * 1.7);
    CGSize shrink = new CGSize(size.getWidth() * .4, size.getHeight() * .4);

    CAKeyframeAnimation pathAnimation = new CAKeyframeAnimation("position");
    pathAnimation.setCalculationMode(CAAnimationCalculationMode.Paced);
    pathAnimation.setFillMode(CAFillMode.Forwards);
    pathAnimation.setRemovedOnCompletion(false);
    pathAnimation.setDuration(.5);

    UIBezierPath path = new UIBezierPath();
    path.move(view.getCenter());
    path.addQuadCurve(
        targetPosition, new CGPoint(view.getCenter().getX(), view.getCenter().getY()));
    pathAnimation.setPath(path.getCGPath());

    CABasicAnimation growAnimation = new CABasicAnimation("bounds.size");
    growAnimation.setToValue(NSValue.valueOf(grow));
    growAnimation.setFillMode(CAFillMode.Forwards);
    growAnimation.setRemovedOnCompletion(false);
    growAnimation.setDuration(.1);

    CABasicAnimation shrinkAnimation = new CABasicAnimation("bounds.size");
    shrinkAnimation.setToValue(NSValue.valueOf(shrink));
    shrinkAnimation.setFillMode(CAFillMode.Forwards);
    shrinkAnimation.setRemovedOnCompletion(false);
    shrinkAnimation.setDuration(.4);
    shrinkAnimation.setBeginTime(.1);

    CAAnimationGroup animations = new CAAnimationGroup();
    animations.setAnimations(new NSArray<>(pathAnimation, growAnimation, shrinkAnimation));
    animations.setFillMode(CAFillMode.Forwards);
    animations.setRemovedOnCompletion(false);
    animations.setDuration(.5);
    animations.setDelegate(
        new CAAnimationDelegateAdapter() {
          @Override
          public void didStop(CAAnimation anim, boolean flag) {
            view.removeFromSuperview();

            if (completion != null) {
              completion.run();
            }
          }
        });
    view.getLayer().addAnimation(animations, "movetocart");
  }
  private void addToBasket() {
    UINavigationController navigation = getNavigationController();

    CGPoint center =
        bottomView
            .getButton()
            .convertPointToView(
                bottomView.getButton().getImageView().getCenter(), navigation.getView());
    UIImageView imageView = new UIImageView(tshirtIcon);
    imageView.setCenter(center);
    imageView.setContentMode(UIViewContentMode.ScaleAspectFill);

    UIImageView backgroundView = new UIImageView(UIImage.getImage("circle"));
    backgroundView.setCenter(center);

    navigation.getView().addSubviews(backgroundView, imageView);

    UIView targetView =
        (UIView) getNavigationItem().getRightBarButtonItem().getKeyValueCoder().getValue("view");
    CGPoint targetPosition =
        new CGPoint(
            targetView.getCenter().getX() + targetView.getFrame().getWidth() / 3,
            targetView.getCenter().getY() + targetView.getFrame().getHeight() / 2);

    animateView(imageView, targetPosition, null);
    animateView(
        backgroundView,
        targetPosition,
        () -> {
          getNavigationItem().setRightBarButtonItem(StoreApp.getInstance().createBasketButton());
        });

    if (addedToBasket != null) {
      addedToBasket.invoke(new Order(order));
    }
  }