modify zoomin

This commit is contained in:
XuGaoFeng
2026-07-10 15:20:51 +08:00
parent d5aeb63276
commit 9c68a64c5b
5 changed files with 71 additions and 13 deletions

View File

@@ -10,7 +10,7 @@ public class FastSlowAnimationANDZoomIN : MonoBehaviour
//Animator anim;
public float maxHeight = 2f; // 最大上升高度(米)
float scaleRation = 0.5f;//默认缩放系数
// float scaleRation = 0.5f;//默认缩放系数
public float upTime = 1.5f;// 上升到最高点所需时间(秒)
private Dictionary<Transform, Vector3> childrenStartPos = new Dictionary<Transform, Vector3>();
@@ -23,7 +23,7 @@ public class FastSlowAnimationANDZoomIN : MonoBehaviour
foreach (Transform child in transform)
{
childrenStartPos[child] = child.position;
}
}
@@ -37,8 +37,8 @@ public class FastSlowAnimationANDZoomIN : MonoBehaviour
{
//通过遍历每个子物体,每个物体的大小是独立计算的,不能取最小值
float dist = Vector3.Distance(child.position, cam.transform.position);
float scale = scaleRation * dist / 30f;
scale = Mathf.Clamp(scale, 0.0333f, 10f);
float scale = dist / 60f;
scale = Mathf.Clamp(scale, 0.001f, 10f);
maxHeight = 0.05f + (dist - 1f) * 0.9f / 49f;
maxHeight = Mathf.Clamp(maxHeight, 0.05f, 2f);