title | description | ms.date | helpviewer_keywords | ms.assetid | ||||
---|---|---|---|---|---|---|---|---|
How to: Control an Animation using From, To, and By |
Review a table summarizing how the From, To, and By properties may be used together or separately to determine an animation's target values. |
03/30/2017 |
|
59afba57-6fc1-44c8-987e-8a5f4142adad |
A "From/To/By" or "basic animation" creates a transition between two target values (see Animation Overview for an introduction to different types of animations). To set the target values of a basic animation, use its xref:System.Windows.Media.Animation.DoubleAnimation.From%2A, xref:System.Windows.Media.Animation.DoubleAnimation.To%2A, and xref:System.Windows.Media.Animation.DoubleAnimation.By%2A properties. The following table summarizes how the xref:System.Windows.Media.Animation.DoubleAnimation.From%2A, xref:System.Windows.Media.Animation.DoubleAnimation.To%2A, and xref:System.Windows.Media.Animation.DoubleAnimation.By%2A properties may be used together or separately to determine an animation's target values.
Properties specified | Resulting behavior |
---|---|
xref:System.Windows.Media.Animation.DoubleAnimation.From%2A | The animation progresses from the value specified by the xref:System.Windows.Media.Animation.DoubleAnimation.From%2A property to the base value of the property being animated or to a previous animation's output value, depending on how the previous animation is configured. |
xref:System.Windows.Media.Animation.DoubleAnimation.From%2A and xref:System.Windows.Media.Animation.DoubleAnimation.To%2A | The animation progresses from the value specified by the xref:System.Windows.Media.Animation.DoubleAnimation.From%2A property to the value specified by the xref:System.Windows.Media.Animation.DoubleAnimation.To%2A property. |
xref:System.Windows.Media.Animation.DoubleAnimation.From%2A and xref:System.Windows.Media.Animation.DoubleAnimation.By%2A | The animation progresses from the value specified by the xref:System.Windows.Media.Animation.DoubleAnimation.From%2A property to the value specified by the sum of the xref:System.Windows.Media.Animation.DoubleAnimation.From%2A and xref:System.Windows.Media.Animation.DoubleAnimation.By%2A properties. |
xref:System.Windows.Media.Animation.DoubleAnimation.To%2A | The animation progresses from the animated property's base value or a previous animation's output value to the value specified by the xref:System.Windows.Media.Animation.DoubleAnimation.To%2A property. |
xref:System.Windows.Media.Animation.DoubleAnimation.By%2A | The animation progresses from the base value of the property being animated or a previous animation's output value to the sum of that value and the value specified by the xref:System.Windows.Media.Animation.DoubleAnimation.By%2A property. |
Note
Do not set both the xref:System.Windows.Media.Animation.DoubleAnimation.To%2A property and the xref:System.Windows.Media.Animation.DoubleAnimation.By%2A property on the same animation.
To use other interpolation methods or animate between more than two target values, use a key frame animation. See Key-Frame Animations Overview for more information.
For information about applying multiple animations to a single property, see Key-Frame Animations Overview.
The example below shows the different effects of setting xref:System.Windows.Media.Animation.DoubleAnimation.To%2A, xref:System.Windows.Media.Animation.DoubleAnimation.By%2A, and xref:System.Windows.Media.Animation.DoubleAnimation.From%2A properties on animations.
[!code-xamlBasicAnimations_snippet#AnimationTargetValuesWholePage]