#nullable enable using System; using System.Windows; using System.Windows.Media; using System.Windows.Media.Animation; namespace ReminderOrganizer { /// Subtle open animation for dialogs: fade in + 2 % scale, 140 ms, ease-out. public static class DialogAnimation { public static void Attach(Window window) { window.Opacity = 0; window.Loaded += (_, _) => { var ease = new CubicEase { EasingMode = EasingMode.EaseOut }; var duration = TimeSpan.FromMilliseconds(140); window.BeginAnimation(UIElement.OpacityProperty, new DoubleAnimation(0, 1, duration) { EasingFunction = ease }); if (window.Content is FrameworkElement root) { var scale = new ScaleTransform(0.98, 0.98); root.RenderTransformOrigin = new Point(0.5, 0.5); root.RenderTransform = scale; var anim = new DoubleAnimation(0.98, 1, duration) { EasingFunction = ease }; scale.BeginAnimation(ScaleTransform.ScaleXProperty, anim); scale.BeginAnimation(ScaleTransform.ScaleYProperty, anim); } }; } } }