private void FaceOut(RectTransform rectTransform, float timeAnimation, float timeDelay, float end = 0f, TweenCallback actionOnComplete = null, Ease ease = Ease.InCubic) { if (canvasGroup == null) { canvasGroup = rectTransform.GetComponent <CanvasGroup>(); } if (canvasGroup == null) { canvasGroup = rectTransform.gameObject.AddComponent <CanvasGroup>(); } canvasGroup.DOKill(true); canvasGroup .DOFade(end, timeAnimation) .SetDelay(timeDelay) .SetEase(ease) .SetUpdate(UpdateType.Normal, true) .OnComplete(() => { Status = UIAnimStatus.IsHide; actionOnComplete?.Invoke(); OnHideCompleted?.Invoke(); if (onHideCompleted != null) { onHideCompleted.Invoke(); onHideCompleted = null; } gameObject.SetActive(!hideAtEnd); }); HideElements(null); }
private void SlideOut(RectTransform rectTransform, Vector2 toPosition, float timeAnimation, float timeDelay, TweenCallback actionOnComplete = null, Ease ease = Ease.InCubic) { //Debug.Log("SlideOut start " + name); rectTransform.DOKill(true); rectTransform .DOAnchorPos(toPosition, timeAnimation, false) .SetDelay(timeDelay) .SetEase(ease) .SetUpdate(UpdateType.Normal, true) .OnComplete(() => { //Debug.Log("SlideOut end " + name); Status = UIAnimStatus.IsHide; actionOnComplete?.Invoke(); OnHideCompleted?.Invoke(); if (onHideCompleted != null) { onHideCompleted.Invoke(); onHideCompleted = null; } gameObject.SetActive(!hideAtEnd); }); HideElements(null); }