get a point on a line — live canvas animation example

motion & easing8+
trig, angles & vectors8+
collision detection11+
numbers in motion7+
geometry & shapes8-
generative showpieces13+
handy helpers7+
0 = A · 1 = B · outside [0,1] extrapolates

Drag endpoints A and B, and the t slider. It's just lerp on each axis:

x = 350 + (630 − 350) · 0.50 = 490
y = 403 + (223 − 403) · 0.50 = 313