Skip to main content

Home > @jsplumb/util > gradient

gradient() function#

Calculates the gradient of a line between the two points.

Signature:

export declare function gradient(p1: PointXY, p2: PointXY): number;

Parameters#

ParameterTypeDescription
p1PointXYFirst point in the line
p2PointXYSecond point in the line

Returns:

number

The gradient of a line between the two points.