Hello,
Welcome to Microsoft Q&A.
What I want to do is fade this path in from left right in a Storyboard, but I'm not sure how I can achieve it.
According to your needs, the effect requires two variables to control, one is Opacity
(from 0 to 1) and the other is TranslateX
(from left to right)
Here is a sample:
PathPage.xaml
<Page.Resources>
<Storyboard x:Name="PathInAnimation">
<DoubleAnimation From="0"
To="1"
Duration="00:00:00.5"
Storyboard.TargetName="cameraWestPath"
Storyboard.TargetProperty="Opacity"
>
<DoubleAnimation.EasingFunction>
<PowerEase EasingMode="EaseOut"></PowerEase>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
<DoubleAnimation From="-45"
To="0"
Duration="00:00:00.5"
Storyboard.TargetName="cameraWestPath"
Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)"
>
<DoubleAnimation.EasingFunction>
<PowerEase EasingMode="EaseOut"></PowerEase>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</Page.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Path x:Name="cameraWestPath" StrokeThickness="1" Fill="Green" RenderTransformOrigin="0.46,0.61" Visibility="Visible" Opacity="0">
<Path.RenderTransform>
<CompositeTransform TranslateX="-45" Rotation="315"/>
</Path.RenderTransform>
<Path.Data>
<PathGeometry>
<PathGeometry.Figures>
<PathFigure StartPoint="0,45" >
<PathFigure.Segments>
<ArcSegment Size="45,45" RotationAngle="45" IsLargeArc="False" SweepDirection="Clockwise" Point="45,0"/>
<LineSegment Point="45,45"/>
<LineSegment Point="0,45"/>
</PathFigure.Segments>
</PathFigure >
</PathGeometry.Figures>
</PathGeometry>
</Path.Data>
</Path>
<Button x:Name="ShowButton" Click="ShowButton_Click" Grid.Row="1"
Content="Start Animation"/>
</Grid>
PathPage.xaml.cs
private void ShowButton_Click(object sender, RoutedEventArgs e)
{
PathInAnimation.Begin();
}
Thanks.
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.