PointAnimation PointAnimation PointAnimation Class

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

Syntax

Declaration

public sealed class PointAnimationpublic sealed class PointAnimationPublic NotInheritable Class PointAnimation
<PointAnimation .../>

Inheritance Hierarchy

Inherited Members

Inherited properties

, , , , , , , , , , , , ,

Inherited methods

, , , , , ,

Inherited events

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<T> instead.

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::Input::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

Constructors summary

Initializes a new instance of the PointAnimation class.

Properties summary

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

Identifies the By dependency property.

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

Identifies the EasingFunction dependency property.

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

Identifies the EnableDependentAnimation dependency property.

Gets or sets the animation's starting value.

Identifies the From dependency property.

Gets or sets the animation's ending value.

Identifies the To dependency property.

Constructors

  • PointAnimation()
    PointAnimation()
    PointAnimation()
    PointAnimation()

    Initializes a new instance of the PointAnimation class.

    public PointAnimation()public New()Public Sub New()public PointAnimation()

Properties

  • By
    By
    By
    By

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

    public IReference<Point> By { get; set; }public IReference<Point> By { get; set; }Public ReadWrite Property By As IReference<Point>public IReference<Point> By { get; set; }
    <PointAnimation By="x,y"/>
    

    Property Value

    • The total amount by which the animation changes its starting value. The default is null.

      If you are programming using C#or Microsoft Visual Basic, the type of this property is projected as Point?(a nullable Point ).

    Remarks

    A PointAnimation typically has at least one of the From, By or To properties set, but never all three. For more info, see Remarks in PointAnimation.

    The null default value indicates that the base non-animated value is the default value for By, not that the animated value is literally null. The base non-animated value is determined at run time by the dependency property system. For more info, see Dependency properties overview.

  • ByProperty
    ByProperty
    ByProperty
    ByProperty

    Identifies the By dependency property.

    public static DependencyProperty ByProperty { get; }public static DependencyProperty ByProperty { get; }Public Static ReadOnly Property ByProperty As DependencyPropertypublic static DependencyProperty ByProperty { get; }

    Property Value

  • EasingFunction
    EasingFunction
    EasingFunction
    EasingFunction

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

    public EasingFunctionBase EasingFunction { get; set; }public EasingFunctionBase EasingFunction { get; set; }Public ReadWrite Property EasingFunction As EasingFunctionBasepublic EasingFunctionBase EasingFunction { get; set; }
    <PointAnimation>
      <PointAnimation.EasingFunction>
        singleEasingFunction
      </PointAnimation.EasingFunction>
    </PointAnimation>
    

    Property Value

    Remarks

    Easing functions allow you to apply custom mathematical formulas to your animations. Mathematical operations are often useful to produce animations that simulate real-world physics in a 2-D coordinate system. For example, you may want an object to realistically bounce or behave as though it were on a spring. For a list of easing functions and info on how to use them, see Key-frame animations and easing function animations.

  • EasingFunctionProperty
    EasingFunctionProperty
    EasingFunctionProperty
    EasingFunctionProperty

    Identifies the EasingFunction dependency property.

    public static DependencyProperty EasingFunctionProperty { get; }public static DependencyProperty EasingFunctionProperty { get; }Public Static ReadOnly Property EasingFunctionProperty As DependencyPropertypublic static DependencyProperty EasingFunctionProperty { get; }

    Property Value

  • EnableDependentAnimation
    EnableDependentAnimation
    EnableDependentAnimation
    EnableDependentAnimation

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

    public bool EnableDependentAnimation { get; set; }public bool EnableDependentAnimation { get; set; }Public ReadWrite Property EnableDependentAnimation As boolpublic bool EnableDependentAnimation { get; set; }
    <PointAnimation EnableDependentAnimation="bool" />
    

    Property Value

    • bool
      bool
      bool

      true if the animation can be used for a dependent animation case. false if the animation cannot be used for a dependent animation case. The default is false.

    Remarks

    What's considered a dependent animation?

    Not all custom animations you create can run by default in a Windows Runtime app, if the animation system determines that the animation might cause bad performance in your UI. Animations where the system determines there could be a performance impact are called dependent animations. It's dependent because your animation is actively and frequently updating objects on the UI thread, which is also where current user input and other programmatic updates are making runtime changes to UI.

    A dependent animation that's consuming extensive system resources on the UI thread can make the app appear unresponsive in certain situations. If your animation causes a layout change or otherwise has the potential to impact performance on the UI thread, you often need to explicitly enable the animation to see it run. That's what the EnableDependentAnimation property on specific animation classes is for. Use this property with caution, because setting it to true means you are deliberately acknowledging that the animation might slow down other operations on the UI thread when it runs.

    For more info, see Storyboarded animations. That topic includes a list of the criteria for an independent animation. An animation is a dependent animation if it doesn't satisfy at least one of those criteria. For the specific property you intend to animate, and for the specifics of your animation, compare your intended animation to the criteria to see whether it would be considered dependent or independent by the system.

    Another way to discover whether your animations are dependent is that you might receive a warning from your XAML design surface or tool after you compose that animation, and the warning indicates that you'll need to set EnableDependentAnimation to true to see your animation run.

    As an app developer, you can also choose to apply an app-wide setting that always disables dependent animations, even those where EnableDependentAnimation is true. See AllowDependentAnimations. This is useful to you as an app developer if you're consuming controls where the templates have dependent animations, and you've identified that as a performance problem, but you don't want to have to retemplate the whole control to turn those animations off.

  • EnableDependentAnimationProperty
    EnableDependentAnimationProperty
    EnableDependentAnimationProperty
    EnableDependentAnimationProperty

    Identifies the EnableDependentAnimation dependency property.

    public static DependencyProperty EnableDependentAnimationProperty { get; }public static DependencyProperty EnableDependentAnimationProperty { get; }Public Static ReadOnly Property EnableDependentAnimationProperty As DependencyPropertypublic static DependencyProperty EnableDependentAnimationProperty { get; }

    Property Value

  • From
    From
    From
    From

    Gets or sets the animation's starting value.

    public IReference<Point> From { get; set; }public IReference<Point> From { get; set; }Public ReadWrite Property From As IReference<Point>public IReference<Point> From { get; set; }
    <PointAnimation From=x,y"/>
    

    Property Value

    • The starting value of the animation. The default is null.

      If you are programming using C#or Microsoft Visual Basic, the type of this property is projected as Point?(a nullable Point ).

    Remarks

    A PointAnimation typically has at least one of the From, By or To properties set, but never all three. For more info, see Remarks in PointAnimation.

    The null default value indicates that the base non-animated value is the default value for From, not that the animated value is literally null. The base non-animated value is determined at run time by the dependency property system. For more info, see Dependency properties overview.

  • FromProperty
    FromProperty
    FromProperty
    FromProperty

    Identifies the From dependency property.

    public static DependencyProperty FromProperty { get; }public static DependencyProperty FromProperty { get; }Public Static ReadOnly Property FromProperty As DependencyPropertypublic static DependencyProperty FromProperty { get; }

    Property Value

  • To
    To
    To
    To

    Gets or sets the animation's ending value.

    public IReference<Point> To { get; set; }public IReference<Point> To { get; set; }Public ReadWrite Property To As IReference<Point>public IReference<Point> To { get; set; }
    <PointAnimation To="x,y"/>
    

    Property Value

    • The ending value of the animation. The default is null.

      If you are programming using C#or Microsoft Visual Basic, the type of this property is projected as Point?(a nullable Point ).

    Remarks

    A PointAnimation typically has at least one of the From, By or To properties set, but never all three. For more info, see Remarks in PointAnimation.

    The null default value indicates that the base non-animated value is the default value for To, not that the animated value is literally null. The base non-animated value is determined at run time by the dependency property system. For more info, see Dependency properties overview.

  • ToProperty
    ToProperty
    ToProperty
    ToProperty

    Identifies the To dependency property.

    public static DependencyProperty ToProperty { get; }public static DependencyProperty ToProperty { get; }Public Static ReadOnly Property ToProperty As DependencyPropertypublic static DependencyProperty ToProperty { get; }

    Property Value

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ActivatableAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.ThreadingAttribute
Windows.Foundation.Metadata.WebHostHiddenAttribute

Details

Assembly

Windows.UI.Xaml.Media.Animation.dll