How to animate a man walking in a xaml page and sh

2019-04-16 16:52发布

问题:

Hi I want to build an app where if the user is idle for say 5 seconds, then a man will walk from the left side and will show a banner like text block "What are you doing?". I am developing a Game app for Windows app and it is the idea came to my mind. But I don't know how to do this in XAMl and specially in WPF, with Windows phone 8.

I know very little about animations and want to learn more. Storyboard animation and transtions I know, but how could I use that to do this kind of animations?

 <Storyboard x:Name="SuperAnimation" >
        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="FirstImage" Storyboard.TargetProperty="(UIElement.Opacity)">
            <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0.2"/>
            <EasingDoubleKeyFrame KeyTime="00:00:02" Value="0.6"/>
            <EasingDoubleKeyFrame KeyTime="00:00:04" Value="0.3"/>
            <EasingDoubleKeyFrame KeyTime="00:00:06.7000000" Value="1"/>
        </DoubleAnimationUsingKeyFrames>
    </Storyboard>

But this kind of animations are very simple, please guide

回答1:

Using Blend for animations. It will make animating a thousand times easier. hand writing animations is very tedious.

if this game is entirely in xaml i'd suggest having a timer that has a 5 second interval. and every time you click an action it resets the timer.

once the timer goes off you start a storyboard of what you want to do, be it move a text box across the screen or like you said have a character walk across the top of the screen with text behind it. if you put your character inside of a canvas you can change the margins around to get the character where you want.