Módulos de Tween
“Tweening” proporciona una forma limitada de animación.
Permite la interpolación lineal entre dos valores.
Introducción
Todo lo que aprenderás para programar videojuegos 2D con Unity
Consejos de design: preparación de Assets y versionamiento de Unity
Timeline
Mejorando el flujo de Visual Studio
Tips en Visual Studio Debug.Log vs. breakpoint
Atributos en Unity
Atributos en Unity (herramientas)
Ternary Operations
Programación
Arrays, listas
Diccionarios
New Input System
Matemáticas para juegos: vectores
Matemáticas para juegos: personaje
Pathfinding - IA
Animation Events
Tween
Tweening
Movimientos básicos y cambio de variables en el tiempo
Transiciones
Callbacks
Web requests y eventos
Conexiones con API
JSON
JSON: cambio de clima
Delegates
Eventos
Introducción a los patrones de diseño
¿Qué son los patrones de diseño y para qué sirven?
Singleton
Object Pool I
Object Pool II
Observer
Físicas 2D
Effectors
Buoyancy
Extra
No parar de aprender: Jams
You don't have access to this class
Keep learning! Join and start boosting your career
In the world of video game development, animation plays a crucial role in enhancing the user experience. DotTween is a powerful tool that facilitates the creation of animations in Unity thanks to its ability to interpolate variables efficiently and easily. This free module, widely accepted in the industry, offers a range of functionalities that can be easily integrated into your projects.
To start using DotTween, you must first download it from the official website: DotTween.Demigrant.com. Follow these steps:
DotTween offers modules for audio, physics, 2D physics, sprites and UI animations, allowing full integration to enhance your animations.
Once you have DotTween installed, it's time to put it into action with a basic script. Here I'll walk you through creating a script to move an object on the X axis:
Head to the "Enemies" folder and create a new C# script with the name ShipMovement
.
Add the necessary library to the beginning of the script to access the DotTween classes:
using DG.Tweening;
In the Start
method, implement a simple movement using transform.DOMoveX
, which allows to interpolate the position of the object on the X-axis for a specified time:
void Start(){ transform.DOMoveX(0, 2); // Moves the object to position X = 0 in 2 seconds}
Go back to Unity, select one of your ships or other object in the scene, add the ShipMovement
component, and run your game. Watch how the object moves linearly in the specified time.
A good layer organization for your sprites is essential to avoid visual overlapping problems in your game. Here are some tips:
By implementing these changes, you will see your DotTween-embedded animations run smoothly and without visual conflicts.
DotTween not only helps you perform basic animations, but opens up a world of possibilities within your Unity projects - feel free to explore further and take your animations to the next level! Stay tuned to keep expanding your skills in the next class.
Contributions 1
Questions 1
Módulos de Tween
“Tweening” proporciona una forma limitada de animación.
Permite la interpolación lineal entre dos valores.
Want to see more contributions, questions and answers from the community?