The classic Math.round(num / step) * step for snapping numbers to a certain step.
Math.round(num / step) * step
Can optionally round up ("ceil") or down ("floor").
The classic
Math.round(num / step) * step
for snapping numbers to a certain step.Can optionally round up ("ceil") or down ("floor").