Capítulo 140 de 411

Chapter 140: gsap.utils.pipe()

Core Idea

pipe() chains multiple functions together, passing each one's return value into the next, avoiding nested/wrapped function calls.

Code Examples

// instead of func3(func2(func1(input)))
let transform = gsap.utils.pipe(func1, func2, func3);
transform(input);

Key Takeaways

  1. Commonly used to compose utilities like clamp() and snap() into a single reusable sanitizer function.

Connects To

  • gsap.utils.clamp() / snap(): frequently chained together via pipe().