3
我在我的windows phone 8.1应用程序中使用故事板动画,我有一个严重的偶然滞后问题。 (Lumia 930) 哦,我想我可以添加一个通用的应用程序模板。Laggy故事板动画windows phone 8.1
第一动画代码:
<Page.Resources>
<local:SimpleMathConverter x:Key="SimpleMathConverter"/>
<Storyboard x:Name="ImageViewShowAnimation">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="GameImageView">
<EasingDoubleKeyFrame KeyTime="0" Value="90"/>
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Name="ImageViewHideAnimation">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="GameImageView">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="90"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Name="ResultViewShowAnimation">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="GameResutView">
<EasingDoubleKeyFrame KeyTime="0" Value="-90"/>
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Name="ResultViewHideAnimation">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="GameResutView">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="-90"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</Page.Resources>
那么后面的事件处理
public GamePage()
{
ImageViewHideAnimation.Completed += (sender, o) => ResultViewShowAnimation.Begin();
ResultViewHideAnimation.Completed += (sender, o) => ImageViewShowAnimation.Begin();
}
和按钮调用动画
private async void ChangeState()
{
CoreDispatcher dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;
switch (state)
{
case GameState.ImageView:
await dispatcher.RunAsync(CoreDispatcherPriority.Normal,() => ImageViewHideAnimation.Begin());
state = GameState.ResultView;
break;
case GameState.ResultView:
await dispatcher.RunAsync(CoreDispatcherPriority.Normal,() => ResultViewHideAnimation.Begin());
state = GameState.ImageView;
break;
default:
throw new ArgumentOutOfRangeException();
}
}
什么这个动画实际上做的是假装的代码当你点击ro时,你翻转卡片并在另一边显示内容再次按下按钮,它会反转显示初始内容的卡片。 什么问题是,有时,我会说4/10它滞后于动画应该开始,实际显示一半的动画。这就像动画开始,但屏幕还没有赶上。我尝试了运行动画,但没有调度员希望获得其他效果,但没有。任何提示如何才能解决这个问题?
如果你摆脱了1秒到90度的东西,而是每次输入10个10度单独的关键帧,会发生什么?我只是想看看这1秒是否太快而无法响应。 – 2014-09-06 00:19:08
当我将动画更改为10个关键帧0.1秒和10度更改时,一切正常。 Thx寻求帮助。你知道是什么导致了这个问题? – Shuffler 2014-09-08 08:39:49
是的,我会把我的推理放在一个解决方案中。 – 2014-09-08 08:47:07