Unity/DOTween
게임 프로그래머
2025. 9. 22. 17:18
2025. 9. 22. 17:18
이글은 계속 업데이트 예정입니다. 공식 문서 기준
🎵 Audio
AudioSource
- DOFade(float to, float duration) ★
audioSource.DOFade(0, 1f); // 1초 동안 볼륨을 0으로 줄임
- DOPitch(float to, float duration)
audioSource.DOPitch(1.5f, 2f); // 피치를 2초 동안 1.5로 변경
AudioMixer
- DOSetFloat(string param, float to, float duration)
audioMixer.DOSetFloat("Volume", -20f, 1f); // 오디오 믹서 파라미터를 변경
📷 Camera
- DOFieldOfView(float to, float duration) ★
Camera.main.DOFieldOfView(30, 1f); // 1초 동안 카메라 줌인
- DOShakePosition(float duration, float strength) ★
Camera.main.DOShakePosition(0.5f, 0.3f); // 카메라 흔들림 효과
- DOColor(Color to, float duration)
Camera.main.DOColor(Color.black, 1f); // 카메라 배경색 전환
💡 Light
- DOColor(Color to, float duration)
light.DOColor(Color.red, 1f); // 라이트 색상을 빨강으로 변경
- DOIntensity(float to, float duration) ★
light.DOIntensity(5f, 2f); // 2초 동안 광원 밝기를 5로 변경
🎨 Material
- DOColor(Color to, float duration) ★
renderer.material.DOColor(Color.green, 1f); // 머티리얼 색상을 초록으로
- DOFade(float to, float duration)
renderer.material.DOFade(0.5f, 2f); // 머티리얼 투명도 조절
- DOOffset(Vector2 to, float duration)
renderer.material.DOOffset(new Vector2(1, 1), 2f); // 텍스처 오프셋 변경
🔧 Rigidbody / Rigidbody2D
- DOMove(Vector3 to, float duration)
rigidbody.DOMove(new Vector3(0, 5, 0), 1f); // 물리 기반 이동
- DOJump(Vector3 endValue, float jumpPower, int numJumps, float duration)
rigidbody.DOJump(Vector3.up * 5, 2, 1, 1f); // 점프 궤적 이동
- DORotate(Vector3 to, float duration)
rigidbody.DORotate(new Vector3(0, 90, 0), 1f); // 물리 회전
🔄 Transform
- DOMove(Vector3 to, float duration) ★
transform.DOMove(new Vector3(0, 5, 0), 1f); // 위치 이동
- DORotate(Vector3 to, float duration) ★
transform.DORotate(new Vector3(0, 180, 0), 2f); // 회전
- DOScale(Vector3 to, float duration) ★
transform.DOScale(new Vector3(2, 2, 2), 1f); // 스케일 변경
- DOShakePosition(float duration, float strength) ★
transform.DOShakePosition(1f, 0.5f); // 오브젝트 흔들림
- DOPunchScale(Vector3 punch, float duration, int vibrato, float elasticity)
transform.DOPunchScale(Vector3.one * 0.2f, 0.5f, 5, 0.5f); // 스프링처럼 튀는 스케일 애니메이션
🖼️ Unity UI
CanvasGroup
- DOFade(float to, float duration) ★
canvasGroup.DOFade(0, 1f); // UI 그룹 전체 투명화
Graphic/Image/Text
- DOColor(Color to, float duration)
image.DOColor(Color.red, 1f); // UI 색상 변경
- DOFade(float to, float duration)
text.DOFade(0, 1f); // 텍스트 투명화
- DOText(string to, float duration) ★
text.DOText("Hello DOTween!", 2f); // 글자가 타이핑되듯 출력
🔤 TextMesh Pro
- DOText(string to, float duration) ★
tmpText.DOText("DOTween TMP!", 2f); // TMP 텍스트 타이핑 효과
- DOTweenTMPAnimator.DOScaleChar(int index, float value, float duration) ★
DOTweenTMPAnimator anim = new DOTweenTMPAnimator(tmpText); anim.DOScaleChar(0, 2f, 1f); // 첫 글자 확대
- DOTweenTMPAnimator.DOOffsetChar(int index, Vector3 offset, float duration) ★
for (int i = 0; i < anim.textInfo.characterCount; i++)
{
if (!anim.textInfo.characterInfo[i].isVisible) continue;
anim.DOOffsetChar(i, new Vector3(0, 30, 0), 1f);
} // 글자들이 위에서 떨어지는 애니메이션