I have these two animations here, one to close a slide out grid navigation menu, and the other to set a rectangles fill to transparent as that menu closes.
I would like these to both happen at the same time. Right now the animations happen in the order they are invoked.
How can I implement this as simple and clean as possible using C# code? I am only creating this application to learn about animations and different ways layout controls.
private void _CloseSlideGrid()
{
DoubleAnimation da = new DoubleAnimation();
da.Duration = TimeSpan.FromSeconds(0.3d);
da.DecelerationRatio = 1.0d;
da.From = 500.0d;
da.To = 0.0d;
_slideGrid.BeginAnimation(Grid.WidthProperty, da);
}
private void _DisableTransparentCover()
{
BrushAnimation ba = new BrushAnimation();
ba.Duration = TimeSpan.FromSeconds(0.3d);
ba.DecelerationRatio = 1.0d;
ba.From = _GetBrush("#77000000");
ba.To = _GetBrush("#00000000");
_tranparentCover.BeginAnimation(Rectangle.FillProperty, ba);
}
An event callback for my close button invokes my two private functions that will handle the animations.
private void _NavCloseButton_Click(object sender, RoutedEventArgs e)
{
_CloseSlideGrid();
_DisableTransparentCover();
}
Here is a link to an Imgur album with a screenshot of the two states of my window, if you are intrested: https://i.stack.imgur.com/UEubH.jpg
Let me know if I can provide any more information,
Thanks.