Storyboard controls the animation playing Interval

Source: Internet
Author: User

StoryboardYesBegintimeAndDurationAttribute, you can use them to control the animation playing interval.

First, implement6Second animation, as follows:

storyboard x : key =" SB ">

doubleanimation storyboard. targetname =" Rotate " storyboard. targetproperty =" angle "

Begintime= "00:00:00"Duration= "00:00:06"Fillbehavior= "Holdend"

From= "0"To= "180"/>

</Storyboard>

Obtain the animation.LoadFunction:

M_storyboard=This.Resources["SB"]As Storyboard;

If you want to play a video before2Seconds, which can be setDurationIs2Seconds.2Seconds,CodeAs follows:

If(M_storyboard! =Null)

{

M_storyboard.Begintime=Timespan.Fromseconds(0 );

M_storyboard.Duration=Timespan.Fromseconds(2 );

M_storyboard.Begin(This,True);

}

If you want to play back2Seconds, which can be setBegintimeIs-4Seconds.4Seconds to start playing, in other words setBegintimeIs-4Seconds, indicating that the animation is in advance4The Code is as follows:

If(M_storyboard! =Null)

{

M_storyboard.Begintime=Timespan.Fromseconds(-4 );

M_storyboard.Duration=Timespan.Fromseconds(6 );

M_storyboard.Begin(This,True);

}

If you want to play intermediate2Seconds, as described above, SetBegintimeIs-2Seconds,DurationIs4Seconds.2Seconds to start playing.4The Code is as follows:

If(M_storyboard! =Null)

{

M_storyboard.Begintime=Timespan.Fromseconds(-2 );

M_storyboard.Duration=Timespan.Fromseconds(4 );

M_storyboard.Begin(This,True);

}

In addition, the speedratio setting can control the playback speed of the animation, so that the animation can be extended or shortened accordingly.

 

For more information, seeDemo:

Http://files.cnblogs.com/xirihanlin/DL090114@cc-AnimationControlDemo.zip

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.