public static Notification Show(object content, ShowAnimation showAnimation = ShowAnimation.None, bool staysOpen = false) { var notification = new Notification { Content = content, Opacity = 0, ShowAnimation = showAnimation }; notification.Show(); var desktopWorkingArea = SystemParameters.WorkArea; var leftMax = desktopWorkingArea.Width - notification.ActualWidth; var topMax = desktopWorkingArea.Height - notification.ActualHeight; switch (showAnimation) { case ShowAnimation.None: notification.Opacity = 1; notification.Left = leftMax; notification.Top = topMax; break; case ShowAnimation.HorizontalMove: notification.Opacity = 1; notification.Left = desktopWorkingArea.Width; notification.Top = topMax; notification.BeginAnimation(LeftProperty, AnimationHelper.CreateAnimation(leftMax)); break; case ShowAnimation.verticalMove: notification.Opacity = 1; notification.Left = leftMax; notification.Top = desktopWorkingArea.Height; notification.BeginAnimation(TopProperty, AnimationHelper.CreateAnimation(topMax)); break; case ShowAnimation.Fade: notification.Left = leftMax; notification.Top = topMax; notification.BeginAnimation(OpacityProperty, AnimationHelper.CreateAnimation(1)); break; default: notification.Opacity = 1; notification.Left = leftMax; notification.Top = topMax; break; } if (!staysOpen) { notification.StartTimer(); } return(notification); }
public void Show() { if (FrameX == null) { return; } FrameX.Attach(this); PopupRoot.Open(); ShowAnimation.Begin(); }
private void Refresh() { if (CurrentSong?.Equals(TargetSong) ?? false) { ShowAnimation.Begin(); } else { HideAnimation.Begin(); } }
public static bool IsSlideAnimation(this ShowAnimation showAnimation) { switch (showAnimation) { case ShowAnimation.SlideIn_Bottom: case ShowAnimation.SlideIn_Top: case ShowAnimation.SlideIn_Left: case ShowAnimation.SlideIn_Right: return(true); default: return(false); } }
public async void Show() { Cover.CurrentUri = ViewModel.ActiveSong?.CoverUri; Cover.PreviousUri = ViewModel.PreviousSong?.CoverUri; Cover.NextUri = ViewModel.NextSong?.CoverUri; await SetupCircleCoverAsync(); Window.Current.SetTitleBar(TitleBarHolder); App.SetTitleBarInDarkBackground(); ShowAnimation.Begin(); ConnectedAnimationService.GetForCurrentView().GetAnimation(ConnectedAnimationKeys.SpotlightTransition)?.TryStart(CircleCover); }
public static SlideDirection ToSlideDirection(this ShowAnimation showAnimation) { switch (showAnimation) { case ShowAnimation.SlideIn_Bottom: return(SlideDirection.Bottom); case ShowAnimation.SlideIn_Top: return(SlideDirection.Top); case ShowAnimation.SlideIn_Left: return(SlideDirection.Left); case ShowAnimation.SlideIn_Right: return(SlideDirection.Right); default: return(SlideDirection.Top); } }
protected IEnumerator PlayShowAnimation(ShowAnimation animation, Action onCompleteCallback = null) { // Don't start animating if we're already animating (wait for the animation to finish first) while (_IsAnimating) { yield return(new WaitForEndOfFrame()); } _IsAnimating = true; if (!xmlLayout.IsReady) { yield return(new WaitForEndOfFrame()); } if (ShowAnimationDelay > 0) { CanvasGroup.alpha = 0; yield return(new WaitForSeconds(ShowAnimationDelay)); } CanvasGroup.alpha = DefaultOpacity; CanvasGroup.blocksRaycasts = true; if (animation.IsSlideAnimation()) { m_Animator.enabled = false; yield return(PlaySlideInAnimation(animation)); } else { m_Animator.enabled = true; m_Animator.speed = 0.25f / AnimationDuration; m_Animator.Play(animation.ToString()); var delay = m_Animator.GetCurrentAnimatorStateInfo(0).length / m_Animator.speed; // If we disable the animator immediately after the animation is complete, things get a bit wonky XmlLayoutTimer.DelayedCall(delay, () => { m_Animator.enabled = false; }, this); yield return(new WaitForSeconds(delay * 0.25f)); } _IsAnimating = false; StartCoroutine(WaitForShowAnimationToComplete(onCompleteCallback)); }
protected IEnumerator PlaySlideInAnimation(ShowAnimation animation) { var distance = GetDistanceForSlideAnimation(animation.ToSlideDirection()); if (distance.x != 0) { yield return(MoveDistanceX(distance.x, 0)); yield return(MoveDistanceX(-distance.x, AnimationDuration)); } else if (distance.y != 0) { yield return(MoveDistanceY(distance.y, 0)); yield return(MoveDistanceY(-distance.y, AnimationDuration)); } }
/// <summary> /// 播放展示动画 /// </summary> private void PlayShowAnimation() { ShowAnimation showAnimation = gameObject.GetComponentInChildren <ShowAnimation>(); if (showAnimation == null) { showAnimation = gameObject.GetComponent <ShowAnimation>(); } if (showAnimation != null) { showAnimation.Show(ShowAnimaitionFinish); } else { ShowAnimaitionFinish(); } }
public void Show(bool force = false) { if (force) { AlwaysHidden = false; } if (AlwaysHidden) { return; } if (Song == null) { return; } if (IsHidden == false) { return; } ShowAnimation.Begin(); IsHidden = false; }