Code

GSAP

Tweens

Beginner The three core tween methods — gsap.to(), gsap.from(), and gsap.fromTo() — each animating a box with different eases and options. GSAP Docs

gsap.to()
gsap.from()
gsap.fromTo()
// gsap.to — animate TO values
gsap.to(box1, {
  x: 180, rotation: 360,
  duration: 1.4, ease: 'power2.inOut',
  repeat: -1, yoyo: true
});

// gsap.from — animate FROM values
gsap.from(box2, {
  scale: 0, opacity: 0,
  duration: 1.2, ease: 'back.out(1.7)',
  repeat: -1, repeatDelay: 0.5, yoyo: true
});

// gsap.fromTo — define start AND end
gsap.fromTo(
  box3,
  { y: -30, opacity: 0, skewX: 20 },
  {
    y: 30, opacity: 1, skewX: -20,
    duration: 1, ease: 'sine.inOut',
    repeat: -1, yoyo: true
  }
);