混合动画播放问题

时间:2014-07-27 20:14:00

标签: animation windows-phone-8.1 blend

我不知道我是否将问题命名为正确,但此处是

首先,我对Blend很新,从来没有在我的生活中使用它。我今天决定制作一个简单的动画,事情发生但不像预期的那样。

我动画了一个按钮,动画只是Y轴上的一个简单的360度翻转。我为特定按钮创建了动画。它完全符合我想要的代码

TiltAnimation.Begin();

然而,当我尝试用这个动画创建一个ControlTemplate时,就发生了这种情况。我需要单击并按住按钮才能完成动画。我将动画设置为在特定状态下播放:'按下' (更具体地说,它是按下的 - > *我认为这意味着从按下状态到任何状态')。我做错了什么或者我错过了什么

注意:我正在试验Windows手机平台。

如果您需要任何代码,请在评论中告诉我

编辑:这是来自页面和App.xaml的XAML代码

网页代码:

                    <Button Grid.Column="1"
                            Height="60" 
                            Width="60"
                            BorderThickness="1"
                            Background="White"
                            Opacity="0.8"
                            Template="{StaticResource ButtonControlTemplate1}"
                            Click="PlayButton_Click">
                    </Button>

App.xaml代码:

<ControlTemplate x:Key="ButtonControlTemplate1" TargetType="Button">
        <Grid x:Name="grid">
            <Grid.Resources>
                <Storyboard x:Name="Storyboard1">
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="grid">
                        <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                        <EasingDoubleKeyFrame KeyTime="0:0:1" Value="360"/>
                    </DoubleAnimationUsingKeyFrames>
                </Storyboard>
            </Grid.Resources>
            <Grid.Projection>
                <PlaneProjection/>
            </Grid.Projection>
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualStateGroup.Transitions>
                        <VisualTransition From="Pressed" GeneratedDuration="0">
                            <VisualTransition.GeneratedEasingFunction>
                                <BackEase EasingMode="EaseIn"/>
                            </VisualTransition.GeneratedEasingFunction>
                            <Storyboard>
                                <DoubleAnimation Duration="0:0:1" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="grid"/>
                            </Storyboard>
                        </VisualTransition>
                    </VisualStateGroup.Transitions>
                    <VisualState x:Name="Normal"/>
                    <VisualState x:Name="MouseOver"/>
                    <VisualState x:Name="Pressed">
                        <Storyboard>
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="grid">
                                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="360"/>
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Disabled"/>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Image x:Name="image" Source="/Assets/Icons/Previous.png">
                <Image.Projection>
                    <PlaneProjection/>
                </Image.Projection>
            </Image>
            <Ellipse Height="Auto" Width="Auto" Stroke="White" StrokeThickness="4"/>
        </Grid>
    </ControlTemplate>

0 个答案:

没有答案