| | |
| | | /// </summary> |
| | | private void UpdatePosition() |
| | | { |
| | | float moveProgress = timer / config.totalShowTime; |
| | | Vector2 currentPos = Vector2.Lerp(GetBeginPosition(), GetEndPosition(), moveProgress); |
| | | float timeProgress = timer / config.totalShowTime; |
| | | // 使用曲线来调整插值进度 |
| | | float curveProgress = config.positionCurve.Evaluate(timeProgress); |
| | | Vector2 currentPos = Vector2.Lerp(GetBeginPosition(), GetEndPosition(), curveProgress); |
| | | rectTransform.anchoredPosition = currentPos; |
| | | } |
| | | |
| | |
| | | // 阶段1: 缩放和透明度变化 |
| | | if (timer < config.scaleChangeTime) |
| | | { |
| | | float progress = timer / config.scaleChangeTime; |
| | | float timeProgress = timer / config.scaleChangeTime; |
| | | |
| | | // 缩放插值 |
| | | Vector3 currentScale = Vector3.Lerp(GetBeginScale(), GetEndScale(), progress); |
| | | // 使用曲线来调整缩放插值进度 |
| | | float scaleProgress = config.scaleCurve.Evaluate(timeProgress); |
| | | Vector3 currentScale = Vector3.Lerp(GetBeginScale(), GetEndScale(), scaleProgress); |
| | | rectTransform.localScale = currentScale * scaleRatio; |
| | | |
| | | // 颜色插值(使用运行时颜色或配置颜色) |
| | | Color currentColor = Color.Lerp(GetBeginColor(), GetEndColor(), progress); |
| | | // 使用曲线来调整颜色插值进度 |
| | | float colorProgress = config.colorCurve.Evaluate(timeProgress); |
| | | Color currentColor = Color.Lerp(GetBeginColor(), GetEndColor(), colorProgress); |
| | | applyColorCallback?.Invoke(currentColor); |
| | | } |
| | | // 阶段2: 保持最终缩放和透明度 |