Mega Code Archive

 
Categories / VB.Net Tutorial / WPF
 

Matrix animation with path

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"       HorizontalAlignment="Center" VerticalAlignment="Center">     <Canvas>           <Canvas.Resources>             <PathGeometry x:Key="animPath" Figures="M25,75 L 50,0 75,75 60,75 60,100 40,100,40,75Z"/>           </Canvas.Resources>                    <Path Stroke="Blue" StrokeThickness="2" Data="{StaticResource animPath}" />                   <Path Stroke="Black" StrokeThickness="2" Data="M0,0 H20 M15,-5 L20,0 15,5">           <Path.RenderTransform>             <MatrixTransform />           </Path.RenderTransform>                    <Path.Triggers>             <EventTrigger RoutedEvent="Line.Loaded">               <BeginStoryboard>                 <Storyboard>                            <MatrixAnimationUsingPath DoesRotateWithTangent="True"                       RepeatBehavior="Forever" Duration="0:0:15"                       Storyboard.TargetProperty="(Path.RenderTransform).(MatrixTransform.Matrix)"                         PathGeometry="{StaticResource animPath}" />                          </Storyboard>               </BeginStoryboard>             </EventTrigger>           </Path.Triggers>         </Path>          </Canvas>      </Page>