Vinyl
    Preparing search index...

    Function ceilToNearest

    • Ceilings a value to the nearest snap interval.

      Examples:

      ceilToNearest(3, 2) // 4
      ceilToNearest(16, 5) // 20
      ceilToNearest(10, 5) // 10
      ceilToNearest(16, 5, 2) // 22

      Parameters

      • value: number

        The value to ceil 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