code: public static void interpolate(State out, State start, float startPivotX, float startPivotY,
              State end, float endPivotX, float endPivotY, float factor) {
          out.set(start);
  
          if (!State.equals(start.getZoom(), end.getZoom())) {
              float zoom = interpolate(start.getZoom(), end.getZoom(), factor);
              out.zoomTo(zoom, startPivotX, startPivotY);
          }
  
          // Getting rotations
          float startRotation = start.getRotation();
          float endRotation = end.getRotation();
  
          float rotation = Float.NaN;
  
          // Choosing shortest path to interpolate
          if (Math.abs(startRotation - endRotation) <= 180f) {
              if (!State.equals(startRotation, endRotation)) {
                  rotation = interpolate(startRotation, endRotation, factor);
              }
          } else {
              // Keeping rotation positive
              float startRotationPositive = startRotation < 0f ? startRotation + 360f : startRotation;
              float endRotationPositive = endRotation < 0f ? endRotation + 360f : endRotation;
  
              if (!State.equals(startRotationPositive, endRotationPositive)) {
                  rotation = interpolate(startRotationPositive, endRotationPositive, factor);
              }
          }
  
          if (!Float.isNaN(rotation)) {
              out.rotateTo(rotation, startPivotX, startPivotY);
          }
  
          float dx = interpolate(0, endPivotX - startPivotX, factor);
          float dy = interpolate(0, endPivotY - startPivotY, factor);
          out.translateBy(dx, dy);
      }
docs: Interpolates from start state to end state by given factor (from 0 to 1),
  storing result into out state. All operations (translation, zoom, rotation) will be
  performed within specified pivot points, assuming start and end pivot points represent
  same physical point on the image.
  
  @param out Interpolated state (output)
  @param start Start state
  @param startPivotX Pivot point's X coordinate in start state coordinates
  @param startPivotY Pivot point's Y coordinate in start state coordinates
  @param end End state
  @param endPivotX Pivot point's X coordinate in end state coordinates
  @param endPivotY Pivot point's Y coordinate in end state coordinates
  @param factor Factor