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

Int32AnimationUsingKeyFrames, classe

Anime la valeur d'une propriété Int32 en fonction d'un ensemble de KeyFrames.

System.Object
  System.Windows.Threading.DispatcherObject
    System.Windows.DependencyObject
      System.Windows.Freezable
        System.Windows.Media.Animation.Animatable
          System.Windows.Media.Animation.Timeline
            System.Windows.Media.Animation.AnimationTimeline
              System.Windows.Media.Animation.Int32AnimationBase
                System.Windows.Media.Animation.Int32AnimationUsingKeyFrames

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
[ContentPropertyAttribute("KeyFrames")]
public class Int32AnimationUsingKeyFrames : Int32AnimationBase, 
	IKeyFrameAnimation, IAddChild
<Int32AnimationUsingKeyFrames>
  KeyFrames
</Int32AnimationUsingKeyFrames>

Le type Int32AnimationUsingKeyFrames expose les membres suivants.

  Nom Description
Méthode publique Int32AnimationUsingKeyFrames Initialise une nouvelle instance de la classe Int32AnimationUsingKeyFrames.
Début
  Nom Description
Propriété publique AccelerationRatio 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. (Hérité de Timeline.)
Propriété publique AutoReverse Obtient ou définit une valeur qui indique si la chronologie repart en arrière après avoir accompli une itération en avant. (Hérité de Timeline.)
Propriété publique BeginTime Obtient ou établit l'heure à laquelle ce Timeline doit commencer. (Hérité de Timeline.)
Propriété publique CanFreeze Obtient une valeur qui indique la possibilité ou non de rendre un objet non modifiable. (Hérité de Freezable.)
Propriété publique DecelerationRatio 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. (Hérité de Timeline.)
Propriété publique DependencyObjectType Obtient le DependencyObjectType qui encapsule le type CLR de cette instance.  (Hérité de DependencyObject.)
Propriété publique Dispatcher Obtient le Dispatcher associé à DispatcherObject. (Hérité de DispatcherObject.)
Propriété publique Duration Obtient ou définit la durée de cette chronologie, sans les répétitions. (Hérité de Timeline.)
Propriété publique FillBehavior Obtient ou définit une valeur qui spécifie le comportement du Timeline une fois qu'il a atteint la fin de sa période active. (Hérité de Timeline.)
Propriété publique HasAnimatedProperties Obtient une valeur qui indique si un ou plusieurs objets AnimationClock sont associés à l'une ou l'autre des propriétés de dépendance de cet objet. (Hérité de Animatable.)
Propriété publique IsAdditive Obtient une valeur qui spécifie si la valeur de sortie de l'animation est ajoutée à la valeur de base de la propriété en cours d'animation.
Propriété publique IsCumulative Obtient ou définit une valeur qui spécifie si la valeur de l'animation est cumulée lorsqu'elle se répète.
Propriété publique IsDestinationDefault Obtient une valeur qui indique si cette animation doit utiliser le paramètre valeurDestinationDéfaut de la méthode GetCurrentValue comme valeur de destination. (Hérité de AnimationTimeline.)
Propriété publique IsFrozen Obtient une valeur qui indique si l'objet est actuellement modifiable ou pas. (Hérité de Freezable.)
Propriété publique IsSealed Récupère une valeur qui indique si cette instance est actuellement sealed (en lecture seule). (Hérité de DependencyObject.)
Propriété publique KeyFrames Obtient ou définit la collection des objets Int32KeyFrame qui définissent l'animation.
Propriété publique Name Obtient ou définit le nom de ce Timeline. (Hérité de Timeline.)
Propriété publique RepeatBehavior Obtient ou définit le comportement à répétition de cette chronologie. (Hérité de Timeline.)
Propriété publique SpeedRatio Obtient ou définit le taux de progression temporelle par rapport à son parent de ce Timeline. (Hérité de Timeline.)
Propriété publique TargetPropertyType Obtient le type de valeur généré par cette animation. (Hérité de Int32AnimationBase.)
Début
  Nom Description
