Intersection Observer
You'll use the Intersection Observer API to observe when the element is in the viewport and trigger the animation based on that.
Scroll Animation

Example of how to use Scroll animation with frame motion.

Scroll Animation
scroll-animation.tsx
ByteBigBoss