Vinyl
    Preparing search index...

    Function floorToNearest

    • Floors a value to the nearest snap interval.

      Examples:

      floorToNearest(3, 2) // 2
      floorToNearest(16, 5) // 15
      floorToNearest(16, 5, 2) // 17

      Parameters

      • value: number

        The value to floor with the given snap interval and offset.

      • snap: number

        The interval between output values. Should be a finite, non-zero number.

      • offset: number = 0

        The offset of the interval. E.g. if snap is 10 and offset is 1, values will be snapped to -19, -9, 1, 11, 21, 31, 41, ...

      Returns number