Capítulo 149 de 411

Chapter 149: gsap.utils.wrapYoyo()

Core Idea

wrapYoyo() is like wrap(), but instead of cycling straight back to the start when the range is exceeded, it bounces back and forth (yoyo).

Reference Tables

SignatureDescription
wrapYoyo(min, max, value) | wrapYoyo(array, index)returns the wrapped value immediately
wrapYoyo(min, max) | wrapYoyo(array)returns a reusable function

Code Examples

gsap.utils.wrapYoyo(["red", "green", "yellow"], 5); // "red" (index 5 -> 0 via yoyo)

Connects To

  • gsap.utils.wrap(): the non-bouncing version.