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