SizeAnimation::From Property
Gets or sets the animation's starting value.
Namespace: System.Windows.Media.Animation
Assembly: PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
public: property Nullable<Size> From { Nullable<Size> get (); void set (Nullable<Size> value); }
<object> <object.By> <Size /> </object.By></object>
<object From="Size"/>- or -<object From="{x:Null Markup Extension}"/>
Property Value
Type: System::Nullable<Size>The starting value of the animation. The default value is null.
The following table summarizes how the From, To, and By properties may 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. |
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. | |
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 SizeAnimationUsingKeyFrames object.
This example shows how to animate the Size property of an ArcSegment.
The following example creates an ArcSegment that animates its Size when it loads on the screen.
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > <Canvas HorizontalAlignment="Left" Margin="0" > <!-- Create an arc on the screen that animates its size when it loads. --> <Path Stroke="Black" StrokeThickness="2" > <Path.Data> <PathGeometry> <PathGeometry.Figures> <PathFigureCollection> <PathFigure StartPoint="100,200"> <PathFigure.Segments> <PathSegmentCollection> <ArcSegment x:Name="myArcSegment" Size="90,80" SweepDirection="Clockwise" Point="500,200" /> </PathSegmentCollection> </PathFigure.Segments> </PathFigure> </PathFigureCollection> </PathGeometry.Figures> </PathGeometry> </Path.Data> <Path.Triggers> <EventTrigger RoutedEvent="Path.Loaded"> <BeginStoryboard Name="myBeginStoryBoard"> <Storyboard> <!-- Animate the size of the ArcSegment to a width and height of 200. --> <SizeAnimation Storyboard.TargetName="myArcSegment" Storyboard.TargetProperty="Size" From="90,80" To="200,200" Duration="0:0:2" /> </Storyboard> </BeginStoryboard> </EventTrigger> </Path.Triggers> </Path> </Canvas> </Page>
For additional geometry and animation samples, see the Geometries Sample.
More Code
| How to: Control an Animation using From, To, and By | A "From/To/By" or "basic animation" creates a transition between two target values (see Animation Overview for an introduction to different types of animations). To set the target values of a basic animation, use its From, To, and By properties. The following table summarizes how the From, To, and By properties may be used together or separately to determine an animation's target values. |
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.