This example demonstrates how to use GSAP to create a basic horizontal animation
and control its behavior using the yoyo feature. We use gsap.fromTo() to move
a box from left to right infinitely using repeat: -1, and a checkbox toggles
whether the animation reverses direction after each cycle.
It’s a simple yet powerful way to explore how repeating animations work and how
to enhance them with yoyo for a natural back-and-forth motion—something often
used in UI elements like loaders, sliders, or playful transitions.
By toggling the checkbox, the animation is updated dynamically using
tween.yoyo(...) and restarted with tween.restart(), giving real-time control
over the animation behavior.