Silverlight game suggestion (2)

Source: Internet
Author: User

This article will achieve the following results:

 

2In the previous article, we continue to make the hint function (hint through halo animation ). After clicking "hint", the player will be prompted by the halo on the screen:

 

2.1. Set the halo ImageFlare.pngAdd a project namedHintflareimageAnd drag it into layout:

 

2.2. Adjust the XAML of hintflareimage to run storyboard later:

 <  Image Height  = "99.49"  Width  = "72.601"  Canvas. Left  = "365.074"  Canvas. Top  = "334.773"
Source = "Images/notepad.png" Stretch = "Fill" Rendertransformorigin = "0.5, 0.5" > < Image. rendertransform > < Transformgroup > < Scaletransform /> < Skewtransform /> < Rotatetransform /> < Translatetransform /> </ Transformgroup > </ Image. rendertransform > </ Image >

2.3. Add another two storyboards to mainpage. XAML,ShowhintstoryboardAndRotatehintstoryboardTo display and rotate the halo respectively:

 <  Storyboard  X  :  Name  = "Showhintstoryboard"  Autoreverse  = "True"> <  Doubleanimationusingkeyframes  Begintime  = "00:00:00"
Storyboard. targetname = "Hintflareimage"
Storyboard. targetproperty = "(Uielement. opacity)"> < Easingdoublekeyframe Keytime = "00:00:00" Value = "0"/> < Easingdoublekeyframe Keytime = "00:00:02" Value = "0.8"/> </ Doubleanimationusingkeyframes > </ Storyboard >
< Storyboard X : Name = "Rotatehintstoryboard"> < Doubleanimationusingkeyframes Begintime = "00:00:00"
Storyboard. targetname = "Hintflareimage"
Storyboard. targetproperty = "(Uielement. rendertransform ).
(Transformgroup. Children) [2]. (rotatetransform. Angle) "> < Easingdoublekeyframe Keytime = "00:00:00" Value = "0"/> < Easingdoublekeyframe Keytime = "00:00:04" Value = "360"/> </ Doubleanimationusingkeyframes > </ Storyboard >

2.4. Add two new hinttextblockControlstoryboardactionThey will be used to execute showhintstoryboard and rotatehintstoryboard respectively:

3Finally, we can use behavior to control where the implied halo is displayed, add the class to the project, and compile it:

Return to blend and add it to usercontrol.Hintbehavior:

NewEventtrigger, Set hintoverlaynameHintflareimage:

Click hintitems collection to set the items to be hinted at. originx (y) variance indicates the location deviation between halo and Path:

RunProgramLet's see the effect,Source codeDownload:

 

Microsoft official expression blend Tutorial: Learn expression Blend

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.