| | |
| | | |
| | | |
| | | public static TweenerCore<Vector2, Vector2, DG.Tweening.Plugins.Options.VectorOptions> MoveToTarget( |
| | | RectTransform transform, RectTransform target, Vector2 offset, float duration, Action onComplete = null) |
| | | RectTransform transform, RectTransform target, Vector2 offset, Action onComplete = null, float speed = 450f) |
| | | { |
| | | |
| | | // 获取目标节点的世界坐标(中心点) |
| | |
| | | out localPoint); |
| | | |
| | | // 创建RawImage |
| | | float distance = Vector2.Distance(transform.anchoredPosition, localPoint); |
| | | |
| | | float duration = distance / speed; // 假设速度为1000单位/秒,可以根据需要调整 |
| | | |
| | | var tween = transform.DOAnchorPos(localPoint, duration).SetEase(Ease.Linear); |
| | | tween.onComplete += () => |