title: Blinking animation WPF
body: <p>I have this animation with me, a sort of blinking animation, such that when the button is clicked, the rectangle "blinks". I've written a code for the animation, just wanted to know if there is a better way to achieve this animation. Any suggestions? </p>
  
  <p>Code is as below:</p>
  
  <pre><code>    &lt;Window.Resources&gt;
      &lt;Storyboard x:Key="OnClick1"&gt;
          &lt;ObjectAnimationUsingKeyFrames Duration="0:0:10" Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="rectangle"&gt;
              &lt;DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Collapsed}"/&gt;
              &lt;DiscreteObjectKeyFrame KeyTime="0:0:0.1" Value="{x:Static Visibility.Visible}"/&gt;
              &lt;DiscreteObjectKeyFrame KeyTime="0:0:0.2" Value="{x:Static Visibility.Collapsed}"/&gt;
              &lt;DiscreteObjectKeyFrame KeyTime="0:0:0.3" Value="{x:Static Visibility.Visible}"/&gt;
              &lt;DiscreteObjectKeyFrame KeyTime="0:0:0.4" Value="{x:Static Visibility.Collapsed}"/&gt;
              &lt;DiscreteObjectKeyFrame KeyTime="0:0:0.5" Value="{x:Static Visibility.Visible}"/&gt;
              &lt;DiscreteObjectKeyFrame KeyTime="0:0:0.6" Value="{x:Static Visibility.Collapsed}"/&gt;
              &lt;DiscreteObjectKeyFrame KeyTime="0:0:0.7" Value="{x:Static Visibility.Visible}"/&gt;
              &lt;DiscreteObjectKeyFrame KeyTime="0:0:0.8" Value="{x:Static Visibility.Collapsed}"/&gt;
              &lt;DiscreteObjectKeyFrame KeyTime="0:0:0.9" Value="{x:Static Visibility.Visible}"/&gt;
          &lt;/ObjectAnimationUsingKeyFrames&gt;
      &lt;/Storyboard&gt;
  &lt;/Window.Resources&gt;
  &lt;Window.Triggers&gt;
      &lt;EventTrigger RoutedEvent="ButtonBase.Click" SourceName="button"&gt;
          &lt;BeginStoryboard Storyboard="{StaticResource OnClick1}"/&gt;
      &lt;/EventTrigger&gt;
  &lt;/Window.Triggers&gt;
  
  &lt;Grid x:Name="LayoutRoot"&gt;
      &lt;Rectangle x:Name="rectangle" Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="35" Margin="129,166,0,0" Stroke="Black" VerticalAlignment="Top" Width="73"/&gt;
      &lt;Button x:Name="button" Content="Button" Margin="272,158,263,0" Height="37" VerticalAlignment="Top"/&gt;
  &lt;/Grid&gt;
  </code></pre>