Méthode protégée AddChild Ajoute un enfant Int32KeyFrame à ce Int32AnimationUsingKeyFrames.
Méthode protégée AddText Ajoute une chaîne de texte en tant qu'enfant de ce Int32AnimationUsingKeyFrames.
Méthode protégée AllocateClock Crée un Clock pour ce AnimationTimeline. (Hérité de AnimationTimeline.)
Méthode publique ApplyAnimationClock(DependencyProperty, AnimationClock) Applique une horloge AnimationClock à la propriété DependencyProperty spécifiée. Si la propriété est déjà animée, le comportement de transfert SnapshotAndReplace est utilisé. (Hérité de Animatable.)
Méthode publique ApplyAnimationClock(DependencyProperty, AnimationClock, HandoffBehavior) Applique une horloge AnimationClock à la propriété DependencyProperty spécifiée. Si la propriété spécifiée est déjà animée, le comportement HandoffBehavior spécifié est utilisé. (Hérité de Animatable.)
Méthode publique BeginAnimation(DependencyProperty, AnimationTimeline) Applique une animation à la propriété DependencyPropertyspécifiée. L'animation est démarrée à la restitution de l'image suivante. Si la propriété spécifiée est déjà animée, le comportement de transfert SnapshotAndReplace est utilisé. (Hérité de Animatable.)
Méthode publique BeginAnimation(DependencyProperty, AnimationTimeline, HandoffBehavior) Applique une animation à la propriété DependencyPropertyspécifiée. L'animation est démarrée à la restitution de l'image suivante. Si la propriété spécifiée est déjà animée, le comportement HandoffBehavior spécifié est utilisé. (Hérité de Animatable.)
Méthode publique CheckAccess Détermine si le thread appelant a accès à ce DispatcherObject. (Hérité de DispatcherObject.)
Méthode publique ClearValue(DependencyProperty) Efface la valeur de proximité d'une propriété. La propriété à effacer est spécifiée par un identificateur DependencyProperty. (Hérité de DependencyObject.)
Méthode publique ClearValue(DependencyPropertyKey) Efface la valeur de proximité d'une propriété en lecture seule. La propriété à effacer est spécifiée par un DependencyPropertyKey. (Hérité de DependencyObject.)
Méthode publique Clone Crée des clones modifiables de ce Int32AnimationUsingKeyFrames en copiant intégralement toutes ses valeurs. Lors de la copie de propriétés de dépendance, cette méthode copie les références de ressources et les liaisons de données (même si elles ne peuvent plus être résolues), mais pas les animations ni leurs valeurs actuelles.
Méthode protégée CloneCore Convertit cette instance en copie complète du Int32AnimationUsingKeyFrames spécifié. Lors de la copie de propriétés de dépendance, cette méthode copie les références des ressources et les liaisons aux données (même si elles ne peuvent plus être résolues), mais pas les animations et leurs valeurs actuelles. (Substitue Freezable.CloneCore(Freezable).)
Méthode publique CloneCurrentValue Crée un clone modifiable de cet objet Int32AnimationUsingKeyFrames, en créant des copies complètes des valeurs actuelles de cet objet. Contrairement à leurs valeurs actuelles, les références de ressources, les liaisons de données et les animations ne sont pas copiées.
Méthode protégée CloneCurrentValueCore Convertit cette instance en copie complète modifiable du Int32AnimationUsingKeyFrames spécifié à l'aide des valeurs de propriétés actuelles. Contrairement à leurs valeurs actuelles, les références de ressources, les liaisons de données et les animations ne sont pas copiées. (Substitue Freezable.CloneCurrentValueCore(Freezable).)
Méthode publique CoerceValue Force la valeur de la propriété de dépendance spécifiée. Cette opération est accomplie en appelant toute fonction CoerceValueCallback spécifiée dans les métadonnées de propriété pour la propriété de dépendance comme elle existe sur le DependencyObject appelant. (Hérité de DependencyObject.)
Méthode publique CreateClock() Crée une nouvelle horloge AnimationClock à partir de la chronologie AnimationTimeline. (Hérité de AnimationTimeline.)
Méthode publique CreateClock(Boolean) Crée un Clock à partir de ce Timeline et spécifie si le nouveau Clock est contrôlable. Si ce Timeline a des enfants, une arborescence d'horloges est alors créée avec ce Timeline en tant que racine. (Hérité de Timeline.)
Méthode protégée CreateInstance Initialise une nouvelle instance de la classe Freezable. (Hérité de Freezable.)
Méthode protégée CreateInstanceCore Crée une nouvelle instance de Int32AnimationUsingKeyFrames. (Substitue Freezable.CreateInstanceCore().)
Méthode publique Equals Détermine si un DependencyObject fourni est équivalent au DependencyObject réel. (Hérité de DependencyObject.)
Méthode protégée Finalize Autorise un objet à tenter de libérer des ressources et d'exécuter d'autres opérations de netto***ge avant qu'il ne soit récupéré par l'opération garbage collection. (Hérité de Object.)
Méthode publique Freeze() Rend l'objet actuel non modifiable et définit sa propriété IsFrozen sur true. (Hérité de Freezable.)
Méthode protégée FreezeCore Rend cette instance d'objet Int32AnimationUsingKeyFrames non modifiable ou détermine si elle peut être rendue non modifiable. (Substitue Timeline.FreezeCore(Boolean).)
Méthode publique GetAnimationBaseValue Retourne la valeur non animée de la propriété DependencyProperty spécifiée. (Hérité de Animatable.)
Méthode publique GetAsFrozen Crée une copie figée de Freezable, à l'aide des valeurs de propriété (non-animées) de base. Étant donné que la copie est figée, tous les sous-objets figés sont copiés par référence. (Hérité de Freezable.)
Méthode protégée GetAsFrozenCore Convertit cette instance en clone de l'objet spécifié Int32AnimationUsingKeyFrames. (Substitue Timeline.GetAsFrozenCore(Freezable).)
Méthode publique GetCurrentValue(Int32, Int32, AnimationClock) Obtient la valeur actuelle de l'animation. (Hérité de Int32AnimationBase.)
Méthode publique GetCurrentValue(Object, Object, AnimationClock) Obtient la valeur actuelle de l'animation. (Hérité de Int32AnimationBase.)
Méthode publique GetCurrentValueAsFrozen Crée une copie figée de Freezable à l'aide des valeurs de propriété actuelles. Étant donné que la copie est figée, tous les sous-objets figés sont copiés par référence. (Hérité de Freezable.)
Méthode protégée GetCurrentValueAsFrozenCore Convertit cette instance en clone figé du Int32AnimationUsingKeyFrames spécifié. Contrairement aux valeurs actuelles, les références de ressource, les liaisons de données et les animations ne sont pas copiées. (Substitue Timeline.GetCurrentValueAsFrozenCore(Freezable).)
Méthode protégée GetCurrentValueCore Calcule une valeur qui représente la valeur actuelle de la propriété en cours d'animation, tel que déterminé par cette instance de Int32AnimationUsingKeyFrames. (Substitue Int32AnimationBase.GetCurrentValueCore(Int32, Int32, AnimationClock).)
Méthode publique GetHashCode Obtient un code de hachage pour ce DependencyObject. (Hérité de DependencyObject.)
Méthode publique GetLocalValueEnumerator Crée un énumérateur spécialisé pour déterminer quelles propriétés de dépendance ont des valeurs définies localement sur ce DependencyObject. (Hérité de DependencyObject.)
Méthode protégée GetNaturalDuration Retourne la durée d'une seule itération de ce Timeline. (Hérité de Timeline.)
Méthode protégée GetNaturalDurationCore Fournissez un Duration naturel personnalisé lorsque la propriété Duration a la valeur Automatic. (Substitue AnimationTimeline.GetNaturalDurationCore(Clock).)
Méthode publique GetType Obtient le Type de l'instance actuelle. (Hérité de Object.)
Méthode publique GetValue Retourne la valeur effective actuelle d'une propriété de dépendance sur cette instance d'un DependencyObject. (Hérité de DependencyObject.)
Méthode publique InvalidateProperty Réévalue la valeur effective pour la propriété de dépendance spécifiée (Hérité de DependencyObject.)
Méthode protégée MemberwiseClone Crée une copie superficielle de l'objet Object actif. (Hérité de Object.)
Méthode protégée OnChanged Appelé lorsque l'objet Int32AnimationUsingKeyFrames actuel est modifié. (Substitue Freezable.OnChanged().)
Méthode protégée OnFreezablePropertyChanged(DependencyObject, DependencyObject) Garantit que les pointeurs de contexte appropriés sont établis pour un membre de données de type DependencyObjectType qui vient juste d'être défini. (Hérité de Freezable.)
Méthode protégée OnFreezablePropertyChanged(DependencyObject, DependencyObject, DependencyProperty) Ce membre prend en charge l'infrastructure Windows Presentation Foundation (WPF) et n'est pas conçu pour être utilisé directement à partir du code. (Hérité de Freezable.)
Méthode protégée OnPropertyChanged Substitue l'implémentation DependencyObject de OnPropertyChanged pour appeler également tous les gestionnaires Changed en réponse à une propriété de dépendance variable de type Freezable. (Hérité de Freezable.)
Méthode publique ReadLocalValue Retourne la valeur de proximité d'une propriété de dépendance, si elle existe. (Hérité de DependencyObject.)
Méthode protégée ReadPreamble Garantit que Freezable est accessible à partir d'un thread valide. Les héritiers de Freezable doivent appeler cette méthode au début de toute API lisant les membres de données qui ne sont pas des propriétés de dépendance. (Hérité de Freezable.)
Méthode publique SetCurrentValue Définit la valeur d'une propriété de dépendance sans modifier sa source de valeur. (Hérité de DependencyObject.)
Méthode publique SetValue(DependencyProperty, Object) Définit la valeur de proximité d'une propriété de dépendance, spécifiée par son identificateur de propriété de dépendance. (Hérité de DependencyObject.)
Méthode publique SetValue(DependencyPropertyKey, Object) Définit la valeur de proximité d'une propriété de dépendance en lecture seule, spécifiée par l'identificateur DependencyPropertyKey de la propriété de dépendance. (Hérité de DependencyObject.)
Méthode publique ShouldSerializeKeyFrames Retourne la valeur true si la valeur de la propriété KeyFrames de cette instance de Int32AnimationUsingKeyFrames doit être sérialisée par valeur.
Méthode protégée ShouldSerializeProperty Retourne une valeur qui indique si les processus de sérialisation doivent sérialiser la valeur pour la propriété de dépendance fournie. (Hérité de DependencyObject.)
Méthode publique ToString Retourne une chaîne qui représente l'objet actuel. (Hérité de Object.)
Méthode publique VerifyAccess Garantit que le thread appelant a accès à DispatcherObject. (Hérité de DispatcherObject.)
Méthode protégée WritePostscript Déclenche l'événement Changed pour Freezable et appelle sa méthode OnChanged. Les classes qui dérivent de Freezable doivent appeler cette méthode à la fin de toute API qui modifie des membres de classe non stockés en tant que propriétés de dépendance. (Hérité de Freezable.)
Méthode protégée WritePreamble Vérifie que le Freezable n'est pas figé et que son accès s'effectue à partir d'un contexte de thread valide. Les héritiers de Freezable doivent appeler cette méthode au début de toute API écrivant les membres de données qui ne sont pas des propriétés de dépendance. (Hérité de Freezable.)
Début
  Nom Description
