Capítulo 159 de 411
A helper that patches GSAP's standard (non-configurable) eases so they accept an optional weight ratio between -1 and 1, pulling the curve toward the "in" or "out" portion without needing a full CustomEase.
addWeightedEases() once at startup; it adds a .config() to every standard ease that doesn't already have one.-1 weights fully toward "in", 1 fully toward "out", 0 is unweighted.steps(), slow()).function addWeightedEases() {
let eases = gsap.parseEase(),
createConfig = (ease) => (ratio) => {
let y = 0.5 + ratio / 2;
return (p) => ease(2 * (1 - p) * p * y + p * p);
};
for (let p in eases) {
if (!eases[p].config) eases[p].config = createConfig(eases[p]);
}
}
// usage after calling addWeightedEases() once:
gsap.to(el, { x: 200, ease: "power2.inOut(0.5)" }); // weighted toward "out"