2012-08-03 45 views
0

我創建了一個Storyboard來爲我的Canvas上以編程方式放置的圖像控件進行動畫製作。故事板是在Expression Blend中創建的。故事板WP7 - 座標

當我玩故事板時,圖像消失,並在其他地方動畫(我最終看到圖像控制最後飛入)。它不會動畫我放置圖像的位置。 Storyboard的作品,但它不動畫我想讓它動畫的地方。 控制器假設在屏幕的底部和特定圖像的右側進行動畫處理。這就是爲什麼我通過代碼改變圖像的位置。

這裏是XML:

<Storyboard x:Name="sbBagExit"> 
     <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.SkewX)" Storyboard.TargetName="imgBag"> 
      <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="11"/> 
      <EasingDoubleKeyFrame KeyTime="0:0:0.7" Value="10.9973"/> 
     </DoubleAnimationUsingKeyFrames> 
     <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="imgBag"> 
      <EasingDoubleKeyFrame KeyTime="0" Value="332"/> 
      <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="332"/> 
      <EasingDoubleKeyFrame KeyTime="0:0:0.7" Value="332"/> 
     </DoubleAnimationUsingKeyFrames> 
     <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="imgBag"> 
      <EasingDoubleKeyFrame KeyTime="0" Value="-16"/> 
      <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0"/> 
      <EasingDoubleKeyFrame KeyTime="0:0:0.7" Value="169.983"/> 
     </DoubleAnimationUsingKeyFrames> 
    </Storyboard> 
    <Storyboard x:Name="sbBagDrop"> 
     <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="imgBag"> 
      <EasingDoubleKeyFrame KeyTime="0" Value="0"/> 
      <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="0"/> 
      <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/> 
     </DoubleAnimationUsingKeyFrames> 
     <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="imgBag"> 
      <EasingDoubleKeyFrame KeyTime="0" Value="-172"/> 
      <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="332.001"/> 
      <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="344"/> 
      <EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="332"/> 
     </DoubleAnimationUsingKeyFrames> 
     <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="imgBag"> 
      <EasingDoubleKeyFrame KeyTime="0" Value="-8"/> 
      <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="-8"/> 
      <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/> 
      <EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="-8"/> 
     </DoubleAnimationUsingKeyFrames> 
     <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)" Storyboard.TargetName="imgBag"> 
      <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="1"/> 
      <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0.829"/> 
      <EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="1"/> 
     </DoubleAnimationUsingKeyFrames> 
     <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)" Storyboard.TargetName="imgBag"> 
      <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="1"/> 
      <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1.2"/> 
      <EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="1"/> 
     </DoubleAnimationUsingKeyFrames> 
    </Storyboard> 

第二個故事板後的第一個直接反應。

我一直在撓我的頭好好兩個星期....任何人都可以看到我不能?

非常感謝您提前。

回答

0

因爲您使用Blend生成動畫,Blend基於座標中的From和To屬性的值以及Blend中使用的元素的佈局。

這包括其容器和邊距。

因爲你沒有指定所需的座標,我不能告訴你什麼是錯的。

我會從更改TranslateX和TranslateY開始,找出他們做什麼以及什麼時候做我想讓他們做的事情。

+0

如何在Expression Blend中創建它,以便我不會出現此錯誤? – Subby 2012-08-03 20:40:14

+0

使容器和元素與您應用的元素完全相同。我更喜歡只使用相對座標,因此動畫的By屬性或只有To屬性(沒有指定From屬性)被設置。這可以防止那些奇怪的300號碼。 – 2012-08-03 20:47:07