Skip to content
pixi-silk
GitHub repository
Function

snapValue

import { snapValue } from 'pixi-silk/ui/guides';
function snapValue(
   v: number, 
   candidates: readonly number[], 
   threshold: number
): number;

The value of candidates within threshold of v that is nearest, or v when none is. A tie keeps the first.

Parameters#

ParameterType
vnumber
candidatesreadonly number[]
thresholdnumber

Returns#

number