The slope of the line shown in the question is the same between any two distinct points on the the same line.
Therefore;
All right triangles that have a vertical leg, a horizontal leg and a portion of the line as the hypotenuse are similar. The slope is calculated as the change in the vertical leg divided by the change in the horizontal leg. In other words, as the vertical leg increases (or decreases), the horizontal leg also increases (or decreases) by the same ratio. That ratio is the slope of the line.