ã¯ããã«
ã©ãããåéã§ãã
ç¾å¨å¶ä½ä¸ã®VRã²ã¼ã ã§ã¹ã³ã¢UIãç»é¢ä¸ã«ããã®ã§ããããªãã¨ãªãã¹ã³ã¢ãå¢å ãã¦ããæ°æã¡ãããå°ãªããªï½ï½ã¨æããã®ã§ãã«ã¦ã³ãã¢ããã«åããã¦ã¢ãã¡ã¼ã·ã§ã³ãããããã«ãã¾ããã
ãã£ããä½ã£ããã®
æ°å¤å¤åã大ããã£ããå¾ã ã«å¤§ãããã¦ãå¾ãããã¾ããã
10ã®ä½ã«å¤åãããã¨ãä¸æ°ã«å·¨å¤§åããã¦æ°æã¡ããã¢ããã
ã³ã¼ã
ã¢ãã¡ã¼ã·ã§ã³ã¯DOTweenã使ç¨ãã¦è¡ã£ã¦ããã¾ãã
ã³ã¼ãããèªç±åº¦ãé«ãã¢ãã¡ã¼ã·ã§ã³ãä½ããã®ã§é常ã«éå®ãã¾ãããã
using DG.Tweening; using UnityEngine; using UnityEngine.UI; public class CountUpTest : MonoBehaviour { [SerializeField] private Transform gb; [SerializeField] private Text text; private int previousScore = 0f; private int nowScore; private float limitScale = 5f; private void Update() { nowScore = (int)gb.position.z; text.text = nowScore.ToString(); AnimationCountUp(); previousScore = nowScore; } private void AnimationCountUp() { var diff = nowScore - previousScore; if (diff>=1) { // æ°å¤å¤åã大ããã£ããã¹ã±ã¼ã«ã大ãããã var endVal = text.transform.localScale.x * (1 + diff * 0.1f); if(endVal > limitScale) endVal = limitScale; text.transform.DOScale(endVal, 1f); text.transform.DORotate(Vector3.forward * 20f, 1f); } else { // æ°å¤å¤åãå°ããã£ããã¹ã±ã¼ã«ããã¨ã«æ»ããã¨ãã text.transform.DOScale(1f, 1f); text.transform.DORotate(Vector3.zero, 1f); } // 10ã®ä½ã«å¤åããã£ããããµã¤ãºãã£ãã«å¤§ãããã if (HasTensDigitChanged(previousScore,nowScore)) { text.transform.DOScale(5f, 0.1f).SetEase(Ease.OutExpo); } } private int GetTensDigit(int number) { return (number / 10) % 10; // 10ã®ä½ã®æ°ãåå¾ } // 10ã®ä½ã«å¤æ´ããã£ããã©ãã private bool HasTensDigitChanged(int oldNumber, int newNumber) { int oldTensDigit = GetTensDigit(oldNumber); int newTensDigit = GetTensDigit(newNumber); return oldTensDigit != newTensDigit; } }
æ®éã®ã²ã¼ã ã ã¨ãã¡ããã¡ãããããæ¼åºã§ããâ¦
ãã ä»åã®ã²ã¼ã ã¯ãã®ã¹ã³ã¢ãã¦ã¼ã¶ã¼ã®æçµçãªã¹ã³ã¢ã«ãªãã®ã§ã強調ãããã¨ããã®ã¨ããããããããããUIã§ãVRã²ã¼ã ãªã®ã§è¦éè§ãåºãããããã¾ã§æ°ã«ãªããªãã¨ããã®ã¯ããã¾ããã