Documentation / Snap / distanceLessThan
distanceLessThan()
ts
function distanceLessThan<Animating, Point>(distance): ShouldSnap<Animating, Point>;Defined in: ../../extensions/src/snap.ts:242
Returns a function of whether the provided distance is smaller than the distance between the current state and an arbitrary point. Mainly meant as a utility function for setSnapPoint.
Type Parameters
Animating
Animating extends Animatable<unknown>
Point
Point extends PartialRecursiveAnimatable<Animating>
Parameters
distance
number
The threshold euclidean distance.
Returns
ShouldSnap<Animating, Point>
A function which returns whether the distance between the current state and the point is less than distance provided.
Example
ts
const dlt2 = distanceLessThan(2)
dlt2({x: 1, y: 1}, {x: 0, y: 0}) // true