private void drawWaves(@Nonnull Canvas canvas, boolean warn, double width) {
		var gc = canvas.getGraphicsContext2D();

		// Make a solid yellow/red line based on error level
		gc.setStroke(warn ? Color.YELLOW : Color.RED);
		gc.setLineWidth(1);
		gc.beginPath();

		// wave heights
		final double scalingFactor = .7;
		final double waveUp = containerHeight - 3 * scalingFactor;
		final double waveDown = containerHeight - 6 * scalingFactor;

		final double stepScale = .6 - (scalingFactor / 5);
		final double step = waveDown * stepScale;
		final double halfStep = step / 2;

		final double downStop = width - halfStep;
		final double upStop = width - step;

		// We want to draw waves such that the last wave is on the border of the errorWidth
		for (double x = 0; x < width; x += step) {
			gc.moveTo(x, waveUp);
			if (x < downStop)
				gc.lineTo(x + halfStep, waveDown);
			if (x < upStop)
				gc.lineTo(x + step, waveUp);
		}

		gc.stroke();
		gc.closePath();
	}
Draws a saw-tooth wave pattern for the given error level of the given width.

@param canvas
		Drawing destination.
@param warn
		Error level, either {@code true} for warning, or {@code false} for errors.
@param width
		Length of waves to draw.
recaf-ui/src/main/java/software/coley/recaf/ui/control/richtext/problem/ProblemSquiggleGraphicFactory.java