Événement public Changed Se produit lorsque Freezable ou un objet qu'il contient est modifié. (Hérité de Freezable.)
Événement public Completed Se produit lorsque cette chronologie est complètement terminée et n'entrera plus dans sa période active. (Hérité de Timeline.)
Événement public CurrentGlobalSpeedInvalidated Se produit lorsque le taux auquel l'heure progresse pour l'horloge de la chronologie change. (Hérité de Timeline.)
Événement public CurrentStateInvalidated Se produit lorsque la propriété CurrentState du Clock de la chronologie est mise à jour. (Hérité de Timeline.)
Événement public CurrentTimeInvalidated Se produit lorsque la propriété CurrentTime du Clock de la chronologie est mise à jour. (Hérité de Timeline.)
Événement public RemoveRequested Se produit lorsque l'horloge créée pour cette chronologie ou une de ses chronologies parentes est supprimée. (Hérité de Timeline.)
Début
  Nom Description
Implémentation d'interface explicite Méthode privée IAddChild.AddChild Ajoute un objet enfant.
Implémentation d'interface explicite Méthode privée IAddChild.AddText Ajoute le texte d'un nœud à l'objet.
Implémentation d'interface explicite Propriété privée IKeyFrameAnimation.KeyFrames Obtient ou définit un collection ordonnée P:System.Windows.Media.Animation.IKeyFrameAnimation.KeyFrames associée à cette séquence d'animation.
Début

