Capítulo 96 de 411

Chapter 96: Timeline.yoyo()

Core Idea

yoyo() gets or sets whether repeats alternate direction (back and forth) instead of always restarting forward.

Key Concepts

  • Requires a non-zero repeat to have any visible effect.
  • Doesn't affect the reversed property — it changes direction only between repeat passes, e.g. with repeat:2: false plays 1-2-3, 1-2-3, 1-2-3; true plays 1-2-3, 3-2-1, 1-2-3.

Reference Tables

ParameterTypeDefaultDescription
valueBooleanfalseomit to get, pass to set

Code Examples

gsap.timeline({ repeat: 1, yoyo: true });
tl.yoyo(true).repeat(3);

Connects To

  • Timeline.repeat(): yoyo has no effect without a non-zero repeat count.