Skip to content

Commit

Permalink
优化动画
Browse files Browse the repository at this point in the history
  • Loading branch information
STBBRD committed May 4, 2024
1 parent b64f38d commit a01d37f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ZongziTEK_Blackboard_Sticker/FullScreenClock.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
xmlns:local="clr-namespace:ZongziTEK_Blackboard_Sticker"
mc:Ignorable="d"
Title="ZongziTEK 黑板贴 - 全屏时钟" Height="450" Width="800" Top="0" Left="0" Margin="0,0,2,0"
ResizeMode="NoResize" WindowStyle="None" WindowState="Maximized" Loaded="Window_Loaded">
ResizeMode="NoResize" WindowStyle="None" WindowState="Maximized" Loaded="Window_Loaded" AllowsTransparency="True">
<Grid Background="Black" MouseDown="Grid_MouseDown">
<Grid>
<Viewbox Name="ViewboxClock" Margin="100">
Expand Down
21 changes: 20 additions & 1 deletion ZongziTEK_Blackboard_Sticker/FullScreenClock.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,27 @@ private async void Grid_MouseDown(object sender, MouseButtonEventArgs e)
}
}

private void BorderCloseBigClock_MouseDown(object sender, MouseButtonEventArgs e)
private async void BorderCloseBigClock_MouseDown(object sender, MouseButtonEventArgs e)
{
DoubleAnimation opacityAnimation = new()
{
From = 1,
To = 0,
Duration = TimeSpan.FromMilliseconds(500),
EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseIn }
};
BeginAnimation(OpacityProperty, opacityAnimation);

ThicknessAnimation clockMarginAnimation = new()
{
From = new Thickness(100),
To = new Thickness(-48),
Duration = TimeSpan.FromMilliseconds(400),
EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseIn }
};
ViewboxClock.BeginAnimation(MarginProperty, clockMarginAnimation);

await Task.Delay(500);
Close();
}
}
Expand Down
2 changes: 1 addition & 1 deletion ZongziTEK_Blackboard_Sticker/LauncherEditor.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Window x:Class="ZongziTEK_Blackboard_Sticker.LauncherEditor"
<Window Name="window" x:Class="ZongziTEK_Blackboard_Sticker.LauncherEditor"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
Expand Down
2 changes: 1 addition & 1 deletion ZongziTEK_Blackboard_Sticker/LauncherEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ private void ButtonNew_Click(object sender, RoutedEventArgs e)

ThicknessAnimation gridInsertMarginAnimation = new()
{
From = new Thickness(-48),
From = new Thickness(0, 72, 0, -72),
To = new Thickness(0),
Duration = TimeSpan.FromMilliseconds(500),
EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut }
Expand Down

0 comments on commit a01d37f

Please sign in to comment.