Capítulo 28 de 411
gsap.registerEffect() wraps a reusable animation function under a name, so it can be invoked later via gsap.effects.<name>() with new targets and config.
effect(targets, config): the function you author, returning a Tween/Timeline; config is whatever properties you decide the caller can pass.defaults: fallback values applied to config when the caller omits them.extendTimeline: true: also makes the effect callable directly as a timeline method (tl.myEffect(...)), inserted at the position you specify.gsap.registerEffect({
name: "fade",
effect: (targets, config) => gsap.to(targets, { duration: config.duration, opacity: 0 }),
defaults: { duration: 2 },
extendTimeline: true,
});
gsap.effects.fade(".box");
extendTimeline: true is what turns an effect into a first-class timeline method, not just a standalone gsap.effects.x() call.