function scrollAnimation(velocityX, velocityY, timeThen = 0) {
		if (!velocityX && !velocityY) {
			onscrollend();
			return;
		}

		const timeNow = Date.now();

		if (!timeThen) {
			scrollAnimationFrame = requestAnimationFrame(
				scrollAnimation.bind(null, velocityX, velocityY, timeNow),
			);
			return;
		}

		const timeElapsed = timeNow - timeThen;
		const FRICTION = SCROLL_SPEED[scrollSpeed];
		const nextX = velocityX * timeElapsed;
		const nextY = velocityY * timeElapsed;

		let scrollX = Number.parseInt(nextX * 100) / 100;
		let scrollY = Number.parseInt(nextY * 100) / 100;

		const [canScrollX, canScrollY] = testScroll(scrollX, scrollY);

		if (!canScrollX) {
			velocityX = 0;
			scrollX = 0;
		}

		if (!canScrollY) {
			velocityY = 0;
			scrollY = 0;
		}

		if (!scrollX && !scrollY) {
			cancelAnimationFrame(scrollAnimationFrame);
			return;
		}

		scroll(scrollX, scrollY);

		velocityX *= FRICTION;
		velocityY *= FRICTION;

		scrollAnimationFrame = requestAnimationFrame(
			scrollAnimation.bind(null, velocityX, velocityY, timeNow),
		);
	}
Scrolls the editor with smooth animation
@param {number} velocityX velocity in x direction
@param {number} velocityY velocity in y direction
@param {number} [timeThen]
@returns {void}