Single coloring animation windows phone 8.1

I am using storyboard animation in a Windows Phone 8.1 app and I have a severe random lag issue. (Lumia 930) Ohh, also I think I could add its generic app template.

Enter animation code:

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

      

Then the event handling code

 public GamePage()
 {
    ImageViewHideAnimation.Completed += (sender, o) => ResultViewShowAnimation.Begin();
    ResultViewHideAnimation.Completed += (sender, o) => ImageViewShowAnimation.Begin();
 }

      

and a button for calling animations

 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();
    }
 }

      

What this animation actually does is pretend that you are flipping the card and showing the content on the other side, when you press the rotate button again changes the agia of the card showing the original content. What a problem is that sometimes, I would say 4/10 it lags behind when the animation is supposed to run and is actually displayed halfway through the animation. It looks like an animation, but the screen hasn't caught up yet. I tried to run the animation with and without a dispatcher, hoping for some other effect, but no. Any advice how can I raise this issue?

+3


source to share


1 answer


What happens if you get rid of an object ranging from 1 second to 90 degrees and instead enter 10 separate keyframes of 10 degrees each? I just want to see if this 1 sec will respond too quickly to the phone.




I think it doesn't pre-calculate / make your transition. So every time you make such a huge 90-degree turn, it takes some time to calculate it each time. By limiting it to multiple KeyFrames instead of one, it eliminates / narrows the time it takes to compute it, thereby rendering your animation very fast.

+1


source







All Articles