Les valeurs cibles de l'animation d'une image clé sont définies par sa propriété KeyFrames, laquelle contient une collection d'objets Int32KeyFrame. Chaque Int32KeyFrame définit un segment de l'animation avec ses propres Value et KeyTime cibles. Lors de l'exécution de l'animation, celle-ci passe d'une valeur de clé à la suivante en fonction des périodes de clé spécifiées.

Il existe trois types de classes Int32KeyFrame, une par méthode d'interpolation prise en charge : LinearInt32KeyFrame, DiscreteInt32KeyFrameet SplineInt32KeyFrame.

Contrairement à un Int32Animation, un Int32AnimationUsingKeyFrames peut avoir plus de deux valeurs cibles. Vous pouvez également contrôler la méthode d'interpolation des segments Int32KeyFrame individuels.

This example shows how to animate the value of a property that takes a Double by using key frames.

The following example moves a rectangle across a screen. The example uses the DoubleAnimationUsingKeyFrames class to animate the X property of a TranslateTransform applied to a Rectangle. This animation, which repeats indefinitely, uses three key frames in the following manner:

  1. During the first three seconds, uses an instance of the LinearDoubleKeyFrame class to move the rectangle along a path at a steady rate from its starting position to the 500 position. Linear key frames like LinearDoubleKeyFrame create a smooth linear transition between values.

  2. At the end of the fourth second, uses an instance of the DiscreteDoubleKeyFrame class to suddenly move the rectangle to the next position. Discrete key frames like DiscreteDoubleKeyFrame create sudden jumps between values. In this example, the rectangle is at the starting position and then suddenly appears at the 500 position.

  3. In the final two seconds, uses an instance of the SplineDoubleKeyFrame class to move the rectangle back to its starting position. Spline key frames like SplineDoubleKeyFrame create a variable transition between values according to the value of the KeySpline property. In this example, the rectangle begins by moving slowly and then speeds up exponentially toward the end of the time segment.


