Suggérer une traduction
 
Suggestions d'autres utilisateurs :

progress indicator
Aucune autre suggestion.
Cliquez pour évaluer et commenter
MSDN
MSDN Library
Développement .NET
.NET Framework 4
Espaces de noms System.Windows
System.Windows.Media.Animation
Réduire tout/Développer tout Réduire tout
Affichage du contenu :  côte à côteAffichage du contenu : côte à côte
.NET Framework Class Library
ObjectAnimationUsingKeyFrames Class

Animates the value of an Object property along a set of KeyFrames over a specified Duration.

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
Visual Basic
<ContentPropertyAttribute("KeyFrames")> _
Public Class ObjectAnimationUsingKeyFrames _
    Inherits ObjectAnimationBase _
    Implements IKeyFrameAnimation, IAddChild
C#
[ContentPropertyAttribute("KeyFrames")]
public class ObjectAnimationUsingKeyFrames : ObjectAnimationBase, 
    IKeyFrameAnimation, IAddChild
Visual C++
[ContentPropertyAttribute(L"KeyFrames")]
public ref class ObjectAnimationUsingKeyFrames : public ObjectAnimationBase, 
    IKeyFrameAnimation, IAddChild
F#
[<ContentPropertyAttribute("KeyFrames")>]
type ObjectAnimationUsingKeyFrames =  
    class
        inherit ObjectAnimationBase
        interface IKeyFrameAnimation
        interface IAddChild
    end
XAML Object Element Usage
<ObjectAnimationUsingKeyFrames>
  KeyFrames
</ObjectAnimationUsingKeyFrames>

The ObjectAnimationUsingKeyFrames type exposes the following members.

  NameDescription
Public methodObjectAnimationUsingKeyFramesInitializes a new instance of the ObjectAnimationUsingKeyFrames class.
Top
  NameDescription
Public propertyAccelerationRatioGets or sets a value specifying the percentage of the timeline's Duration spent accelerating the passage of time from zero to its maximum rate. (Inherited from Timeline.)
Public propertyAutoReverseGets or sets a value that indicates whether the timeline plays in reverse after it completes a forward iteration. (Inherited from Timeline.)
Public propertyBeginTimeGets or sets the time at which this Timeline should begin. (Inherited from Timeline.)
Public propertyCanFreezeGets a value that indicates whether the object can be made unmodifiable. (Inherited from Freezable.)
Public propertyDecelerationRatioGets or sets a value specifying the percentage of the timeline's Duration spent decelerating the passage of time from its maximum rate to zero. (Inherited from Timeline.)
Public propertyDependencyObjectTypeGets the DependencyObjectType that wraps the CLR type of this instance.  (Inherited from DependencyObject.)
Public propertyDispatcherGets the Dispatcher this DispatcherObject is associated with. (Inherited from DispatcherObject.)
Public propertyDurationGets or sets the length of time for which this timeline plays, not counting repetitions. (Inherited from Timeline.)
Public propertyFillBehaviorGets or sets a value that specifies how the Timeline behaves after it reaches the end of its active period. (Inherited from Timeline.)
Public propertyHasAnimatedPropertiesGets a value that indicates whether one or more AnimationClock objects is associated with any of this object's dependency properties. (Inherited from Animatable.)
Public propertyIsDestinationDefaultGets a value that indicates whether this animation uses the defaultDestinationValue parameter of the GetCurrentValue method as its destination value. (Inherited from AnimationTimeline.)
Public propertyIsFrozenGets a value that indicates whether the object is currently modifiable. (Inherited from Freezable.)
Public propertyIsSealedGets a value that indicates whether this instance is currently sealed (read-only). (Inherited from DependencyObject.)
Public propertyKeyFrames Gets or sets the collection of ObjectKeyFrame objects that define the animation.
Public propertyName Gets or sets the name of this Timeline. (Inherited from Timeline.)
Public propertyRepeatBehaviorGets or sets the repeating behavior of this timeline. (Inherited from Timeline.)
Public propertySpeedRatioGets or sets the rate, relative to its parent, at which time progresses for this Timeline. (Inherited from Timeline.)
Public propertyTargetPropertyTypeGets the type of value this animation generates. (Inherited from ObjectAnimationBase.)
Top
  NameDescription
