The straight-line distance between two points. Move the mouse over the canvas.
See also: Point-in-circle — the hit test is the same calculation, skipping the square root.
dx = a.x - b.x
dy = a.y - b.y
distance = sqrt(dx * dx + dy * dy)
const originX = 150
const originY = 150
const dx = originX - mouseX
const dy = originY - mouseY
const distance = Math.floor(Math.sqrt(dx * dx + dy * dy))