|
|
|
Numerical
animations provide From, To, and By properties. If you specify From and To,
this indicates the absolute start and end values of the animation. The
previous value of the relevant property will be ignored in this case.
|
|
|
|
If you
just specify To, the animation will animate from the property’s current value
to the target specified by To.
|
|
|
|
If you
specify just By, the animation is relative – it will start from the
property’s current value and add the value specified in By to form the target
value. (Not all animation types have a By property – only types for which
addition is defined support this. ColorAnimation does not, for example.)
|
|
|
|
If you
specify From and By, this indicates an absolute start position and a relative
target position.
|
|
|
|
You
might have multiple animations applied to the same property. This is useful
for multi-stage animations. If you use the By property, each animation
applies from where the previous one left off. If animations overlap, then if
the second is a By animation, it will simply be added to the first one.
|
|
|
|
If an
animation specifying From overlaps in time with another animation for the
same property, the later of the two overrides the earlier one.
|
|
By
default, animations perform linear interpolation – they change the animated
property at a constant rate over the duration of the animation. This can
result in a rather unrealistic feel for certain kinds of animations.
|
|
|
|
Animation
timelines therefore support a soft start and/or finish to the animation. By
specifying an AccelerationRatio, you can make the animation gradually ramp up
to speed. This property indicates the proportion of the total duration that
should be spent accelerating. For example, if you specify a value of 0.3, the
animation will start at zero speed, and will ramp up to full speed over the
first 30% of the duration. (The appropriate value for ‘full speed’ is
calculated automatically.) You can also specify a DecelerationRatio, which
indicates the proportion of the total time that should be spent slowing down
to a halt at the end of the animation.
|
|
|
|
Obviously
the sum total of these two properties must be less than or equal to one: you
cannot spend more than 100% of the time speeding up and slowing down!
|
|
All
timelines have a RepeatBehavior property which indicates whether the timeline
should repeat, and if so for how long. A value of Forever means it should
repeat indefinitely. (However, if the timeline is a child of a timeline with
a specific finite duration, ‘Forever’ really just means ‘Until the parent
timeline ends’.) You can specific finite repetition either by indicating how
long the timeline should repeat for, or the number of repetitions. Note that
in both cases this includes the first run through, so a RepeatBehavior of
“1x” is effectively the default. Likewise, if you make the RepeatBehavior a
duration that is the same as the animation’s behavior, this also lets the
animation run just once.
|
|
|
|
All
timelines also have an AutoReverse property. If this is set to true, the
timeline will run in reverse once it reaches the end. This doubles the
effective duration of the timeline.
|