Protected methodAddChildAdds a child ObjectKeyFrame to this ObjectAnimationUsingKeyFrames.
Protected methodAddTextAdds a text string as a child of this ObjectAnimationUsingKeyFrames.
Protected methodAllocateClockCreates a Clock for this AnimationTimeline. (Inherited from AnimationTimeline.)
Public methodApplyAnimationClock(DependencyProperty, AnimationClock)Applies an AnimationClock to the specified DependencyProperty. If the property is already animated, the SnapshotAndReplace handoff behavior is used. (Inherited from Animatable.)
Public methodApplyAnimationClock(DependencyProperty, AnimationClock, HandoffBehavior)Applies an AnimationClock to the specified DependencyProperty. If the property is already animated, the specified HandoffBehavior is used. (Inherited from Animatable.)
Public methodBeginAnimation(DependencyProperty, AnimationTimeline)Applies an animation to the specified DependencyProperty. The animation is started when the next frame is rendered. If the specified property is already animated, the SnapshotAndReplace handoff behavior is used. (Inherited from Animatable.)
Public methodBeginAnimation(DependencyProperty, AnimationTimeline, HandoffBehavior)Applies an animation to the specified DependencyProperty. The animation is started when the next frame is rendered. If the specified property is already animated, the specified HandoffBehavior is used. (Inherited from Animatable.)
Public methodCheckAccessDetermines whether the calling thread has access to this DispatcherObject. (Inherited from DispatcherObject.)
Public methodClearValue(DependencyProperty)Clears the local value of a property. The property to be cleared is specified by a DependencyProperty identifier. (Inherited from DependencyObject.)
Public methodClearValue(DependencyPropertyKey)Clears the local value of a read-only property. The property to be cleared is specified by a DependencyPropertyKey. (Inherited from DependencyObject.)
Public methodCloneCreates a modifiable clone of this ObjectAnimationUsingKeyFrames, making deep copies of this object's values. When copying dependency properties, this method copies resource references and data bindings (but they might no longer resolve) but not animations or their current values.
Protected methodCloneCoreMakes this instance a deep copy of the specified ObjectAnimationUsingKeyFrames. When copying dependency properties, this method copies resource references and data bindings (but they might no longer resolve) but not animations or their current values. (Overrides Freezable..::.CloneCore(Freezable).)
Public methodCloneCurrentValueCreates a modifiable clone of this ObjectAnimationUsingKeyFrames object, making deep copies of this object's current values. Resource references, data bindings, and animations are not copied, but their current values are.
Protected methodCloneCurrentValueCoreMakes this instance a modifiable deep copy of the specified ObjectAnimationUsingKeyFrames using current property values. Resource references, data bindings, and animations are not copied, but their current values are. (Overrides Freezable..::.CloneCurrentValueCore(Freezable).)
Public methodCoerceValueCoerces the value of the specified dependency property. This is accomplished by invoking any CoerceValueCallback function specified in property metadata for the dependency property as it exists on the calling DependencyObject. (Inherited from DependencyObject.)
Public methodCreateClock()()()Creates a new AnimationClock from this AnimationTimeline. (Inherited from AnimationTimeline.)
Public methodCreateClock(Boolean)Creates a new Clock from this Timeline and specifies whether the new Clock is controllable. If this Timeline has children, a tree of clocks is created with this Timeline as the root. (Inherited from Timeline.)
Protected methodCreateInstanceInitializes a new instance of the Freezable class. (Inherited from Freezable.)
Protected methodCreateInstanceCoreCreates a new instance of ObjectAnimationUsingKeyFrames. (Overrides Freezable..::.CreateInstanceCore()()().)
Public methodEqualsDetermines whether a provided DependencyObject is equivalent to the current DependencyObject. (Inherited from DependencyObject.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodFreeze()()()Makes the current object unmodifiable and sets its IsFrozen property to true. (Inherited from Freezable.)
Protected methodFreezeCoreMakes this instance of ObjectAnimationUsingKeyFrames object is read-only or determines whether it can be made read-only. (Overrides Timeline..::.FreezeCore(Boolean).)
Public methodGetAnimationBaseValueReturns the non-animated value of the specified DependencyProperty. (Inherited from Animatable.)
Public methodGetAsFrozenCreates a frozen copy of the Freezable, using base (non-animated) property values. Because the copy is frozen, any frozen sub-objects are copied by reference. (Inherited from Freezable.)
Protected methodGetAsFrozenCoreMakes this instance a clone of the specified ObjectAnimationUsingKeyFrames object. (Overrides Timeline..::.GetAsFrozenCore(Freezable).)
Public methodGetCurrentValueGets the current value of the animation. (Inherited from ObjectAnimationBase.)
Public methodGetCurrentValueAsFrozenCreates a frozen copy of the Freezable using current property values. Because the copy is frozen, any frozen sub-objects are copied by reference. (Inherited from Freezable.)
Protected methodGetCurrentValueAsFrozenCoreMakes this instance a frozen clone of the specified ObjectAnimationUsingKeyFrames. Resource references, data bindings, and animations are not copied, but their current values are. (Overrides Timeline..::.GetCurrentValueAsFrozenCore(Freezable).)
Protected methodGetCurrentValueCore Calculates a value that represents the current value of the property being animated, as determined by this instance of ObjectAnimationUsingKeyFrames. (Overrides ObjectAnimationBase..::.GetCurrentValueCore(Object, Object, AnimationClock).)
Public methodGetHashCodeGets a hash code for this DependencyObject. (Inherited from DependencyObject.)
Public methodGetLocalValueEnumeratorCreates a specialized enumerator for determining which dependency properties have locally set values on this DependencyObject. (Inherited from DependencyObject.)
Protected methodGetNaturalDurationReturns the length of a single iteration of this Timeline. (Inherited from Timeline.)
Protected methodGetNaturalDurationCoreProvide a custom natural Duration when the Duration property is set to Automatic. (Overrides AnimationTimeline..::.GetNaturalDurationCore(Clock).)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodGetValueReturns the current effective value of a dependency property on this instance of a DependencyObject. (Inherited from DependencyObject.)
Public methodInvalidatePropertyRe-evaluates the effective value for the specified dependency property (Inherited from DependencyObject.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Protected methodOnChangedCalled when the current ObjectAnimationUsingKeyFrames object is modified. (Overrides Freezable..::.OnChanged()()().)
Protected methodOnFreezablePropertyChanged(DependencyObject, DependencyObject)Ensures that appropriate context pointers are established for a DependencyObjectType data member that has just been set. (Inherited from Freezable.)
Protected methodOnFreezablePropertyChanged(DependencyObject, DependencyObject, DependencyProperty)This member supports the Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code. (Inherited from Freezable.)
Protected methodOnPropertyChangedOverrides the DependencyObject implementation of OnPropertyChanged to also invoke any Changed handlers in response to a changing dependency property of type Freezable. (Inherited from Freezable.)
Public methodReadLocalValueReturns the local value of a dependency property, if it exists. (Inherited from DependencyObject.)
Protected methodReadPreambleEnsures that the Freezable is being accessed from a valid thread. Inheritors of Freezable must call this method at the beginning of any API that reads data members that are not dependency properties. (Inherited from Freezable.)
Public methodSetCurrentValueSets the value of a dependency property without changing its value source. (Inherited from DependencyObject.)
Public methodSetValue(DependencyProperty, Object)Sets the local value of a dependency property, specified by its dependency property identifier. (Inherited from DependencyObject.)
Public methodSetValue(DependencyPropertyKey, Object)Sets the local value of a read-only dependency property, specified by the DependencyPropertyKey identifier of the dependency property. (Inherited from DependencyObject.)
Public methodShouldSerializeKeyFramesReturns true if the value of the KeyFrames property of this instance of ObjectAnimationUsingKeyFrames should be value-serialized.
Protected methodShouldSerializePropertyReturns a value that indicates whether serialization processes should serialize the value for the provided dependency property. (Inherited from DependencyObject.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Public methodVerifyAccessEnforces that the calling thread has access to this DispatcherObject. (Inherited from DispatcherObject.)
Protected methodWritePostscriptRaises the Changed event for the Freezable and invokes its OnChanged method. Classes that derive from Freezable should call this method at the end of any API that modifies class members that are not stored as dependency properties. (Inherited from Freezable.)
Protected methodWritePreambleVerifies that the Freezable is not frozen and that it is being accessed from a valid threading context. Freezable inheritors should call this method at the beginning of any API that writes to data members that are not dependency properties. (Inherited from Freezable.)
Top
  NameDescription
Public eventChangedOccurs when the Freezable or an object it contains is modified. (Inherited from Freezable.)
Public eventCompletedOccurs when this timeline has completely finished playing: it will no longer enter its active period. (Inherited from Timeline.)
Public eventCurrentGlobalSpeedInvalidatedOccurs when the rate at which time progresses for the timeline's clock changes. (Inherited from Timeline.)
Public eventCurrentStateInvalidatedOccurs when the CurrentState property of the timeline's Clock is updated. (Inherited from Timeline.)
Public eventCurrentTimeInvalidatedOccurs when the CurrentTime property of the timeline's Clock is updated. (Inherited from Timeline.)
Public eventRemoveRequestedOccurs when the clock created for this timeline or one of its parent timelines is removed. (Inherited from Timeline.)
Top
  NameDescription
Explicit interface implemetationPrivate methodIAddChild..::.AddChildAdds a child object.
Explicit interface implemetationPrivate methodIAddChild..::.AddTextAdds the text content of a node to the object.
Explicit interface implemetationPrivate propertyIKeyFrameAnimation..::.KeyFramesGets or sets an ordered collection P:System.Windows.Media.Animation.IKeyFrameAnimation.KeyFrames associated with this animation sequence.
Top

A key frame animation's target values are defined by its KeyFrames property, which contains a collection of ObjectKeyFrame objects. Each ObjectKeyFrame defines a segment of the animation with its own target Value and KeyTime. When the animation runs, it progresses from one key value to the next at the specified key times.

Animating the Key Frames of an ObjectAnimationUsingKeyFrames

You can't animate an object that is the output of another animation. For example, if you use an ObjectAnimationUsingKeyFrames to animate the Fill of a Rectangle from a RadialGradientBrush to a SolidColorBrush, you can't animate any properties of the RadialGradientBrush or SolidColorBrush.

This example shows how to animate an object, which in this example is the Background property of a Page control, by using key frames.

The following example uses the ObjectAnimationUsingKeyFrames class to animate color changes for the Background property of a Page control. The example animation changes to a different background brush at regular intervals. This animation uses the DiscreteObjectKeyFrame class to create three different key frames. The animation uses key frames in the following manner:

  1. At the end of the first second, animates an instance of the LinearGradientBrush class. This section of the example applies a linear gradient to the background color so that the color transitions from yellow to orange to red.

  2. At the end of the next second, animates an instance of the RadialGradientBrush class. This section of the example applies a radial gradient to the background color so that the color transitions from white to blue to black.

  3. At the end of the third second, animates an instance of the DrawingBrush class. This section of the example applies a checkerboard pattern to the background.

  4. The animation begins again and repeats indefinitely.

NoteNote

DiscreteObjectKeyFrame is the only type of key frame that you can use with the ObjectAnimationUsingKeyFrames class. Key frames like DiscreteObjectKeyFrame create sudden changes in values, that is, the color changes in this example occur suddenly.

XAML
<Page 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
    <Page.Triggers>
      <EventTrigger RoutedEvent="Page.Loaded">
        <BeginStoryboard>
          <Storyboard>

            <!-- ObjectAnimationUsingKeyFrames is used to animate properties that take
                 an object as a value. This animation lasts for 4 seconds using 3 KeyFrames which
                 swap different brush objects at regular intervals, making the background of the Page
                 change. -->
            <ObjectAnimationUsingKeyFrames
              Storyboard.TargetProperty="Background"
              Duration="0:0:4" RepeatBehavior="Forever">
            <ObjectAnimationUsingKeyFrames.KeyFrames>

              <!-- Note: Only discrete interpolation (DiscreteObjectKeyFrame) is available for 
              use with ObjectAnimationUsingKeyFrames which merely swaps objects according to
              a specified timeline. Other types of interpolation are too problematic to apply
              to objects.  -->

              <!-- Using a DiscreteObjectKeyFrame, the Page Background suddenly changes 
                   to a LinearGradientBrush after the first second of the animation. -->
              <DiscreteObjectKeyFrame KeyTime="0:0:1">
                <DiscreteObjectKeyFrame.Value>
                  <LinearGradientBrush>
                    <LinearGradientBrush.GradientStops>
                      <GradientStop Color="Yellow" Offset="0.0" />
                      <GradientStop Color="Orange" Offset="0.5" />
                      <GradientStop Color="Red" Offset="1.0" />
                    </LinearGradientBrush.GradientStops>
                  </LinearGradientBrush>
                </DiscreteObjectKeyFrame.Value>
              </DiscreteObjectKeyFrame>

              <!-- Using a DiscreteObjectKeyFrame, the Page Background suddenly changes 
                   to a RadialGradientBrush after the second second of the animation. -->
              <DiscreteObjectKeyFrame KeyTime="0:0:2">
                <DiscreteObjectKeyFrame.Value>
                  <RadialGradientBrush GradientOrigin="0.75,0.25">
                    <RadialGradientBrush.GradientStops>
                      <GradientStop Color="White" Offset="0.0" />
                      <GradientStop Color="MediumBlue" Offset="0.5" />
                      <GradientStop Color="Black" Offset="1.0" />
                    </RadialGradientBrush.GradientStops>
                  </RadialGradientBrush>
                </DiscreteObjectKeyFrame.Value>
              </DiscreteObjectKeyFrame>

              <!-- Using a DiscreteObjectKeyFrame, the Page Background suddenly 
                   changes to a DrawingBrush (creates a checkerboard pattern) after the 
                   third second of the animation. -->
              <DiscreteObjectKeyFrame KeyTime="0:0:3">
                <DiscreteObjectKeyFrame.Value>
                  <DrawingBrush Viewport="0,0,0.25,0.25" TileMode="Tile">
                    <DrawingBrush.Drawing>
                      <DrawingGroup>
                        <DrawingGroup.Children>
                          <GeometryDrawing Brush="White">
                            <GeometryDrawing.Geometry>
                              <RectangleGeometry Rect="0,0,1,1" />
                            </GeometryDrawing.Geometry>
                          </GeometryDrawing>
                          <GeometryDrawing Brush="Black"
                           Geometry="M 0,0 L0,0.5 0.5,0.5 0.5,1 1,1 1,0.5 0.5,0.5 0.5,0" />
                        </DrawingGroup.Children>
                      </DrawingGroup>
                    </DrawingBrush.Drawing>
                  </DrawingBrush>
                </DiscreteObjectKeyFrame.Value>
              </DiscreteObjectKeyFrame>          
            </ObjectAnimationUsingKeyFrames.KeyFrames>
          </ObjectAnimationUsingKeyFrames>        
        </Storyboard>
      </BeginStoryboard>
    </EventTrigger>
  </Page.Triggers>
</Page>

For the complete sample, see KeyFrame Animation Sample.

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role not supported), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Bibliothèque de classes .NET Framework
ObjectAnimationUsingKeyFrames, classe

Anime la valeur d'une propriété Object selon un ensemble de KeyFrames et en fonction d'une duréeDurationspécifiée.

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
Visual Basic
<ContentPropertyAttribute("KeyFrames")> _
Public Class ObjectAnimationUsingKeyFrames _
    Inherits ObjectAnimationBase _
    Implements IKeyFrameAnimation, IAddChild
C#
[ContentPropertyAttribute("KeyFrames")]
public class ObjectAnimationUsingKeyFrames : ObjectAnimationBase, 
    IKeyFrameAnimation, IAddChild
VisualC++
[ContentPropertyAttribute(L"KeyFrames")]
public ref class ObjectAnimationUsingKeyFrames : public ObjectAnimationBase, 
    IKeyFrameAnimation, IAddChild
F#
[<ContentPropertyAttribute("KeyFrames")>]
type ObjectAnimationUsingKeyFrames =  
    class
        inherit ObjectAnimationBase
        interface IKeyFrameAnimation
        interface IAddChild
    end
Utilisation des éléments objets XAML
<ObjectAnimationUsingKeyFrames>
  KeyFrames
</ObjectAnimationUsingKeyFrames>

Le type ObjectAnimationUsingKeyFrames expose les membres suivants.

  NomDescription
Méthode publiqueObjectAnimationUsingKeyFramesInitialise une nouvelle instance de la classe ObjectAnimationUsingKeyFrames.
Début
  NomDescription
Propriété publiqueAccelerationRatioObtient 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é publiqueAutoReverseObtient 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é publiqueBeginTimeObtient ou établit l'heure à laquelle ce Timeline doit commencer. (Hérité de Timeline.)
Propriété publiqueCanFreezeObtient une valeur qui indique la possibilité ou non de rendre un objet non modifiable. (Hérité de Freezable.)
Propriété publiqueDecelerationRatioObtient 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é publiqueDependencyObjectTypeObtient le DependencyObjectType qui encapsule le type CLR de cette instance.  (Hérité de DependencyObject.)
Propriété publiqueDispatcherObtient le Dispatcher associé à DispatcherObject. (Hérité de DispatcherObject.)
Propriété publiqueDurationObtient ou définit la durée de cette chronologie, sans les répétitions. (Hérité de Timeline.)
Propriété publiqueFillBehaviorObtient 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é publiqueHasAnimatedPropertiesObtient 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é publiqueIsDestinationDefaultObtient 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é publiqueIsFrozenObtient une valeur qui indique si l'objet est actuellement modifiable ou pas. (Hérité de Freezable.)
Propriété publiqueIsSealedRécupère une valeur qui indique si cette instance est actuellement sealed (en lecture seule). (Hérité de DependencyObject.)
Propriété publiqueKeyFrames Obtient ou définit la collection des objets ObjectKeyFrame qui définissent l'animation.
Propriété publiqueName Obtient ou définit le nom de ce Timeline. (Hérité de Timeline.)
Propriété publiqueRepeatBehaviorObtient ou définit le comportement à répétition de cette chronologie. (Hérité de Timeline.)
Propriété publiqueSpeedRatioObtient ou définit le taux de progression temporelle par rapport à son parent de ce Timeline. (Hérité de Timeline.)
Propriété publiqueTargetPropertyTypeObtient le type de valeur généré par cette animation. (Hérité de ObjectAnimationBase.)
Début
  NomDescription
Méthode protégéeAddChildAjoute un enfant ObjectKeyFrame à ce ObjectAnimationUsingKeyFrames.
Méthode protégéeAddTextAjoute une chaîne de texte en tant qu'enfant de ce ObjectAnimationUsingKeyFrames.
Méthode protégéeAllocateClockCrée un Clock pour ce AnimationTimeline. (Hérité de AnimationTimeline.)
Méthode publiqueApplyAnimationClock(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 publiqueApplyAnimationClock(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 publiqueBeginAnimation(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 publiqueBeginAnimation(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 publiqueCheckAccessDétermine si le thread appelant a accès à ce DispatcherObject. (Hérité de DispatcherObject.)
Méthode publiqueClearValue(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 publiqueClearValue(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 publiqueCloneCrée un clone modifiable de ce ObjectAnimationUsingKeyFrames 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éeCloneCoreConvertit cette instance en copie complète du ObjectAnimationUsingKeyFrames 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 publiqueCloneCurrentValueCrée un clone modifiable de cet objet ObjectAnimationUsingKeyFrames, 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éeCloneCurrentValueCoreConvertit cette instance en copie complète modifiable du ObjectAnimationUsingKeyFrames 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 publiqueCoerceValueForce 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 publiqueCreateClock()()()Crée une nouvelle horloge AnimationClock à partir de la chronologie AnimationTimeline. (Hérité de AnimationTimeline.)
Méthode publiqueCreateClock(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éeCreateInstanceInitialise une nouvelle instance de la classe Freezable. (Hérité de Freezable.)
Méthode protégéeCreateInstanceCoreCrée une nouvelle instance de ObjectAnimationUsingKeyFrames. (Substitue Freezable..::.CreateInstanceCore()()().)
Méthode publiqueEqualsDétermine si un DependencyObject fourni est équivalent au DependencyObject réel. (Hérité de DependencyObject.)
Méthode protégéeFinalizeAutorise 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 publiqueFreeze()()()Rend l'objet actuel non modifiable et définit sa propriété IsFrozen sur true. (Hérité de Freezable.)
Méthode protégéeFreezeCoreConvertit cette instance d'objet ObjectAnimationUsingKeyFrames en instance accessible en lecture seule uniquement ou détermine si une telle conversion est possible. (Substitue Timeline..::.FreezeCore(Boolean).)
Méthode publiqueGetAnimationBaseValueRetourne la valeur non animée de la propriété DependencyProperty spécifiée. (Hérité de Animatable.)
Méthode publiqueGetAsFrozenCré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éeGetAsFrozenCoreConvertit cette instance en clone de l'objet spécifié ObjectAnimationUsingKeyFrames. (Substitue Timeline..::.GetAsFrozenCore(Freezable).)
Méthode publiqueGetCurrentValueObtient la valeur actuelle de l'animation. (Hérité de ObjectAnimationBase.)
Méthode publiqueGetCurrentValueAsFrozenCré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éeGetCurrentValueAsFrozenCoreConvertit cette instance en clone figé du ObjectAnimationUsingKeyFrames 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éeGetCurrentValueCore 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 ObjectAnimationUsingKeyFrames. (Substitue ObjectAnimationBase..::.GetCurrentValueCore(Object, Object, AnimationClock).)
Méthode publiqueGetHashCodeObtient un code de hachage pour ce DependencyObject. (Hérité de DependencyObject.)
Méthode publiqueGetLocalValueEnumeratorCré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éeGetNaturalDurationRetourne la durée d'une seule itération de ce Timeline. (Hérité de Timeline.)
Méthode protégéeGetNaturalDurationCoreFournissez un Duration naturel personnalisé lorsque la propriété Duration a la valeur Automatic. (Substitue AnimationTimeline..::.GetNaturalDurationCore(Clock).)
Méthode publiqueGetTypeObtient le Type de l'instance actuelle. (Hérité de Object.)
Méthode publiqueGetValueRetourne la valeur effective actuelle d'une propriété de dépendance sur cette instance d'un DependencyObject. (Hérité de DependencyObject.)
Méthode publiqueInvalidatePropertyRéévalue la valeur effective pour la propriété de dépendance spécifiée (Hérité de DependencyObject.)
Méthode protégéeMemberwiseCloneCrée une copie superficielle de l'objet Object actif. (Hérité de Object.)
Méthode protégéeOnChangedAppelé lorsque l'objet ObjectAnimationUsingKeyFrames actuel est modifié. (Substitue Freezable..::.OnChanged()()().)
Méthode protégéeOnFreezablePropertyChanged(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éeOnFreezablePropertyChanged(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éeOnPropertyChangedSubstitue 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 publiqueReadLocalValueRetourne la valeur de proximité d'une propriété de dépendance, si elle existe. (Hérité de DependencyObject.)
Méthode protégéeReadPreambleGarantit 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 publiqueSetCurrentValueDéfinit la valeur d'une propriété de dépendance sans modifier sa source de valeur. (Hérité de DependencyObject.)
Méthode publiqueSetValue(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 publiqueSetValue(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 publiqueShouldSerializeKeyFramesRetourne la valeur true si la valeur de la propriété KeyFrames de cette instance de ObjectAnimationUsingKeyFrames doit être sérialisée par valeur.
Méthode protégéeShouldSerializePropertyRetourne 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 publiqueToStringRetourne une chaîne qui représente l'objet actuel. (Hérité de Object.)
Méthode publiqueVerifyAccessGarantit que le thread appelant a accès à DispatcherObject. (Hérité de DispatcherObject.)
Méthode protégéeWritePostscriptDé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éeWritePreambleVé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
  NomDescription
Événement publicChangedSe produit lorsque Freezable ou un objet qu'il contient est modifié. (Hérité de Freezable.)
Événement publicCompletedSe produit lorsque cette chronologie est complètement terminée et n'entrera plus dans sa période active. (Hérité de Timeline.)
Événement publicCurrentGlobalSpeedInvalidatedSe produit lorsque le taux auquel l'heure progresse pour l'horloge de la chronologie change. (Hérité de Timeline.)
Événement publicCurrentStateInvalidatedSe produit lorsque la propriété CurrentState du Clock de la chronologie est mise à jour. (Hérité de Timeline.)
Événement publicCurrentTimeInvalidatedSe produit lorsque la propriété CurrentTime du Clock de la chronologie est mise à jour. (Hérité de Timeline.)
Événement publicRemoveRequestedSe produit lorsque l'horloge créée pour cette chronologie ou une de ses chronologies parentes est supprimée. (Hérité de Timeline.)
Début
  NomDescription
Implémentation d'interface expliciteMéthode privéeIAddChild..::.AddChildAjoute un objet enfant.
Implémentation d'interface expliciteMéthode privéeIAddChild..::.AddTextAjoute le texte d'un nœud à l'objet.
Implémentation d'interface explicitePropriété privéeIKeyFrameAnimation..::.KeyFramesObtient 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 ObjectKeyFrame. Chaque ObjectKeyFrame 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.

Animation des images clé d'un ObjectAnimationUsingKeyFrames

Vous ne pouvez pas animer un objet qui correspond à la sortie d'une autre animation. Par exemple, si vous utilisez un ObjectAnimationUsingKeyFrames pour animer le Fill d'un Rectangle à partir d'un RadialGradientBrush vers un SolidColorBrush, vous ne pouvez animer aucune des propriétés du RadialGradientBrush ni du SolidColorBrush quelles qu'elles soient.

This example shows how to animate an object, which in this example is the Background property of a Page control, by using key frames.

The following example uses the ObjectAnimationUsingKeyFrames class to animate color changes for the Background property of a Page control. The example animation changes to a different background brush at regular intervals. This animation uses the DiscreteObjectKeyFrame class to create three different key frames. The animation uses key frames in the following manner:

  1. At the end of the first second, animates an instance of the LinearGradientBrush class. This section of the example applies a linear gradient to the background color so that the color transitions from yellow to orange to red.

  2. At the end of the next second, animates an instance of the RadialGradientBrush class. This section of the example applies a radial gradient to the background color so that the color transitions from white to blue to black.

  3. At the end of the third second, animates an instance of the DrawingBrush class. This section of the example applies a checkerboard pattern to the background.

  4. The animation begins again and repeats indefinitely.

RemarqueRemarque

DiscreteObjectKeyFrame is the only type of key frame that you can use with the ObjectAnimationUsingKeyFrames class. Key frames like DiscreteObjectKeyFrame create sudden changes in values, that is, the color changes in this example occur suddenly.

XAML
<Page 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
    <Page.Triggers>
      <EventTrigger RoutedEvent="Page.Loaded">
        <BeginStoryboard>
          <Storyboard>

            <!-- ObjectAnimationUsingKeyFrames is used to animate properties that take
                 an object as a value. This animation lasts for 4 seconds using 3 KeyFrames which
                 swap different brush objects at regular intervals, making the background of the Page
                 change. -->
            <ObjectAnimationUsingKeyFrames
              Storyboard.TargetProperty="Background"
              Duration="0:0:4" RepeatBehavior="Forever">
            <ObjectAnimationUsingKeyFrames.KeyFrames>

              <!-- Note: Only discrete interpolation (DiscreteObjectKeyFrame) is available for 
              use with ObjectAnimationUsingKeyFrames which merely swaps objects according to
              a specified timeline. Other types of interpolation are too problematic to apply
              to objects.  -->

              <!-- Using a DiscreteObjectKeyFrame, the Page Background suddenly changes 
                   to a LinearGradientBrush after the first second of the animation. -->
              <DiscreteObjectKeyFrame KeyTime="0:0:1">
                <DiscreteObjectKeyFrame.Value>
                  <LinearGradientBrush>
                    <LinearGradientBrush.GradientStops>
                      <GradientStop Color="Yellow" Offset="0.0" />
                      <GradientStop Color="Orange" Offset="0.5" />
                      <GradientStop Color="Red" Offset="1.0" />
                    </LinearGradientBrush.GradientStops>
                  </LinearGradientBrush>
                </DiscreteObjectKeyFrame.Value>
              </DiscreteObjectKeyFrame>

              <!-- Using a DiscreteObjectKeyFrame, the Page Background suddenly changes 
                   to a RadialGradientBrush after the second second of the animation. -->
              <DiscreteObjectKeyFrame KeyTime="0:0:2">
                <DiscreteObjectKeyFrame.Value>
                  <RadialGradientBrush GradientOrigin="0.75,0.25">
                    <RadialGradientBrush.GradientStops>
                      <GradientStop Color="White" Offset="0.0" />
                      <GradientStop Color="MediumBlue" Offset="0.5" />
                      <GradientStop Color="Black" Offset="1.0" />
                    </RadialGradientBrush.GradientStops>
                  </RadialGradientBrush>
                </DiscreteObjectKeyFrame.Value>
              </DiscreteObjectKeyFrame>

              <!-- Using a DiscreteObjectKeyFrame, the Page Background suddenly 
                   changes to a DrawingBrush (creates a checkerboard pattern) after the 
                   third second of the animation. -->
              <DiscreteObjectKeyFrame KeyTime="0:0:3">
                <DiscreteObjectKeyFrame.Value>
                  <DrawingBrush Viewport="0,0,0.25,0.25" TileMode="Tile">
                    <DrawingBrush.Drawing>
                      <DrawingGroup>
                        <DrawingGroup.Children>
                          <GeometryDrawing Brush="White">
                            <GeometryDrawing.Geometry>
                              <RectangleGeometry Rect="0,0,1,1" />
                            </GeometryDrawing.Geometry>
                          </GeometryDrawing>
                          <GeometryDrawing Brush="Black"
                           Geometry="M 0,0 L0,0.5 0.5,0.5 0.5,1 1,1 1,0.5 0.5,0.5 0.5,0" />
                        </DrawingGroup.Children>
                      </DrawingGroup>
                    </DrawingBrush.Drawing>
                  </DrawingBrush>
                </DiscreteObjectKeyFrame.Value>
              </DiscreteObjectKeyFrame>          
            </ObjectAnimationUsingKeyFrames.KeyFrames>
          </ObjectAnimationUsingKeyFrames>        
        </Storyboard>
      </BeginStoryboard>
    </EventTrigger>
  </Page.Triggers>
</Page>

For the complete sample, see KeyFrame Animation 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.
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.
Contenu de la communauté   Qu'est-ce que le Contenu de la communauté ?
Ajouter du contenu RSS  Annotations
Processing
© 2012 Microsoft. Tous droits réservés. Conditions d'utilisation | Marques | Confidentialité
Page view tracker