Add animation that will play after a change in state
You can add animation to a state that will play after the control transitions to that state. For example, a button changes color when you move the mouse pointer over it, which is a result of the transition to the MouseOver state. If you add animation to the MouseOver state, such as making the button spin around, that animation will run after the button changes color.
To add animation to a state
Press F6 to change to the Animation Workspace. This moves the Interaction panel beneath the artboard to provide more room to display the timeline.
Under States, select the state to which you want to add animation.
Under Objects and Timeline, click the Show Timeline button.
Note
When Base is selected under States, the Show Timeline button does not appear because you are not in state-recording mode.
If you made the appearance of the control in this state different from its default appearance (when Base is selected), a keyframe is already set at the 0-second mark.
To add more animation, move the playhead to another time on the timeline, and then make a change to an object on the artboard.
For example, to make a playing card spin around, move the playhead to the 1-second mark, select the LayoutRoot object under Objects and Timeline, and then, under Transform in the Properties panel, select the Rotate tab, and set the Angle property to 360.
Preview your animation by clicking the Play button.
Press F5 to test your in-state animation.
Tip
If you do not want your control to rotate backward to 0 degrees when the state changes again, you can set the transition time to 0 seconds for this state when it transitions to all other states. For a procedure to follow, see Modify the transition time between state changes in system controls.
Next steps
You can make your in-state animation loop multiple times or forever, or reverse when it reaches the last keyframe. For more information, see Modify a storyboard to repeat or reverse at the end of its cycle.
You can adjust how fast the animation occurs between keyframes to create a more natural animation. For more information, see Change animation interpolation between keyframes.
If you are modifying a system control template, you can press F5 to see the changes in your application. If you are working with a user control, you can see the modified animation in action by making your user control respond to mouse clicks. For more information, see Change state in response to user interaction.