- Source: src/math/snap/index.js (Line 7)
Methods
-
<static> Ceil(value, gap [, start] [, divide])
-
Snap a value to nearest grid slice, using ceil.
Example: if you have an interval gap of
5and a position of12... you will snap to15. As will14snap to15... but16will snap to20.Parameters:
Name Type Argument Default Description valuenumber The value to snap.
gapnumber The interval gap of the grid.
startnumber <optional>
0 Optional starting offset for gap.
divideboolean <optional>
false If
trueit will divide the snapped value by the gap before returning.- Since: 3.0.0
- Source: src/math/snap/SnapCeil.js (Line 7)
Returns:
The snapped value.
- Type
- number
-
<static> Floor(value, gap [, start] [, divide])
-
Snap a value to nearest grid slice, using floor.
Example: if you have an interval gap of
5and a position of12... you will snap to10. As will14snap to10... but16will snap to15.Parameters:
Name Type Argument Default Description valuenumber The value to snap.
gapnumber The interval gap of the grid.
startnumber <optional>
0 Optional starting offset for gap.
divideboolean <optional>
false If
trueit will divide the snapped value by the gap before returning.- Since: 3.0.0
- Source: src/math/snap/SnapFloor.js (Line 7)
Returns:
The snapped value.
- Type
- number
-
<static> To(value, gap [, start] [, divide])
-
Snap a value to nearest grid slice, using rounding.
Example: if you have an interval gap of
5and a position of12... you will snap to10whereas14will snap to15.Parameters:
Name Type Argument Default Description valuenumber The value to snap.
gapnumber The interval gap of the grid.
startnumber <optional>
0 Optional starting offset for gap.
divideboolean <optional>
false If
trueit will divide the snapped value by the gap before returning.- Since: 3.0.0
- Source: src/math/snap/SnapTo.js (Line 7)
Returns:
The snapped value.
- Type
- number
