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
Ce sujet n'a pas encore été évalué - Évaluez ce sujet

Timeline.DecelerationRatio, propriété

Obtient ou définit une valeur spécifiant le pourcentage du Duration de la chronologie nécessaire à la décélération temporelle pour passer de son taux maximal à zéro.

Espace de noms :  System.Windows.Media.Animation
Assembly :  PresentationCore (dans PresentationCore.dll)
XMLNS pour XAML : http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
public double DecelerationRatio { get; set; }
<object DecelerationRatio="double" .../>

Valeur de propriété

Type : System.Double
Valeur entre 0 et 1 compris, qui spécifie le pourcentage du Duration de la chronologie nécessaire à la décélération temporelle pour passer de son taux maximal à zéro. Si la propriété AccelerationRatio de la chronologie est également définie, la somme de DecelerationRatio et de AccelerationRatio doit être inférieure ou égale à 1. La valeur par défaut est 0.

Champ d'identificateur

DecelerationRatioProperty

Propriétés de métadonnées ayant la valeur true

Aucun

Exception Condition
ArgumentException

DecelerationRatio est inférieur à 0 ou supérieur à 1.

InvalidOperationException

La somme de AccelerationRatio et de DecelerationRatio dépasse 1.

Utilisez la propriété DecelerationRatio pour créer des animations qui ralentissent avant de s'arrêter. La propriété DecelerationRatio 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.

.NET Framework

Pris en charge dans : 4, 3.5, 3.0

.NET Framework Client Profile

Pris en charge dans : 4, 3.5 SP1

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.
Cela vous a-t-il été utile ?
(1500 caractères restants)
Contenu de la communauté Ajouter
Annotations FAQ