Gets or sets the total amount by which the animation changes its starting value.
Assembly: PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
Use the property when you want to animate a value "by" a certain amount, rather than specifying a starting or ending value. You may also use the property with the From property. The following table summarizes how the From, To, and properties may be used together or separately to determine an animation's target values.
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.
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 property.
To use other interpolation methods or animate between more than two target values, use a Point3DAnimationUsingKeyFrames object.
The following example shows how to animate the position of a camera and animate the direction it is pointing in a 3D scene. This is done by using Point3DAnimation and Vector3DAnimation to animate the Position and LookDirection properties respectively of the PerspectiveCamera. You might use an animation like this to change the onlooker's view of a scene in response to an event.
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > <DockPanel> <Viewbox> <Canvas Width="321" Height="201"> <Viewport3D Name="MyAnimatedObject" ClipToBounds="True" Width="150" Height="150" Canvas.Left="0" Canvas.Top="10"> <!-- Defines the camera used to view the 3D object. The position and direction of this camera is animated in the Storyboard below. --> <Viewport3D.Camera> <PerspectiveCamera x:Name="myPerspectiveCamera" Position="0,0,2" LookDirection="0,0,-1" FieldOfView="45" /> </Viewport3D.Camera> <Viewport3D.Children> <ModelVisual3D> <ModelVisual3D.Children> <!-- This resource defines the 3D cube that is used in this example.--> <StaticResource ResourceKey="PictureCubeModelVisual3DResource" /> </ModelVisual3D.Children> </ModelVisual3D> </Viewport3D.Children> <Viewport3D.Triggers> <EventTrigger RoutedEvent="Viewport3D.Loaded"> <BeginStoryboard> <Storyboard> <!-- This animation moves the camera around the object. The object is not changing position or rotating but moving the camera makes it appear that it is.--> <Point3DAnimation Storyboard.TargetName="myPerspectiveCamera" Storyboard.TargetProperty="Position" From="0,0,2" To="1,2,3" Duration="0:0:4" RepeatBehavior="Forever"/> <!-- As the position of the camera changes using the Point3DAnimation above, the direction the camera is pointing swivels to keep the object within the view of the camera. --> <Vector3DAnimation Storyboard.TargetName="myPerspectiveCamera" Storyboard.TargetProperty="LookDirection" From="0,0,-1" To="-1,-2,-3" Duration="0:0:4" RepeatBehavior="Forever"/> </Storyboard> </BeginStoryboard> </EventTrigger> </Viewport3D.Triggers> </Viewport3D> </Canvas> </Viewbox> </DockPanel> </Page>
|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.|