Math#snapToCeil()

snapToCeil(input, gap, start) → {number}

Snap a value to nearest grid slice, using ceil.

Example: if you have an interval gap of 5 and a position of 12... you will snap to 15.
As will 14 will snap to 15... but 16 will snap to 20.

Parameters
Name Type Argument Default Description
input number

The value to snap.

gap number

The interval gap of the grid.

start number <optional>
0

Optional starting offset for gap.

Returns
number -

The snapped value.

Source code: math/Math.js (Line 208)
doc_phaser
2017-02-14 10:55:05
Comments
Leave a Comment

Please login to continue.