15.02.2015 Views

C# 4 and .NET 4

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

1022 ❘ ChaPTer 35 cOre wpf<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

The following table lists things you can do with a timeline.<br />

code snippet AnimationDemo/ButtonAnimationWindow.xaml<br />

Timeline ProPerTies<br />

AutoReverse<br />

SpeedRatio<br />

BeginTime<br />

AccelerationRatio<br />

DecelerationRatio<br />

Duration<br />

RepeatBehavior<br />

FillBehavior<br />

desCriPTion<br />

With the AutoReverse property, you can specify whether the value that is animated<br />

should return to the original value after the animation.<br />

With SpeedRatio, you can transform the speed at which an animation moves. With<br />

this property, you can define the relation in regard to the parent. The default value is 1;<br />

setting the ratio to a smaller value makes the animation move slower; setting the value<br />

greater than 1 makes it move faster.<br />

With BeginTime you can specify the timespan from the start of the trigger event until<br />

the moment the animation starts. You can specify days, hours, minutes, seconds, <strong>and</strong><br />

fractions of seconds. This might not be real-time, depending on the speed ratio. For<br />

example, if the speed ratio is set to 2, <strong>and</strong> the beginning time is set to six seconds, the<br />

animation will start after three seconds.<br />

With an animation the values need not be changed in a linear way. You can specify an<br />

AccelerationRatio <strong>and</strong> DecelerationRatio to define the impact of acceleration<br />

<strong>and</strong> deceleration. The sum of both values must not be greater than 1.<br />

With the Duration property, you specify the length of time for one iteration of<br />

the animation.<br />

Assigning a RepeatBehavior struct to the RepeatBehavior property lets you<br />

define how many times or how long the animation should be repeated.<br />

The FillBehavior property is important if the parent timeline has a different<br />

duration. For example, if the parent timeline is shorter than the duration of the<br />

actual animation, setting the FillBehavior to Stop means that the actual<br />

animation stops. If the parent timeline is longer than the duration of<br />

the actual animation, HoldEnd keeps the actual animation active before<br />

resetting it to its original value (if AutoReverse is set).<br />

www.it-ebooks.info

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

Saved successfully!

Ooh no, something went wrong!