Skip to content
This repository has been archived by the owner on Aug 17, 2023. It is now read-only.

Commit

Permalink
Added an animation when navigating Gerayis (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
lpeyr committed Feb 19, 2022
1 parent bd70328 commit b73d415
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Gerayis/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ private void InitUI()

CheckButton(BarCodeTabBtn); // Check the start page button
PageContent.Content = Global.BarCodePage;

PageContent.Navigated += (o, e) => AnimatePage();
}

private void CheckButton(Button button)
Expand Down Expand Up @@ -136,5 +138,21 @@ private void PinBtn_Click(object sender, RoutedEventArgs e)
PinBtn.Content = Topmost ? "\uF604" : "\uF602"; // Set text
PinToolTip.Content = Topmost ? Properties.Resources.Unpin : Properties.Resources.Pin; // Set text
}

private void AnimatePage()
{
Storyboard storyboard = new();

ThicknessAnimationUsingKeyFrames t = new();
t.KeyFrames.Add(new SplineThicknessKeyFrame(new(0, 30, 0, 0), KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0))));
t.KeyFrames.Add(new SplineThicknessKeyFrame(new(0), KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0.1))));
t.AccelerationRatio = 0.5;

storyboard.Children.Add(t);

Storyboard.SetTargetName(t, PageContent.Name);
Storyboard.SetTargetProperty(t, new(Frame.MarginProperty));
storyboard.Begin(this);
}
}
}

0 comments on commit b73d415

Please sign in to comment.