Capítulo 144 de 411
snap() snaps a value to the closest multiple of an increment, or to the closest value in an array (optionally scoped to a radius, including 2D {x, y} points).
| Signature | Description |
|---|---|
snap(increment, valueToSnap) | returns the snapped value immediately |
snap(increment) | returns a reusable function |
gsap.utils.snap(5, 13); // 15
gsap.utils.snap([0, 50, 150, 500], 42); // 50