Click here to Skip to main content
15,881,709 members
Articles / Desktop Programming / XAML
Tip/Trick

Creating a Simple Animation using Microsoft Blend for Visual Studio (UWP)

Rate me:
Please Sign up or sign in to vote.
4.92/5 (7 votes)
21 Nov 2015CPOL2 min read 35.2K   499   9   3
Creating an animation using blend instead of writing the XAML yourself

Introduction

Have you ever wondered how the games and animations are made for apps or want to learn it to do by yourself? Then, you are at the right place!

I will make a basic animation of an airplane firing missiles on a button click. This article will give you a head start.

  • Create a UWP application in Visual Studio.

    Image 1Image 2

  • Now right click on the mainpage.xaml page and click "Design in blend".

    Image 3Image 4

  • Your app will open in blend for Visual Studio. Select pen tool and design a plane (Don't worry about making a perfect design). Just click where you want the corners to be and make a plane like this:

    Image 5Image 6

  • Now select rectangle tool and make two lines to represent the missiles.

    Image 7Image 8

  • Here comes the main part to add the animation. Create a new storyboard to record the animation of the missiles. Click on the '+' button in the right panel.

    Image 9 Image 10

    Image 11 Image 12

  • Now we will record an animation. At start, your keyframe will be at 0 and your missiles should be in initial position. Move the keyframe to 1 sec and drag your missiles to the end side of the grid (canvas). To check the animation, click on green play icon.

    Image 13Image 14

  • Now, we need a button so we can make this animation work by clicking it.

    Image 15Image 16

  • In this step, we will assign the storyboard trigger event to our button. It's a simple drag and drop. In "assets", select "Behaviors" and then Drag "ControlStoryBoardAction" towards our button. Then, select the storyboard "Firing" so it should run on the button click.

    Image 17Image 18

  • Now run the project and click the button to see the animation in action.

    Image 19Image 20

And yeah, it's working great! What you can do now is add some more animation or do some coding logic to make a game. Make some object to come randomly and use buttons to shoot them and record score for the player. After some score, increase the objects as a level upgrade.

This is just a basic introduction, now it's up to you to explore further as much as you can.

For more information on other topics or to contact me, visit my personal blog: http://csdebugger.blogspot.com/.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Student
Pakistan Pakistan
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
Questioncontinuation to "cant follow" Pin
Member 110063776-Feb-18 13:19
Member 110063776-Feb-18 13:19 
QuestionI cant follow Pin
Member 110063776-Feb-18 1:17
Member 110063776-Feb-18 1:17 
GeneralMy vote of 4 Pin
Member 1330526718-Jul-17 16:04
Member 1330526718-Jul-17 16:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.