using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Shapes;
using System.Windows.Media.Animation;
using System.Windows.Media;

namespace Microsoft.Samples.KeyFrameExamples
{
    /// <summary>
    /// This example shows how to use the DoubleAnimationUsingKeyFrames class to
    /// animate the position of an object.
    /// Key frame animations enable you to create complex animations 
    /// by specifying multiple destination values
    /// and controlling the animation's interpolation method.
    /// </summary>
    public class AltDoubleAnimationUsingKeyFramesExample : Page
    {
        public AltDoubleAnimationUsingKeyFramesExample()
        {
            Title = "DoubleAnimationUsingKeyFrames Example";
            Background = Brushes.White;
            Margin = new Thickness(20);

            // Create a NameScope for this page so that
            // Storyboards can be used.
            NameScope.SetNameScope(this, new NameScope());

            // Create a rectangle.
            Rectangle aRectangle = new Rectangle();
            aRectangle.Width = 100;
            aRectangle.Height = 100;
            aRectangle.Stroke = Brushes.Black;
            aRectangle.StrokeThickness = 5;

            // Create a Canvas to contain and
            // position the rectangle.
            Canvas containerCanvas = new Canvas();
            containerCanvas.Width = 610;
            containerCanvas.Height = 300;
            containerCanvas.Children.Add(aRectangle);
            Canvas.SetTop(aRectangle, 100);
            Canvas.SetLeft(aRectangle, 10);         

            // Create a TranslateTransform to 
            // move the rectangle.
            TranslateTransform animatedTranslateTransform = 
                new TranslateTransform();
            aRectangle.RenderTransform = animatedTranslateTransform;  

            // Assign the TranslateTransform a name so that
            // it can be targeted by a Storyboard.
            this.RegisterName(
                "AnimatedTranslateTransform", animatedTranslateTransform);

            // Create a DoubleAnimationUsingKeyFrames to
            // animate the TranslateTransform.
            DoubleAnimationUsingKeyFrames translationAnimation 
                = new DoubleAnimationUsingKeyFrames();
            translationAnimation.Duration = TimeSpan.FromSeconds(6);

            // Animate from the starting position to 500
            // over the first second using linear
            // interpolation.
            translationAnimation.KeyFrames.Add(
                new LinearDoubleKeyFrame(
                    500, // Target value (KeyValue)
                    KeyTime.FromTimeSpan(TimeSpan.FromSeconds(3))) // KeyTime
                );

            // Animate from 500 (the value of the previous key frame) 
            // to 400 at 4 seconds using discrete interpolation.
            // Because the interpolation is discrete, the rectangle will appear
            // to "jump" from 500 to 400.
            translationAnimation.KeyFrames.Add(
                new DiscreteDoubleKeyFrame(
                    400, // Target value (KeyValue)
                    KeyTime.FromTimeSpan(TimeSpan.FromSeconds(4))) // KeyTime
                );

            // Animate from 400 (the value of the previous key frame) to 0
            // over two seconds, starting at 4 seconds (the key time of the
            // last key frame) and ending at 6 seconds.
            translationAnimation.KeyFrames.Add(
                new SplineDoubleKeyFrame(
                    0, // Target value (KeyValue)
                    KeyTime.FromTimeSpan(TimeSpan.FromSeconds(6)), // KeyTime
                    new KeySpline(0.6,0.0,0.9,0.0) // KeySpline
                    )
                );

            // Set the animation to repeat forever. 
            translationAnimation.RepeatBehavior = RepeatBehavior.Forever;

            // Set the animation to target the X property
            // of the object named "AnimatedTranslateTransform."
            Storyboard.SetTargetName(translationAnimation, "AnimatedTranslateTransform");
            Storyboard.SetTargetProperty(
                translationAnimation, new PropertyPath(TranslateTransform.XProperty));

            // Create a storyboard to apply the animation.
            Storyboard translationStoryboard = new Storyboard();
            translationStoryboard.Children.Add(translationAnimation);

            // Start the storyboard after the rectangle loads.
            aRectangle.Loaded += delegate(object sender, RoutedEventArgs e)
            {
                translationStoryboard.Begin(this);
            };

            Content = containerCanvas;
        }

    }
}



