pop up animation

Eduardo Gomez Romero 465 Reputation points
2024-09-28T18:10:20.6733333+00:00

I have an poup that is opening with an animation

 private async void PopUpBorder_Loaded(object sender, EventArgs e) {
     PopUpBorder.Scale = 0.5;
     PopUpBorder.Opacity = 0;
     await Task.WhenAll(new Task[]
     {
          PopUpBorder.ScaleTo(1, 500, Easing.CubicInOut),
          PopUpBorder.FadeTo(1, 500, Easing.CubicInOut)
     });
 }

https://reccloud.com/u/1o1r2a1

but when I close it, it closes from the upper left, and I want to close it from the center
like the way I open it

  private static async Task ExiitAnimation(Popup popup) {
      if (popup.Content is VisualElement popUpBorder) {
          // Set the anchor to the center
          popUpBorder.AnchorX = 0.5;
          popUpBorder.AnchorY = 0.5;
          await Task.WhenAll(new Task[]
          {
              popUpBorder.ScaleTo(0.5, 500, Easing.CubicInOut),
              popUpBorder.FadeTo(0, 500, Easing.CubicInOut)
          });
          popup.Close();
      }
.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,454 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.