Animates the value of a Point property between two target values using linear interpolation over a specified Duration.
Namespace:
System.Windows.Media.Animation
Assembly:
System.Windows (in System.Windows.dll)
Visual Basic (Declaration)
Public NotInheritable Class PointAnimation _
Inherits Timeline
Dim instance As PointAnimation
public sealed class PointAnimation : Timeline
XAML Object Element Usage
An animation updates the value of a property over a period of time. An animation effect can be subtle, such as moving a Shape a few pixels left and right, or dramatic, such as enlarging an object to 200 times its original size while spinning it and changing its color. To create an animation, you must associate an animation with an object's property value.
Target Values
The PointAnimation class creates a transition between two target values. To set its target values, use its From, To, and By properties. The following table summarizes how the From, To, and By properties can be used together or separately to determine an animation's target values.
Properties specified | Resulting behavior |
|---|
From
| The animation progresses from the value specified by the From 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. |
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
| 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
| 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. |
Note: |
|---|
If you set both the To and By properties, the To property takes precedence and the By property is ignored.
|
To use other interpolation methods or animate between more than two target values, use a PointAnimationUsingKeyFrames object.
The following example shows how to use the PointAnimation to animate the Center property of an EllipseGeometry.
Run this sample
<Canvas Width="450" Height="350">
<Canvas.Resources>
<Storyboard x:Name="myStoryboard">
<!-- Animate the center point of the ellipse from 100 X, 300 Y
to 400 X, 100 Y over 5 seconds. -->
<PointAnimation
Storyboard.TargetProperty="Center"
Storyboard.TargetName="MyAnimatedEllipseGeometry"
Duration="0:0:5"
From="100,300"
To="400,100"
RepeatBehavior="Forever" />
</Storyboard>
</Canvas.Resources>
<Path Fill="Blue" Loaded="Start_Animation">
<Path.Data>
<!-- Describes an ellipse. -->
<EllipseGeometry x:Name="MyAnimatedEllipseGeometry"
Center="200,100" RadiusX="15" RadiusY="15" />
</Path.Data>
</Path>
</Canvas>
' Start the animation when the object loads
Private Sub Start_Animation(ByVal sender As Object, ByVal e As EventArgs)
myStoryboard.Begin()
End Sub
// Start the animation when the object loads
private void Start_Animation(object sender, EventArgs e)
{
myStoryboard.Begin();
}
System..::.Object
System.Windows..::.DependencyObject
System.Windows.Media.Animation..::.Timeline
System.Windows.Media.Animation..::.PointAnimation
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Reference
Other Resources