void UpdateTransformYAnimation(double animationTranformTimeSpan) { var positionAnimation = AnimationFactory.CreateDoubleAnimation(this, TranslateTransform.YProperty, -_currentYoffSet, durationSpan: TimeSpan.FromMilliseconds(animationTranformTimeSpan), easingFuction: EasingFunction); positionAnimation.Completed += PositionYAnimationCompleted; RenderTransform.BeginAnimation(TranslateTransform.YProperty, positionAnimation); }
public void Close() { OnClose(); // Prevent any interaction from happening during the animation IsHitTestVisible = false; var scale = (ScaleTransform)RenderTransform; scale.CenterX = ActualWidth / 2; scale.CenterY = ActualHeight / 2; var fadeOut = new DoubleAnimation(0, FadeOutDuration); var shrink = new DoubleAnimation(0.8, FadeOutDuration); fadeOut.Completed += delegate { var manager = (ChildWindowManager)Parent; if (manager == null) { return; } manager.Hide(this); }; RenderTransform.BeginAnimation(ScaleTransform.ScaleXProperty, shrink); RenderTransform.BeginAnimation(ScaleTransform.ScaleYProperty, shrink); BeginAnimation(OpacityProperty, fadeOut, HandoffBehavior.SnapshotAndReplace); }
private void Window_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { if (((bool)e.NewValue) != true) { return; } BeginAnimation(OpacityProperty, new DoubleAnimation(0, 1, TimeSpan.FromMilliseconds(200)) { EasingFunction = new QuadraticEase() }); RenderTransform.BeginAnimation(ScaleTransform.ScaleXProperty, new DoubleAnimation(.5, 1, TimeSpan.FromMilliseconds(500)) { EasingFunction = new ElasticEase() { Oscillations = 1 } }); RenderTransform.BeginAnimation(ScaleTransform.ScaleYProperty, new DoubleAnimation(.5, 1, TimeSpan.FromMilliseconds(500)) { EasingFunction = new ElasticEase() { Oscillations = 1 } }); }
public void Hide() { var animation = new DoubleAnimation { To = -MenuWidth, Duration = TimeSpan.FromMilliseconds(100) }; RenderTransform.BeginAnimation(TranslateTransform.XProperty, animation); _isShown = false; (FindName("ShadowColumn") as ColumnDefinition).Width = new GridLength(0); }
public void Show() { var animation = new DoubleAnimation { From = -MenuWidth * .85, To = 0, Duration = TimeSpan.FromMilliseconds(100) }; RenderTransform.BeginAnimation(TranslateTransform.XProperty, animation); _isShown = true; var p = Parent as Panel; (FindName("ShadowColumn") as ColumnDefinition).Width = new GridLength(10000); }
public void Show() { var animation = new DoubleAnimation { To = 0, Duration = TimeSpan.FromMilliseconds(AnimationTime) }; RenderTransform.BeginAnimation(TranslateTransform.XProperty, animation); ShadowColumn.Width = new GridLength(10000); _isShown = true; }
private void Animate(Transform newValue, TransitionSpeed transitionSpeed) { var duration = TransitionSpeedToDuration(transitionSpeed); var matrixAnimation = new MatrixAnimation(newValue.Value, duration, FillBehavior.HoldEnd) { EasingFunction = GetEasingFunction(transitionSpeed) }; Timeline.SetDesiredFrameRate(matrixAnimation, FrameRate); RenderTransform.BeginAnimation(MatrixTransform.MatrixProperty, matrixAnimation, HandoffBehavior.SnapshotAndReplace); }
protected override void OnVisualParentChanged(DependencyObject oldParent) { // The window is added to the visual tree -> perform a small animation var scale = (ScaleTransform)RenderTransform; scale.CenterX = Width / 2; scale.CenterY = Height / 2; var fadeIn = new DoubleAnimation(0, 1, FadeOutDuration, FillBehavior.Stop); var expand = new DoubleAnimation(0.8, 1, FadeOutDuration, FillBehavior.Stop); RenderTransform.BeginAnimation(ScaleTransform.ScaleXProperty, expand); RenderTransform.BeginAnimation(ScaleTransform.ScaleYProperty, expand); BeginAnimation(OpacityProperty, fadeIn); base.OnVisualParentChanged(oldParent); }
public void Hide() { var animation = new DoubleAnimation { To = GetHidePositionX(), Duration = TimeSpan.FromMilliseconds(AnimationTime) }; RenderTransform.BeginAnimation(TranslateTransform.XProperty, animation); ShadowColumn.Width = new GridLength(0); IsOverlayVisible = false; _isShown = false; }
private void GoPage(int pageIndex) { if (pageIndex > PageCount - 1 || pageIndex < 0) { return; } DoubleAnimation moveAnimation = new DoubleAnimation { To = -(pageIndex) * ActualWidth, DecelerationRatio = 0.3, AccelerationRatio = 0.3, Duration = TimeSpan.FromMilliseconds(500) }; RenderTransform.BeginAnimation(TranslateTransform.XProperty, moveAnimation); }
private void VanguardInfoPopup_Loaded(object sender, RoutedEventArgs e) { var ease = new ElasticEase() { Oscillations = 1 }; var time = TimeSpan.FromMilliseconds(500); var time2 = TimeSpan.FromMilliseconds(250); var an = new DoubleAnimation(.95, 1, time) { EasingFunction = ease }; var an2 = new DoubleAnimation(0, 1, time2); RenderTransform.BeginAnimation(ScaleTransform.ScaleXProperty, an); BeginAnimation(OpacityProperty, an2); }
private void Button_Click(object sender, RoutedEventArgs e) { if (sender == BtnOk) { _result = MessageBoxResult.OK; } else if (sender == BtnYes) { _result = MessageBoxResult.Yes; } else if (sender == BtnNo) { _result = MessageBoxResult.No; } else if (sender == BtnCancel) { _result = MessageBoxResult.Cancel; } else { _result = MessageBoxResult.None; } BeginAnimation(OpacityProperty, new DoubleAnimation(0, TimeSpan.FromMilliseconds(200)) { EasingFunction = new QuadraticEase() }); RenderTransform.BeginAnimation(ScaleTransform.ScaleXProperty, new DoubleAnimation(1, .8, TimeSpan.FromMilliseconds(250)) { EasingFunction = new QuadraticEase() }); RenderTransform.BeginAnimation(ScaleTransform.ScaleYProperty, new DoubleAnimation(1, .8, TimeSpan.FromMilliseconds(250)) { EasingFunction = new QuadraticEase() }); Task.Delay(250).ContinueWith(t => { Dispatcher.Invoke(() => { _messageBox.Hide(); //_messageBox = null; }); }); }
private void DontAnimate(Transform newTransform) { RenderTransform.BeginAnimation(MatrixTransform.MatrixProperty, null); ((MatrixTransform)RenderTransform).Matrix = newTransform.Value; }