PointAnimation
PointAnimation
PointAnimation
PointAnimation
Class
Definition
public : sealed class PointAnimation : Timeline, IPointAnimationpublic sealed class PointAnimation : Timeline, IPointAnimationPublic NotInheritable Class PointAnimation Inherits Timeline Implements IPointAnimation// This API is not available in Javascript.
<PointAnimation .../>
- Inheritance
-
PointAnimationPointAnimationPointAnimationPointAnimation
- Attributes
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
Inherited Members
Inherited properties
Inherited methods
Inherited events
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
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() PointAnimation() PointAnimation() PointAnimation()
Initializes a new instance of the PointAnimation class.
public : PointAnimation()public PointAnimation()Public Sub New()// This API is not available in Javascript.
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 Nullable<Point> By { get; set; }Public ReadWrite Property By As Nullable<Point>// This API is not available in Javascript.
<PointAnimation By="x,y"/>
- Value
- IReference<Point> Nullable<Point> Nullable<Point> Nullable<Point>
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
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 EasingFunctionBase// This API is not available in Javascript.
<PointAnimation>
<PointAnimation.EasingFunction>
singleEasingFunction
</PointAnimation.EasingFunction>
</PointAnimation>
The easing function you are applying to the animation. The default is null.
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.
- See Also
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 DependencyProperty// This API is not available in Javascript.
The identifier for the EasingFunction dependency property.
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 : PlatForm::Boolean EnableDependentAnimation { get; set; }public bool EnableDependentAnimation { get; set; }Public ReadWrite Property EnableDependentAnimation As bool// This API is not available in Javascript.
<PointAnimation EnableDependentAnimation="bool" />
- Value
- PlatForm::Boolean 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 Timeline.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.
- See Also
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 DependencyProperty// This API is not available in Javascript.
The identifier for the EnableDependentAnimation dependency property.
From From From From
Gets or sets the animation's starting value.
public : IReference<Point> From { get; set; }public Nullable<Point> From { get; set; }Public ReadWrite Property From As Nullable<Point>// This API is not available in Javascript.
<PointAnimation From=x,y"/>
- Value
- IReference<Point> Nullable<Point> Nullable<Point> Nullable<Point>
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 DependencyProperty// This API is not available in Javascript.
The identifier for the From dependency property.
To To To To
Gets or sets the animation's ending value.
public : IReference<Point> To { get; set; }public Nullable<Point> To { get; set; }Public ReadWrite Property To As Nullable<Point>// This API is not available in Javascript.
<PointAnimation To="x,y"/>
- Value
- IReference<Point> Nullable<Point> Nullable<Point> Nullable<Point>
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.