From 6ce8b9e22fc13be34b442c7b6af48b42cd44275a Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Wed, 13 Mar 2024 11:00:58 +0800 Subject: +init --- EnvMapAnimator.cs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 EnvMapAnimator.cs (limited to 'EnvMapAnimator.cs') diff --git a/EnvMapAnimator.cs b/EnvMapAnimator.cs new file mode 100644 index 0000000..3d19693 --- /dev/null +++ b/EnvMapAnimator.cs @@ -0,0 +1,29 @@ +using System.Collections; +using TMPro; +using UnityEngine; + +public class EnvMapAnimator : MonoBehaviour +{ + public Vector3 RotationSpeeds; + + private TMP_Text m_textMeshPro; + + private Material m_material; + + private void Awake() + { + m_textMeshPro = GetComponent(); + m_material = m_textMeshPro.fontSharedMaterial; + } + + private IEnumerator Start() + { + Matrix4x4 matrix = default(Matrix4x4); + while (true) + { + matrix.SetTRS(Vector3.zero, Quaternion.Euler(Time.time * RotationSpeeds.x, Time.time * RotationSpeeds.y, Time.time * RotationSpeeds.z), Vector3.one); + m_material.SetMatrix("_EnvMatrix", matrix); + yield return null; + } + } +} -- cgit v1.1-26-g67d0