Cet article a fait l'objet d'une traduction manuelle. Déplacez votre pointeur sur les phrases de l'article pour voir la version originale de ce texte. |
Traduction
Source
|
Timeline.AccelerationRatio, propriété
Obtient ou définit une valeur spécifiant le pourcentage du Duration de la chronologie nécessaire à l'accélération temporelle pour passer de zéro à son taux maximal.
Assembly : PresentationCore (dans PresentationCore.dll)
XMLNS pour XAML : http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
<object AccelerationRatio="double" .../>
Valeur de propriété
Type : System.DoubleValeur entre 0 et 1 compris, qui spécifie le pourcentage du Duration de la chronologie nécessaire à l'accélération temporelle pour passer de zéro à son taux maximal. Si la propriété DecelerationRatio de la chronologie est également définie, la somme de AccelerationRatio et de DecelerationRatio doit être inférieure ou égale à 1. La valeur par défaut est 0.
| Exception | Condition |
|---|---|
| ArgumentException |
AccelerationRatio est inférieur à 0 ou supérieur à 1. |
| InvalidOperationException |
La somme de AccelerationRatio et de DecelerationRatio dépasse 1. |
Utilisez la propriété AccelerationRatio pour créer des animations qui démarrent lentement, puis s'accélèrent petit à petit. La propriété AccelerationRatio s'avère utile pour créer des effets avec atténuation + ou faire en sorte que le mouvement paraisse plus naturel. Utilisez les propriétés AccelerationRatio et DecelerationRatio ensemble pour créer des animations qui démarrent lentement, s'accélèrent, puis ralentissent avant de s'arrêter.
This example demonstrates how to make an animation accelerate and decelerate over time. In the following example, several rectangles are animated by animations with different AccelerationRatio and DecelerationRatio settings.
<!-- This example shows how to use the AccelerationRatio and DecelerationRatio properties of timelines to make animations speed up or slow down as they progress. --> <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:SampleControls="SampleControls" WindowTitle="Acceleration and Deceleration Example"> <StackPanel Margin="20"> <Rectangle Name="nonAcceleratedOrDeceleratedRectangle" Fill="#9933FF" Width="10" Height="20" HorizontalAlignment="Left" /> <Rectangle Name="acceleratedRectangle" Fill="#3333FF" Width="10" Height="20" HorizontalAlignment="Left" /> <Rectangle Name="deceleratedRectangle" Fill="#33FF66" Width="10" Height="20" HorizontalAlignment="Left" /> <Rectangle Name="acceleratedAndDeceleratedRectangle" Fill="#CCFF33" Width="10" Height="20" HorizontalAlignment="Left" /> <!-- Create a button to start the animations. --> <Button Margin="0,30,0,0" HorizontalAlignment="Left" Content="Start Animations"> <Button.Triggers> <EventTrigger RoutedEvent="Button.Click"> <BeginStoryboard> <Storyboard> <!-- Creates an animation without acceleration or deceleration for comparison. --> <DoubleAnimation Storyboard.TargetName="nonAcceleratedOrDeceleratedRectangle" Storyboard.TargetProperty="(Rectangle.Width)" Duration="0:0:10" From="20" To="400" /> <!-- Creates an animation that accelerates through 40% of its duration. --> <DoubleAnimation Storyboard.TargetName="acceleratedRectangle" Storyboard.TargetProperty="(Rectangle.Width)" AccelerationRatio="0.4" Duration="0:0:10" From="20" To="400" /> <!-- Creates an animation that decelerates through 60% of its duration. --> <DoubleAnimation Storyboard.TargetName="deceleratedRectangle" Storyboard.TargetProperty="(Rectangle.Width)" DecelerationRatio="0.6" Duration="0:0:10" From="20" To="400" /> <!-- Creates an animation that accelerates through 40% of its duration and decelerates through the 60% of its duration. --> <DoubleAnimation Storyboard.TargetName="acceleratedAndDeceleratedRectangle" Storyboard.TargetProperty="(Rectangle.Width)" AccelerationRatio="0.4" DecelerationRatio="0.6" Duration="0:0:10" From="20" To="400" /> </Storyboard> </BeginStoryboard> </EventTrigger> </Button.Triggers> </Button> </StackPanel> </Page>
Code has been omitted from this example. For the complete code, see the Animation Timing Behavior Sample.
Windows 7, Windows Vista SP1 ou ultérieur, Windows XP SP3, Windows Server 2008 (installation minimale non prise en charge), Windows Server 2008 R2 (installation minimale prise en charge avec SP1 ou version ultérieure), Windows Server 2003 SP2
Le .NET Framework ne prend pas en charge toutes les versions de chaque plateforme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise du .NET Framework.