故事板WP7 - 坐标

时间:2012-08-03 20:00:11

标签: windows-phone-7 storyboard expression-blend

我创建了一个Storyboard来动画一个Image Control,它以编程方式放置在我的Canvas上。故事板是在Expression Blend中创建的。

当我播放故事板时,图像消失并在其他地方动画(我最终看到图像控件在最后飞行)。它没有动画我放置图像的位置。故事板可以工作,但它没有动画我想要动画的地方。 控件假设在屏幕底部和特定图像的右侧进行动画处理。这就是我通过代码更改图像位置的原因。

这是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>

第二个故事板在第一个故事板后直接发生。

我已经在这个问题上摸不着头两个星期......有人能看到我不能做的事吗?

非常感谢你。

1 个答案:

答案 0 :(得分:0)

因为您使用Blend生成动画,所以Blend基于坐标上的From和To属性的值以及您在Blend中使用的元素的布局。

包括其容器和边距。

因为你没有指定所需的坐标,所以我无法告诉你什么是错误的。

我首先要改变TranslateX和TranslateY,以了解他们做了什么以及何时做我想让他们做的事。