Squeeze Ball Animation in XAML

This animation start with ball in Image 1 and ends with ball in Image 2 and continues indefinitely.

Image 1.

Image 2.

Providing this animation in XAML is simply Stodyboard DoubleAnimation with changing TargetProperty Height from 100 to 200 and repeat it forever.

Here is the sample XAML code:

<Window
 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 x:Class="AnimationXAML.Window1"
 x:Name="Window"
 Title="Window1"
 Width="640" Height="480">
 <Grid x:Name="LayoutRoot" Margin="10" >
 <Ellipse
   Name="RedBall"
   Width="200"
   Height="200"
   Fill="Red"> 
   <Ellipse.Triggers>
     <EventTrigger RoutedEvent="Ellipse.Loaded">
       <BeginStoryboard>
         <Storyboard>
           <DoubleAnimation
             Storyboard.TargetName="RedBall"
             Storyboard.TargetProperty="Height"
             From="100" To="200" Duration="0:0:5"
    AutoReverse="True"  RepeatBehavior="Forever"/>   
      </Storyboard>
       </BeginStoryboard>
     </EventTrigger>
   </Ellipse.Triggers>
 </Ellipse>
  </Grid>
</Window>
Mindcracker
Founded in 2003, Mindcracker is the authority in custom software development and innovation. We put best practices into action. We deliver solutions based on consumer and industry analysis.