2012-03-03 22 views
0
<Storyboard x:Name="Storyboard1" Completed="Storyboard1_Completed"> 
     <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="imageBack1"> 
      <EasingDoubleKeyFrame KeyTime="0:0:0.25" Value="90"/> 
      <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/> 
     </DoubleAnimationUsingKeyFrames> 
     <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="imageBack1"> 
      <DiscreteObjectKeyFrame KeyTime="0:0:0.25"> 
       <DiscreteObjectKeyFrame.Value> 
        <Visibility>Visible</Visibility> 
       </DiscreteObjectKeyFrame.Value> 
      </DiscreteObjectKeyFrame> 
     </ObjectAnimationUsingKeyFrames> 
     <DoubleAnimation Duration="0:0:0.25" To="90" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="image1" d:IsOptimized="True"/> 
    </Storyboard> 

我正在做這樣的如何在.cs代碼文件中製作這種動畫?

private Timeline CreateFlipAnimation(TimeSpan beginTime, UIElement target, UIElement target2) 
    { 
     DoubleAnimationUsingKeyFrames animation = new DoubleAnimationUsingKeyFrames(){ 
      BeginTime = beginTime 
     }; 

     //target.Projection = new PlaneProjection(); 
     Storyboard.SetTargetProperty(animation, new PropertyPath(UIElement.ProjectionProperty)); 
     Storyboard.SetTarget(animation, target); 
     animation.KeyFrames.Add(new EasingDoubleKeyFrame() { KeyTime = kt1, Value = 90 }); 
     animation.KeyFrames.Add(new EasingDoubleKeyFrame() { KeyTime = kt2, Value = 0 }); 

     ObjectAnimationUsingKeyFrames animation1 = new ObjectAnimationUsingKeyFrames() 
     { 
      BeginTime = beginTime 
     }; 
     Storyboard.SetTargetProperty(animation1, new PropertyPath(UIElement.VisibilityProperty)); 
     Storyboard.SetTarget(animation1, target); 
     animation1.KeyFrames.Add(new DiscreteObjectKeyFrame() { KeyTime = kt1, Value = Visibility.Visible }); 

     DoubleAnimation animation2 = new DoubleAnimation() 
     { 
      //Duration = , 
      To = 90 
     }; 
     //target2.Projection = new PlaneProjection(); 
     Storyboard.SetTargetProperty(animation2, new PropertyPath(UIElement.ProjectionProperty)); 
     Storyboard.SetTarget(animation2, target2); 


    } 

的東西,現在我不知道我怎樣才能把這個.cs文件

 <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="imageBack1"> 

我評論過的部分,因此告訴我怎麼能我繼續這... ...? 也在持續時間我應該如何初始化值...

回答

0

好消息:你幾乎做正確的事情已經!

此Ruby腳本做大量的動畫像你正在尋找做:http://script.iron7.com/#/Script/Detail?scriptId=81baa9940368436c8244ab7810331b65&userLowerCaseName=iron7

視頻 - http://www.youtube.com/watch?v=5k8SG82e1Rc

的代碼基本上沒有等價的:

target2.Projection = new PlaneProjection(); 
Storyboard.SetTargetProperty(animation2, new PropertyPath(PlaneProjection.RotationZProperty)); 
Storyboard.SetTarget(animation2, target2.Projection); 

用於設置時間,您可以在DoubleAnimation中使用持續時間設置 - 或在DoubleAnimationUsingKeyFrame中的KeyFrame KeyTimes中設置該參數

+0

感謝您的幫助... – user1235555 2012-03-06 05:11:39

相關問題