Capítulo 7 de 411
The snap property forces one or more animated values to jump to the closest value in an increment, an array, or an array with a radius threshold — live, throughout the tween, not just at the end.
snap: "x,y": snaps a comma-delimited list of properties to the closest whole number.snap: { x: 20 }: snaps to the closest multiple of an increment.snap: { x: [0, 50, 150, 500] }: snaps to the closest value in an explicit array.snap: { x: { values: [...], radius: 20 } }: only snaps when within radius of one of the array values.gsap.to(".class", {
x: 1000,
snap: {
x: { values: [0, 50, 150, 500], radius: 20 },
},
});
x to the nearest listed value, but only once the animated value comes within 20px of it.