Share via


PointAnimation Class

Definition

Animates the value of a Point property between two target values using linear interpolation over a specified Duration.

public ref class PointAnimation sealed : Timeline
/// [Windows.Foundation.Metadata.Activatable(65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class PointAnimation final : Timeline
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
class PointAnimation final : Timeline
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class PointAnimation : Timeline
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
public sealed class PointAnimation : Timeline
Public NotInheritable Class PointAnimation
Inherits Timeline
<PointAnimation .../>
Inheritance
Object Platform::Object IInspectable DependencyObject Timeline PointAnimation
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Examples

The following example shows how to use the PointAnimation to animate the Center property of an EllipseGeometry.

// Start the animation when the object loads
void SampleApp::Page::Start_Animation(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
    myStoryboard->Begin();
}
<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" EnableDependentAnimation="True"/>

        </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 void Start_Animation(object sender, RoutedEventArgs e)
{
    myStoryboard.Begin();
}
' Start the animation when the object loads
Private Sub Start_Animation(ByVal sender As Object, ByVal e As EventArgs)
    myStoryboard.Begin()
End Sub

Remarks

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.

Constructors

PointAnimation()

Initializes a new instance of the PointAnimation class.

Properties

AutoReverse

Gets or sets a value that indicates whether the timeline plays in reverse after it completes a forward iteration.

(Inherited from Timeline)
BeginTime

Gets or sets the time at which this Timeline should begin.

(Inherited from Timeline)
By

Gets or sets the total amount by which the animation changes its starting value.

ByProperty

Identifies the By dependency property.

Dispatcher

Gets the CoreDispatcher that this object is associated with. The CoreDispatcher represents a facility that can access the DependencyObject on the UI thread even if the code is initiated by a non-UI thread.

(Inherited from DependencyObject)
Duration

Gets or sets the length of time for which this timeline plays, not counting repetitions.

(Inherited from Timeline)
EasingFunction

Gets or sets the easing function you are applying to the animation.

EasingFunctionProperty

Identifies the EasingFunction dependency property.

EnableDependentAnimation

Gets or sets a value that declares whether animated properties that are considered dependent animations should be permitted to use this animation declaration.

EnableDependentAnimationProperty

Identifies the EnableDependentAnimation dependency property.

FillBehavior

Gets or sets a value that specifies how the animation behaves after it reaches the end of its active period.

(Inherited from Timeline)
From

Gets or sets the animation's starting value.

FromProperty

Identifies the From dependency property.

RepeatBehavior

Gets or sets the repeating behavior of this timeline.

(Inherited from Timeline)
SpeedRatio

Gets or sets the rate, relative to its parent, at which time progresses for this Timeline.

(Inherited from Timeline)
To

Gets or sets the animation's ending value.

ToProperty

Identifies the To dependency property.

Methods

ClearValue(DependencyProperty)

Clears the local value of a dependency property.

(Inherited from DependencyObject)
GetAnimationBaseValue(DependencyProperty)

Returns any base value established for a dependency property, which would apply in cases where an animation is not active.

(Inherited from DependencyObject)
GetValue(DependencyProperty)

Returns the current effective value of a dependency property from a DependencyObject.

(Inherited from DependencyObject)
ReadLocalValue(DependencyProperty)

Returns the local value of a dependency property, if a local value is set.

(Inherited from DependencyObject)
RegisterPropertyChangedCallback(DependencyProperty, DependencyPropertyChangedCallback)

Registers a notification function for listening to changes to a specific DependencyProperty on this DependencyObject instance.

(Inherited from DependencyObject)
SetValue(DependencyProperty, Object)

Sets the local value of a dependency property on a DependencyObject.

(Inherited from DependencyObject)
UnregisterPropertyChangedCallback(DependencyProperty, Int64)

Cancels a change notification that was previously registered by calling RegisterPropertyChangedCallback.

(Inherited from DependencyObject)

Events

Completed

Occurs when the Storyboard object has completed playing.

(Inherited from Timeline)

Applies to

See also