/// <summary> /// 控件窗口消失动画 /// </summary> public static void UIElementGo(UIElement uIElement, ScaleTransform _scale) { PennerDoubleAnimation da = new PennerDoubleAnimation() { From = 1, To = 0.9, Equation = Equations.BackEaseIn, FillBehavior = FillBehavior.Stop, Duration = TimeSpan.FromSeconds(0.5) }; da.Completed += delegate { _scale.ScaleX = 1; _scale.ScaleY = 1; }; DoubleAnimation daO = new DoubleAnimation() { From = 1, To = 0, FillBehavior = FillBehavior.Stop, Duration = TimeSpan.FromSeconds(0.5) }; daO.Completed += delegate { uIElement.Opacity = 0; if (UIElementGoFinished != null) { UIElementGoFinished(uIElement, new EventArgs()); } }; _scale.BeginAnimation(ScaleTransform.ScaleXProperty, da); _scale.BeginAnimation(ScaleTransform.ScaleYProperty, da); uIElement.BeginAnimation(UIElement.OpacityProperty, daO); }
/// <summary> /// 控件窗口弹出动画 /// </summary> public static void UIElementCome(UIElement uIElement, ScaleTransform _scale) { PennerDoubleAnimation da = new PennerDoubleAnimation() { From = 0.8, To = 1, Equation = Equations.BackEaseOut, FillBehavior = FillBehavior.Stop, Duration = TimeSpan.FromSeconds(0.5) }; da.Completed += delegate { _scale.ScaleX = 1; _scale.ScaleY = 1; }; DoubleAnimation daO = new DoubleAnimation() { From = 0, To = 1, FillBehavior = FillBehavior.Stop, Duration = TimeSpan.FromSeconds(0.7) }; daO.Completed += delegate { uIElement.Opacity = 1; }; _scale.BeginAnimation(ScaleTransform.ScaleXProperty, da); _scale.BeginAnimation(ScaleTransform.ScaleYProperty, da); uIElement.BeginAnimation(UIElement.OpacityProperty, daO); }
private void ReadAllLaw() { this.BeginAnimation(OpacityProperty, new DoubleAnimation() { From = 0, To = 1, Duration = TimeSpan.FromSeconds(1) }); PennerDoubleAnimation daScale = new PennerDoubleAnimation() { From = 0, To = 1, Equation = Equations.BackEaseOut, Duration = TimeSpan.FromSeconds(1) }; _scale.BeginAnimation(ScaleTransform.ScaleYProperty, daScale); var lawpath = System.IO.Path.Combine(Directory.GetCurrentDirectory() + "lawText.txt"); if (File.Exists(lawpath)) { String st = File.ReadAllText(Directory.GetCurrentDirectory() + "\\lawText.txt", UnicodeEncoding.GetEncoding("GB2312")); _text.Text = st; } else { Console.WriteLine(lawpath + " 不存在..."); } }
private void MoveXY(SelectedBorder element, double toX, double toY, double width, double height) { PennerDoubleAnimation daX = new PennerDoubleAnimation() { To = toX, Equation = Equations.QuartEaseOut, Duration = TimeSpan.FromSeconds(0.5) }; PennerDoubleAnimation daY = new PennerDoubleAnimation() { To = toY, Equation = Equations.QuartEaseOut, Duration = TimeSpan.FromSeconds(0.5) }; PennerDoubleAnimation daW = new PennerDoubleAnimation() { To = width, Equation = Equations.QuintEaseOut, Duration = TimeSpan.FromSeconds(0.3) }; PennerDoubleAnimation daH = new PennerDoubleAnimation() { To = height, Equation = Equations.QuintEaseOut, Duration = TimeSpan.FromSeconds(0.3) }; element.BeginAnimation(Canvas.LeftProperty, daX); element.BeginAnimation(Canvas.TopProperty, daY); element.BeginAnimation(WidthProperty, daW); element.BeginAnimation(HeightProperty, daH); }
public void WinDisAppear() { PennerDoubleAnimation da = new PennerDoubleAnimation() { From = 1, To = 0.9, Equation = Equations.BackEaseIn, FillBehavior = FillBehavior.Stop, Duration = TimeSpan.FromSeconds(0.5) }; da.Completed += delegate { _scale.ScaleX = 1; _scale.ScaleY = 1; }; DoubleAnimation daO = new DoubleAnimation() { From = 1, To = 0, FillBehavior = FillBehavior.Stop, Duration = TimeSpan.FromSeconds(0.5) }; daO.Completed += delegate { Opacity = 0; //Close(); MainWindow.ShowMessageWin.Children.Clear(); MainWindow.ShowMessageWin.Visibility = Visibility.Collapsed; }; _scale.BeginAnimation(ScaleTransform.ScaleXProperty, da); _scale.BeginAnimation(ScaleTransform.ScaleYProperty, da); BeginAnimation(OpacityProperty, daO); }
public void WinAppear() { MainWindow.ShowMessageWin.Children.Add(this); MainWindow.ShowMessageWin.Visibility = Visibility.Visible; PennerDoubleAnimation da = new PennerDoubleAnimation() { From = 0.8, To = 1, Equation = Equations.BackEaseOut, FillBehavior = FillBehavior.Stop, Duration = TimeSpan.FromSeconds(0.5) }; da.Completed += delegate { _scale.ScaleX = 1; _scale.ScaleY = 1; }; DoubleAnimation daO = new DoubleAnimation() { From = 0, To = 1, FillBehavior = FillBehavior.Stop, Duration = TimeSpan.FromSeconds(0.7) }; daO.Completed += delegate { Opacity = 1; }; _scale.BeginAnimation(ScaleTransform.ScaleXProperty, da); _scale.BeginAnimation(ScaleTransform.ScaleYProperty, da); BeginAnimation(OpacityProperty, daO); }
/// <summary> /// Enumeration of all easing equations. /// </summary> private static void OnEquationChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { PennerDoubleAnimation anim = d as PennerDoubleAnimation; anim._interpolator = GetInterpolator((Equations)e.NewValue); }
private void MoveToX(PopCell Cell, double toX, Equations equation) { isAnimating = true; PennerDoubleAnimation daX = new PennerDoubleAnimation() { To = toX, Equation = equation, FillBehavior = FillBehavior.Stop, Duration = TimeSpan.FromSeconds(0.7) }; if (equation == Equations.QuadEaseOut) { daX.Duration = TimeSpan.FromSeconds(1); } daX.Completed += delegate { Cell.X = toX; isAnimating = false; }; Cell.BeginAnimation(Canvas.LeftProperty, daX); }
private void BarCome() { PennerDoubleAnimation daScaleY = new PennerDoubleAnimation() { From = 0, To = 1, FillBehavior = FillBehavior.Stop, Equation = Equations.BackEaseOut, Duration = TimeSpan.FromSeconds(0.5) }; daScaleY.Completed += delegate { scaleGrid.ScaleY = 1; if (BarReadyEvent != null) { BarReadyEvent(this, new EventArgs()); } }; scaleGrid.BeginAnimation(ScaleTransform.ScaleYProperty, daScaleY); }
public void BarGo() { SettingStage.CurrentStage = StageEnum.MainFace; PennerDoubleAnimation daScaleY = new PennerDoubleAnimation() { To = 0, Equation = Equations.BackEaseIn, FillBehavior = FillBehavior.Stop, Duration = TimeSpan.FromSeconds(0.5) }; daScaleY.Completed += delegate { scaleGrid.ScaleY = 0; SettingStage.PopGrid.Visibility = Visibility.Collapsed; //SettingStage.CurrentStage = StageEnum.MainFace; Utility.RemoveUIElement(this); //DispatcherTimer dtX = new DispatcherTimer(); //dtX.Interval = TimeSpan.FromSeconds(0.1); //dtX.Tick += delegate //{ // dtX.Stop(); // Utility.RemoveUIElement(this); // if (!isFailed) // { // if (LoadFinished != null) // { // LoadFinished(this, new EventArgs()); // } // } //}; //dtX.Start(); }; daScaleY.BeginTime = TimeSpan.FromSeconds(0.5); scaleGrid.BeginAnimation(ScaleTransform.ScaleYProperty, daScaleY); }
private void MoveTo() { double x = ListX[SelectedIndex]; double tox = x - showR.Width / 2.0 + 7; Utility.PlaySound("clickMove"); PennerDoubleAnimation daX = new PennerDoubleAnimation() { To = tox, Equation = Equations.QuartEaseOut, Duration = TimeSpan.FromSeconds(0.5) }; showR.BeginAnimation(Canvas.LeftProperty, daX); //Canvas.SetLeft(showR, x - showR.Width / 2.0+15); text.Text = ListResolution[SelectedIndex].width.ToString() + "*" + ListResolution[SelectedIndex].height.ToString(); DoubleAnimation daO = new DoubleAnimation() { From = 0, To = 1, Duration = TimeSpan.FromSeconds(0.5) }; text.BeginAnimation(OpacityProperty, daO); }
/// <summary> /// 显示文字提示 /// </summary> private void PlateShow() { dt0.Stop(); dt0.Interval = TimeSpan.FromSeconds(2); gradien1.Offset = 1; this.Visibility = Visibility.Visible; PennerDoubleAnimation daY = new PennerDoubleAnimation() { From = -20, To = 0, Equation = Equations.BackEaseOut, FillBehavior = FillBehavior.Stop, Duration = TimeSpan.FromSeconds(0.5) }; DoubleAnimation daO = new DoubleAnimation() { From = 0, To = 1, FillBehavior = FillBehavior.Stop, Duration = TimeSpan.FromSeconds(0.5) }; daY.Completed += delegate { translate.Y = 0; Opacity = 1; gradient.Offset = 1; dt0.Tick += delegate { dt0.Stop(); #region 后续隐藏提示文字 daY = new PennerDoubleAnimation() { From = 0, To = -20, Equation = Equations.BackEaseIn, FillBehavior = FillBehavior.Stop, Duration = TimeSpan.FromSeconds(0.5) }; daO = new DoubleAnimation() { From = 1, To = 0, FillBehavior = FillBehavior.Stop, Duration = TimeSpan.FromSeconds(0.5) }; daO.Completed += delegate { translate.Y = -20; Opacity = 0; //gradien1.Offset = 0; this.Visibility = Visibility.Collapsed; }; translate.BeginAnimation(TranslateTransform.YProperty, daY); BeginAnimation(OpacityProperty, daO); #endregion }; dt0.Start(); }; translate.BeginAnimation(TranslateTransform.YProperty, daY); BeginAnimation(OpacityProperty, daO); gradient.BeginAnimation(GradientStop.OffsetProperty, daO); }