Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 24th, 2012  |  syntax: None  |  size: 2.71 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. how can i make this kind of animation in .cs code file?
  2. <Storyboard x:Name="Storyboard1" Completed="Storyboard1_Completed">
  3.         <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="imageBack1">
  4.             <EasingDoubleKeyFrame KeyTime="0:0:0.25" Value="90"/>
  5.             <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/>
  6.         </DoubleAnimationUsingKeyFrames>
  7.         <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="imageBack1">
  8.             <DiscreteObjectKeyFrame KeyTime="0:0:0.25">
  9.                 <DiscreteObjectKeyFrame.Value>
  10.                     <Visibility>Visible</Visibility>
  11.                 </DiscreteObjectKeyFrame.Value>
  12.             </DiscreteObjectKeyFrame>
  13.         </ObjectAnimationUsingKeyFrames>
  14.         <DoubleAnimation Duration="0:0:0.25" To="90" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="image1" d:IsOptimized="True"/>
  15.     </Storyboard>
  16.        
  17. private Timeline CreateFlipAnimation(TimeSpan beginTime, UIElement target, UIElement target2)
  18.     {
  19.         DoubleAnimationUsingKeyFrames animation = new DoubleAnimationUsingKeyFrames(){
  20.             BeginTime = beginTime
  21.         };
  22.  
  23.         //target.Projection = new PlaneProjection();
  24.         Storyboard.SetTargetProperty(animation, new PropertyPath(UIElement.ProjectionProperty));
  25.         Storyboard.SetTarget(animation, target);
  26.         animation.KeyFrames.Add(new EasingDoubleKeyFrame() { KeyTime = kt1, Value = 90 });
  27.         animation.KeyFrames.Add(new EasingDoubleKeyFrame() { KeyTime = kt2, Value = 0 });
  28.  
  29.         ObjectAnimationUsingKeyFrames animation1 = new ObjectAnimationUsingKeyFrames()
  30.         {
  31.             BeginTime = beginTime
  32.         };
  33.         Storyboard.SetTargetProperty(animation1, new PropertyPath(UIElement.VisibilityProperty));
  34.         Storyboard.SetTarget(animation1, target);
  35.         animation1.KeyFrames.Add(new DiscreteObjectKeyFrame() { KeyTime = kt1, Value = Visibility.Visible });
  36.  
  37.         DoubleAnimation animation2 = new DoubleAnimation()
  38.         {
  39.             //Duration = ,
  40.             To = 90
  41.         };
  42.         //target2.Projection = new PlaneProjection();
  43.         Storyboard.SetTargetProperty(animation2, new PropertyPath(UIElement.ProjectionProperty));
  44.         Storyboard.SetTarget(animation2, target2);
  45.  
  46.  
  47.     }
  48.        
  49. <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="imageBack1">
  50.        
  51. target2.Projection = new PlaneProjection();
  52. Storyboard.SetTargetProperty(animation2, new PropertyPath(PlaneProjection.RotationZProperty));
  53. Storyboard.SetTarget(animation2, target2.Projection);