Mega Code Archive

 
Categories / VB.Net Tutorial / WPF
 

Simple Key Frame Animation

<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">     <Ellipse Name="elips"              Width="48" Height="48" Fill="Red"              Canvas.Left="480" Canvas.Top="96" />     <Canvas.Triggers>         <EventTrigger RoutedEvent="Canvas.Loaded">             <BeginStoryboard>                 <Storyboard TargetName="elips" TargetProperty="(Canvas.Left)">                     <DoubleAnimationUsingKeyFrames RepeatBehavior="Forever"                                                    Duration="0:0:10">                         <LinearDoubleKeyFrame KeyTime="0:0:5" Value="0" />                         <LinearDoubleKeyFrame KeyTime="0:0:5.5" Value="48" />                         <DiscreteDoubleKeyFrame KeyTime="0:0:6" Value="144" />                         <DiscreteDoubleKeyFrame KeyTime="0:0:7" Value="240" />                     </DoubleAnimationUsingKeyFrames>                 </Storyboard>             </BeginStoryboard>         </EventTrigger>     </Canvas.Triggers> </Canvas>