DOTween: Hiệu ứng xoay (DORotate)
C# Code
using UnityEngine;
using DG.Tweening;
public class DoTweenRotate : MonoBehaviour
{
public Vector3 endRotation = new Vector3(0, 0, 360);
public float duration = 2f;
public RotateMode rotateMode = RotateMode.FastBeyond360;
public Ease easeType = Ease.Linear;
void Start()
{
// Xoay đối tượng 360 độ quanh trục Z
// SetLoops(-1) để xoay vô hạn
transform.DORotate(endRotation, duration, rotateMode).SetEase(easeType).SetLoops(-1, LoopType.Incremental);
}
}Sử dụng DOTween để xoay một đối tượng theo một góc nhất định.