-api-id | -api-type |
---|---|
T:Windows.UI.Xaml.Media.Animation.PointAnimation |
winrt class |
Animates the value of a Point property between two target values using linear interpolation over a specified Duration.
<PointAnimation .../>
Use PointAnimation to animate the property value of any dependency property that is of type Point.
Linear interpolation for a Point means that X and Y values are treated as a number and the interpolation is simply a mathematical operation.
Sometimes you'll need to use indirect property targeting in order to target a sub-property of another object that's the value of a property on the target. For example, in order to animate parts of a PathGeometry, you need to reference some of the intermediate object-property values, until the last step in the indirect property path is truly a Point value. For more info on indirect property targeting and other storyboarded animation concepts, see Storyboarded animations or Property-path syntax.
A PointAnimation typically has at least one of the From, By or To properties set, but never all three.
- From only: The animation progresses from the value specified by the From property to the base value of the property being animated.
- From and To: The animation progresses from the value specified by the From property to the value specified by the To property.
- From and By: The animation progresses from the value specified by the From property to the value specified by the sum of the From and By properties.
- To only: The animation progresses from the animated property's base value or a previous animation's output value to the value specified by the To property.
- By only: 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 By property.
The From, By or To properties of a PointAnimation aren't a Point value. Instead these are a Nullable for Point. The default value for these is null, not an uninitialized structure. That null value is how the animation system distinguishes that you haven't specifically set a value. Visual C++ component extensions (C++/CX) doesn't have a Nullable type, so it uses IReference instead.
The following example shows how to use the PointAnimation to animate the Center property of an EllipseGeometry.
[!code-cppPointanimation]
[!code-xamlPointanimation]
[!code-csharpPointanimation_cs]
[!code-vbPointanimation_cs]
Storyboarded animations, XAML animation sample, Timeline, Point, PointAnimationUsingKeyFrames, PointAnimationUsingKeyFrames