function zoomByDelta(view, delta, anchor, duration) {
  const currentZoom = view.getZoom();

  if (currentZoom === undefined) {
    return;
  }

  const newZoom = view.getConstrainedZoom(currentZoom + delta);
  const newResolution = view.getResolutionForZoom(newZoom);

  if (view.getAnimating()) {
    view.cancelAnimations();
  }
  view.animate({
    resolution: newResolution,
    anchor: anchor,
    duration: duration !== undefined ? duration : 250,
    easing: easeOut,
  });
}
@param {import("../View.js").default} view View.
@param {number} delta Delta from previous zoom level.
@param {import("../coordinate.js").Coordinate} [anchor] Anchor coordinate in the user projection.
@param {number} [duration] Duration.