title: How to change object's Y projection axis and color via C# rather than XAML
body: <p>I'm working on a Silverlight project where I will be 'flipping' rectangles by rotating them on the Y projection axis. I will also change to color in the middle of the animation so that it looks like the back side of the rectangle is a different color. I can do this in XAML no problem however I need to do this via code because I want to dynamically flip different rectangles. I don't want to have to create an animation for each rectangle on the grid. Here's what my XAML looks like:</p>
  
  <pre><code>&lt;Storyboard x:Name="Flip1"&gt;
              &lt;DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="rectangle"&gt;
                  &lt;EasingDoubleKeyFrame KeyTime="0" Value="0"/&gt;
                  &lt;EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="-90"/&gt;
                  &lt;EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="-90"/&gt;
                  &lt;EasingDoubleKeyFrame KeyTime="0:0:1" Value="0"/&gt;
              &lt;/DoubleAnimationUsingKeyFrames&gt;
              &lt;ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="rectangle"&gt;
                  &lt;EasingColorKeyFrame KeyTime="0:0:0.5" Value="Blue"/&gt;
                  &lt;EasingColorKeyFrame KeyTime="0:0:0.6" Value="Red"/&gt;
              &lt;/ColorAnimationUsingKeyFrames&gt;
          &lt;/Storyboard&gt;
  </code></pre>
  
  <p>I've created storyboards from code several times however this one is leaving me a bit stumped with the EasingDoubleKeyFrames. Any ideas how to go about doing this?</p>