<!-- This example shows how to use the DoubleAnimationUsingKeyFrames to 
     animate the position of an object. 
     Key frame animations enable you to create complex animations 
     by specifying multiple destination values
     and controlling the animation's interpolation method.
-->
<Page 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Title="DoubleAnimationUsingKeyFrames Example"
  Background="White" Margin="20">       
  <Canvas Width="610" Height="300">

    <!-- The position of this rectangle is animated using 
         a key frame animation. -->
    <Rectangle 
      Canvas.Top="100"
      Canvas.Left="10"
      Height="100"
      Width="100"
      Stroke="Black"
      StrokeThickness="5">
      <Rectangle.RenderTransform>
        <TranslateTransform x:Name="AnimatedTranslateTransform" />
      </Rectangle.RenderTransform>

      <Rectangle.Triggers>
        <EventTrigger RoutedEvent="Rectangle.Loaded">
          <BeginStoryboard>
            <Storyboard>

              <!-- Animate the TranslateTransform.X property using 3 KeyFrames
                   which animates the rectangle along a straight line. 
                   This animation repeats indefinitely. -->
              <DoubleAnimationUsingKeyFrames
                Storyboard.TargetName="AnimatedTranslateTransform"
                Storyboard.TargetProperty="X"
                Duration="0:0:6"
                RepeatBehavior="Forever">

                <!-- Using a LinearDoubleKeyFrame, the rectangle moves 
                     steadily from its starting position to 500 over 
                     the first 3 seconds.  -->
                <LinearDoubleKeyFrame Value="500" KeyTime="0:0:3" />

                <!-- Using a DiscreteDoubleKeyFrame, the rectangle suddenly 
                     appears at 400 after the fourth second of the animation. -->
                <DiscreteDoubleKeyFrame Value="400" KeyTime="0:0:4" />

                <!-- Using a SplineDoubleKeyFrame, the rectangle moves 
                     back to its starting point. The
                     animation starts out slowly at first and then speeds up. 
                     This KeyFrame ends after the 6th
                     second. -->
                <SplineDoubleKeyFrame KeySpline="0.6,0.0 0.9,0.00" Value="0" KeyTime="0:0:6" />
              </DoubleAnimationUsingKeyFrames>
            </Storyboard>
          </BeginStoryboard>
        </EventTrigger>
      </Rectangle.Triggers>
    </Rectangle>
  </Canvas>
</Page>


For the complete sample, see KeyFrame Animation Sample.

For consistency with other animation examples, the code versions of this example use a Storyboard object to apply the DoubleAnimationUsingKeyFrames. Alternatively, when applying a single animation in code, it is simpler to use the BeginAnimation method instead of using a Storyboard. For an example, see Comment : animer une propriété sans utiliser de storyboard.

.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.
Tous les membres static (Shared en Visual Basic) publics de ce type sont thread-safe. Il n'est pas garanti que les membres d'instance soient thread-safe.
Cela vous a-t-il été utile ?
(1500 caractères restants)
Contenu de la communauté Ajouter
Annotations FAQ
Microsoft réalise une enquête en ligne pour recueillir votre opinion sur le site Web de MSDN. Si vous choisissez d’y participer, cette enquête en ligne vous sera présentée lorsque vous quitterez le site Web de MSDN.

Si vous souhaitez y participer,