Mega Code Archive

 
Categories / VB.Net Tutorial / WPF
 

Rotate in a circle, then flip, when clicked

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">     <Button Name="myAnimatedButton" Width="120" Height = "40" RenderTransformOrigin="0.5,0.5" Content = "OK">        <Button.RenderTransform>         <RotateTransform Angle="0"/>       </Button.RenderTransform>       <Button.Triggers>         <EventTrigger RoutedEvent="Button.Click">           <BeginStoryboard>             <Storyboard>               <DoubleAnimationUsingKeyFrames                 Storyboard.TargetName="myAnimatedButton"                 Storyboard.TargetProperty="(Button.RenderTransform).(RotateTransform.Angle)"                 Duration="0:0:2" FillBehavior="Stop">                 <DoubleAnimationUsingKeyFrames.KeyFrames>                   <LinearDoubleKeyFrame Value="360" KeyTime="0:0:1" />                   <DiscreteDoubleKeyFrame Value="180" KeyTime="0:0:1.5" />                                 </DoubleAnimationUsingKeyFrames.KeyFrames>               </DoubleAnimationUsingKeyFrames>                        </Storyboard>           </BeginStoryboard>         </EventTrigger>       </Button.Triggers>      </Button> </Page>