0

我在 Blend4 中准备了最简单的应用程序,我将文本框放在添加的故事板 keyframe1 中,移动了文本框并添加了另一个关键帧。动画在 Blend4 中工作,我在情节提要上按下播放,文本框移动。我运行模拟器,它没有。我什至运行了我老师的应用程序,它也没有动画(它应该)。

我应该怎么做才能让它运行?

在此处输入图像描述

4

1 回答 1

0

你如何从代码开始动画?
FE翻转动画:

XAML

 <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="VisualStateGroup">
            <VisualState x:Name="ShowBack" >
                <Storyboard >
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationX)" Storyboard.TargetName="FrontCover">
                        <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                        <EasingDoubleKeyFrame KeyTime="0:0:0" Value="0"/>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="FrontCover">
                        <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                        <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="90"/>
                    </DoubleAnimationUsingKeyFrames>
                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="BackCover">
                        <DiscreteObjectKeyFrame KeyTime="0:0:0.5">
                            <DiscreteObjectKeyFrame.Value>
                                <Visibility>Visible</Visibility>
                            </DiscreteObjectKeyFrame.Value>
                        </DiscreteObjectKeyFrame>
                    </ObjectAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="BackCover">
                        <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="90"/>
                        <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0"/>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationZ)" Storyboard.TargetName="FrontCover">
                        <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                        <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/>
                    </DoubleAnimationUsingKeyFrames>
                </Storyboard>
            </VisualState>

            <VisualState x:Name="ShowFront" >
                <Storyboard >
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationX)" Storyboard.TargetName="BackCover">
                        <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                        <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="BackCover">
                        <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                        <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="90"/>
                    </DoubleAnimationUsingKeyFrames>


                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="FrontCover">
                        <DiscreteObjectKeyFrame KeyTime="0:0:0.5">
                            <DiscreteObjectKeyFrame.Value>
                                <Visibility>Visible</Visibility>
                            </DiscreteObjectKeyFrame.Value>
                        </DiscreteObjectKeyFrame>
                    </ObjectAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="FrontCover">
                        <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="90"/>
                        <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0"/>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationZ)" Storyboard.TargetName="BackCover">
                        <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                        <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/>
                    </DoubleAnimationUsingKeyFrames>
                </Storyboard>
            </VisualState>


        </VisualStateGroup>
    </VisualStateManager.VisualStateGroups>


<Image x:Name="FrontCover"   Source="{Binding TitleInfo.front_cover.Image}"    HorizontalAlignment="Left" VerticalAlignment="Top" Stretch="None" Margin="5">
                            <Image.RenderTransform>
                                <CompositeTransform/>
                            </Image.RenderTransform>
                            <Image.Projection>
                                <PlaneProjection/>
                            </Image.Projection>
                                                               </Image>
                            <Image x:Name="BackCover"  Source="{Binding TitleInfo.back_cover.Image}"   HorizontalAlignment="Left" VerticalAlignment="Top" Stretch="None" Margin="5" Visibility="Collapsed"  >
                            <Image.RenderTransform>
                                <CompositeTransform/>
                            </Image.RenderTransform>
                            <Image.Projection>
                                <PlaneProjection/>
                            </Image.Projection>

                            </Image>

启动动画的 CS 代码:

VisualStateManager.GoToState(this, "ShowBack", true);

于 2012-10-28T20:25:15.477 回答