If it were me. I would use the LinearGradient animation to fill your border without using another object, such as Path, to achieve this effect. So just a quick and messy example. Something like that;
Our storyboard is for controlling the StartPoint / EndPoint gradient to bring it at an angle;
<Storyboard x:Key="Curtain"> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Offset)" Storyboard.TargetName="border"> <EasingDoubleKeyFrame KeyTime="0:0:1" Value="1"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[0].(GradientStop.Offset)" Storyboard.TargetName="border"> <EasingDoubleKeyFrame KeyTime="0:0:1" Value="1"/> </DoubleAnimationUsingKeyFrames> </Storyboard>
Then our border:
<Border x:Name="border" BorderBrush="Blue" BorderThickness="1" Height="200" Width="350"> <Border.Background> <LinearGradientBrush EndPoint="0.964,0.992" StartPoint="0.017,0.019"> <GradientStop Color="#FFF90202" Offset="0"/> <GradientStop Offset="0.001"/> </LinearGradientBrush> </Border.Background> </Border>
Thus, it doesn't matter if your CornerRadius is installed, or if you want a fantasy, you can do the same on any shape or path, regardless of its geometry, and evenly distribute the area during its animation. However, Border will need a higher z-index or lower placement in the DOM to display on top of the content.
You probably want to change the values in StartPoint / EndPoint and KeyTime to get exactly what you want, but it was just a quick 60sec example to convey the concept.
Hope this helps, cheers!
Chris W.
source share