2012-03-03 3 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

Хорошая новость: вы уже почти правы!

Этот скрипт рубин делает много анимации, как вы хотите сделать: 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); 

Для установки длительности, вы можете просто установить это значение, используя Duration в DoubleAnimation, или в KeyFrame KeyTimes в DoubleAnimationUsingKeyFrames

+0

спасибо за вашу помощь ... – user1235555

Смежные вопросы