Capítulo 35 de 411
gsap.utils is a collection of standalone helper functions for math and data tasks (clamping, mapping ranges, interpolation, snapping, etc.), usable independently of any tween.
clamp() (constrain to a range), mapRange() (remap one range to another), normalize() (map a value to 0-1 progress), interpolate() (blend between almost any two values — numbers, colors, strings, arrays, objects), pipe() (chain utility calls together), distribute() (spread a value across an array of objects, optionally with easing), getUnit() (extract a value's unit), checkPrefix() (resolve a vendor-prefixed CSS property name).checkPrefix, clamp, distribute, getUnit, interpolate, mapRange, normalize, pipe, random, selector, shuffle, snap, splitColor, toArray, unitize, wrap, wrapYoyo) has its own chapter.gsap.utils.clamp(0, 100, -12); // 0
gsap.utils.mapRange(-10, 10, 0, 100, 5); // 75
gsap.utils.interpolate("red", "blue", 0.5); // "rgba(128,0,128,1)"
gsap.utils.pipe(gsap.utils.clamp(0, 100), gsap.utils.snap(5))(8); // 10
pipe().