我创建了一个故事板来为一个图像控件设置动画,该图像控件以编程方式放置在我的画布上。故事板是在 Expression Blend 中创建的。
当我播放 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>
第二个故事板发生在第一个故事板之后。
我已经为此苦苦思索了整整两个星期了……谁能看到我看不到的东西?
非常感谢您提前。