Capítulo 333 de 411

Chapter 333: .direction

Core Idea

[read-only] Reflects the moment-by-moment direction of scrolling where 1 is forward and -1 is backward.

Code Examples

ScrollTrigger.create({
  trigger: ".trigger",
  start: "top center",
  end: "+=500",
  onUpdate: (self) => console.log("direction:", self.direction),
});
  • What it demonstrates: typical usage of .direction in a GSAP animation.

Key Takeaways

  1. [read-only] Reflects the moment-by-moment direction of scrolling where 1 is forward and -1 is backward.