Capítulo 394 de 411

Chapter 394: Let's get animating!

Core Idea

Welcome! In this article we're going to cover GSAP's core fundamentals and animate some HTML elements.

Code Examples

gsap.to(".box", { x: 200 })
  • What it demonstrates: typical usage of Let's get animating! in a GSAP animation.

Reference Tables

GSAPDescription or equivalent CSS
x: 100transform: translateX(100px)
y: 100transform: translateY(100px)
xPercent: 50transform: translateX(50%)
yPercent: 50transform: translateY(50%)
scale: 2transform: scale(2)
scaleX: 2transform: scaleX(2)
scaleY: 2transform: scaleY(2)
rotation: 90transform: rotate(90deg)
rotation: "1.25rad"transform: rotate(1.25rad)
skew: 30transform: skew(30deg)
skewX: 30transform: skewX(30deg)
skewY: "1.23rad"transform: skewY(1.23rad)
transformOrigin: "center 40%"transform-origin: center 40%
opacity: 0adjust the elements opacity
autoAlpha: 0shorthand for opacity & visibility
duration: 1animation-duration: 1s
repeat: -1animation-iteration-count: infinite
repeat: 2animation-iteration-count: 3
delay: 2animation-delay: 2s
yoyo: trueanimation-direction: alternate
PropertyDescription
durationDuration of animation (seconds) Default: 0.5
delayAmount of delay before the animation should begin (seconds)
repeatHow many times the animation should repeat.
yoyoIf true, every other repeat the tween will run in the opposite direction. (like a yoyo) Default: false
staggerTime (in seconds) between the start of each target's animation (if multiple targets are provided)
easeControls the rate of change during the animation, like the motion's "personality" or feel. Default: "power1.out"
onCompleteA function that runs when the animation completes

Key Takeaways

  1. Welcome! In this article we're going to cover GSAP's core fundamentals and animate some HTML elements.

Connects To