08.01.2015 Views

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

406<br />

CHAPTER 16 ■ PROGRAMMING SILVERLIGHT WITH XAML AND JAVASCRIPT<br />

Figure 16-11. Creating a new storyboard<br />

Now that you’ve done this, the timeline editor will appear. This is a very simple tool<br />

that allows you to generate animations quickly <strong>and</strong> easily (see Figure 16-12).<br />

Figure 16-12. Using the timeline editor<br />

Drag the yellow time indicator to the 0:00.500 mark (half of a second) <strong>and</strong> add a<br />

keyframe at this point. To add a keyframe, you use the tool with the green + on it, located<br />

immediately above the timeline window. You can see it just to the left of the 0:00.500 label<br />

in Figure 16-12. A blob will appear on the timeline, indicating that there is a key frame<br />

there.<br />

Now, with the timeline still on 0:00.500, use the Property Editor to change the color of<br />

the rectangle to full blue (0 red, 0 green, 255 blue).<br />

Then return to the timeline editor, drag the yellow bar to the 1 second mark, add a<br />

new key frame, <strong>and</strong> go back to the Property Editor to change the color back to 0 red, 0<br />

green, 127 blue.<br />

You’ve now defined an animation that will change the intensity of the blue from 127<br />

to 255 over 0.5 seconds, before returning back to 127 over the next 0.5 seconds.<br />

Repeat this process for three other rectangles—one red, one green, <strong>and</strong> one yellow.<br />

For yellow, use equal values of red <strong>and</strong> green (e.g., dimmed is 127 red, 127 green, 0 blue).<br />

Once you’ve created them all, defined their animations, <strong>and</strong> added a couple of<br />

TextBlocks that will be used for starting the game <strong>and</strong> showing your current round, you<br />

should have XAML that looks like Listing 16-1.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!