public static void PreviewPopupAnimation(UIPopup popup, UIAnimation animation) { if (s_previewIsPlaying) { return; } if (s_delayedCall != null) { s_delayedCall.Cancel(); } popup.UpdateStartValues(); StopPopupPreview(popup); StopAllAnimations(popup.RectTransform); if (popup.HasContainer) { popup.Container.UpdateStartValues(); StopAllAnimations(popup.Container.RectTransform); } if (popup.HasOverlay) { popup.Overlay.UpdateStartValues(); StopAllAnimations(popup.RectTransform); } Vector3 moveFrom = UIAnimator.GetAnimationMoveFrom(popup.Container.RectTransform, animation, popup.Container.StartPosition); Vector3 moveTo = UIAnimator.GetAnimationMoveTo(popup.Container.RectTransform, animation, popup.Container.StartPosition); if (!animation.Move.Enabled) { popup.Container.ResetPosition(); } else { PreviewMove(popup.Container.RectTransform, moveFrom, moveTo, animation, popup.Container.StartPosition); } Vector3 rotateFrom = UIAnimator.GetAnimationRotateFrom(animation, popup.Container.StartRotation); Vector3 rotateTo = UIAnimator.GetAnimationRotateTo(animation, popup.Container.StartRotation); if (!animation.Rotate.Enabled) { popup.Container.ResetRotation(); } else { PreviewRotate(popup.Container.RectTransform, rotateFrom, rotateTo, animation, popup.Container.StartRotation); } Vector3 scaleFrom = UIAnimator.GetAnimationScaleFrom(animation, popup.Container.StartScale); Vector3 scaleTo = UIAnimator.GetAnimationScaleTo(animation, popup.Container.StartScale); if (!animation.Scale.Enabled) { popup.Container.ResetScale(); } else { PreviewScale(popup.Container.RectTransform, scaleFrom, scaleTo, animation, popup.Container.StartScale); } float fadeFrom = UIAnimator.GetAnimationFadeFrom(animation, popup.Container.StartAlpha); float fadeTo = UIAnimator.GetAnimationFadeTo(animation, popup.Container.StartAlpha); if (!animation.Fade.Enabled) { popup.Container.ResetAlpha(); } else { PreviewFade(popup.Container.RectTransform, fadeFrom, fadeTo, animation, popup.Container.StartAlpha); } if (animation.Enabled && popup.HasOverlay && popup.Overlay.Enabled) { float overlayFadeFrom = animation.AnimationType == AnimationType.Show ? 0 : 1; float overlayFadeTo = animation.AnimationType == AnimationType.Show ? 1 : 0; popup.Overlay.CanvasGroup.alpha = overlayFadeFrom; DOTweenEditorPreview.PrepareTweenForPreview(popup.Overlay.CanvasGroup.DOFade(overlayFadeTo, animation.TotalDuration), true, true, false); } DOTweenEditorPreview.Start(); s_previewIsPlaying = true; s_delayedCall = new DelayedCall(animation.TotalDuration + (animation.AnimationType == AnimationType.Hide ? 0.5f : 0f), () => { StopPopupPreview(popup); s_delayedCall = null; }); }