Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Tween Properties and Options | GSAP Essentials and Tweens
JavaScript GSAP Animation Basics

bookTween Properties and Options

When working with GSAP, you have the ability to animate a wide range of properties on DOM elements. The most commonly animated properties include:

  • X: moves an element horizontally along the x-axis;
  • Y: moves an element vertically along the y-axis;
  • Scale: resizes an element proportionally;
  • Rotation: rotates an element around its center;
  • Opacity: changes the transparency of an element.

Beyond these, GSAP allows you to animate many other CSS properties, but these five are the foundation for most UI animations.

In addition to choosing which property to animate, you can customize how the animation behaves using tween options. Some of the most frequently used options are:

  • Duration: sets how long the animation should take, in seconds;
  • Delay: adds a pause before the animation starts;
  • Repeat: determines how many times the animation will play (use -1 for infinite repeats);
  • Yoyo: makes the animation reverse direction on every alternate repeat;
  • Ease: controls the acceleration and deceleration of the animation (covered in more detail in a later chapter).

By combining these properties and options, you can create smooth, engaging animations with just a few lines of code.

index.html

index.html

copy

Each property and option you use in a tween directly shapes the resulting animation. The x and y properties move the element horizontally and vertically, so in this example, the box slides 200 pixels to the right and 100 pixels down. The scale property increases the box's size by 1.5 times, while rotation spins it a full 360 degrees. Adjusting opacity to 0.5 makes the box semi-transparent.

The duration option sets the total time for the animation to complete (2 seconds here), and delay waits half a second before starting. Setting repeat to 1 causes the animation to play twice (the original run plus one repeat). The yoyo option makes the box animate back to its original state after each repeat, creating a forward-and-back motion.

By experimenting with these properties and options, you can achieve a wide variety of animation effects, from simple fades and moves to more complex, interactive sequences.

question mark

Which of the following is NOT a common property you can animate with GSAP?

Select the correct answer

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 1. Capitolo 2

Chieda ad AI

expand

Chieda ad AI

ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

Awesome!

Completion rate improved to 7.69

bookTween Properties and Options

Scorri per mostrare il menu

When working with GSAP, you have the ability to animate a wide range of properties on DOM elements. The most commonly animated properties include:

  • X: moves an element horizontally along the x-axis;
  • Y: moves an element vertically along the y-axis;
  • Scale: resizes an element proportionally;
  • Rotation: rotates an element around its center;
  • Opacity: changes the transparency of an element.

Beyond these, GSAP allows you to animate many other CSS properties, but these five are the foundation for most UI animations.

In addition to choosing which property to animate, you can customize how the animation behaves using tween options. Some of the most frequently used options are:

  • Duration: sets how long the animation should take, in seconds;
  • Delay: adds a pause before the animation starts;
  • Repeat: determines how many times the animation will play (use -1 for infinite repeats);
  • Yoyo: makes the animation reverse direction on every alternate repeat;
  • Ease: controls the acceleration and deceleration of the animation (covered in more detail in a later chapter).

By combining these properties and options, you can create smooth, engaging animations with just a few lines of code.

index.html

index.html

copy

Each property and option you use in a tween directly shapes the resulting animation. The x and y properties move the element horizontally and vertically, so in this example, the box slides 200 pixels to the right and 100 pixels down. The scale property increases the box's size by 1.5 times, while rotation spins it a full 360 degrees. Adjusting opacity to 0.5 makes the box semi-transparent.

The duration option sets the total time for the animation to complete (2 seconds here), and delay waits half a second before starting. Setting repeat to 1 causes the animation to play twice (the original run plus one repeat). The yoyo option makes the box animate back to its original state after each repeat, creating a forward-and-back motion.

By experimenting with these properties and options, you can achieve a wide variety of animation effects, from simple fades and moves to more complex, interactive sequences.

question mark

Which of the following is NOT a common property you can animate with GSAP?

Select the correct answer

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 1. Capitolo 2
some-alt