Partager via


CompositionObject.StartAnimation Méthode

Définition

Surcharges

StartAnimation(String, CompositionAnimation)

Connecte une animation à la propriété spécifiée de l’objet et démarre l’animation.

StartAnimation(String, CompositionAnimation, AnimationController)

Connecte une animation à la propriété spécifiée de l’objet et démarre l’animation.

StartAnimation(String, CompositionAnimation)

Connecte une animation à la propriété spécifiée de l’objet et démarre l’animation.

public:
 virtual void StartAnimation(Platform::String ^ propertyName, CompositionAnimation ^ animation) = StartAnimation;
void StartAnimation(winrt::hstring const& propertyName, CompositionAnimation const& animation);
public void StartAnimation(string propertyName, CompositionAnimation animation);
function startAnimation(propertyName, animation)
Public Sub StartAnimation (propertyName As String, animation As CompositionAnimation)

Paramètres

propertyName
String

Platform::String

winrt::hstring

Propriété à laquelle associer l’animation.

animation
CompositionAnimation

Animation à associer à la propriété spécifiée.

Exemples

void AnimatingVisualOffset(Visual targetVisual) 
{ 
    var animation = _compositor.CreateVector3KeyFrameAnimation(); 

    // 
    // Define specific easing functions. 
    // 


    var linear = _compositor.CreateLinearEasingFunction(); 

    var easeIn = _compositor.CreateCubicBezierEasingFunction( 
            new Vector2(0.5f, 0.0f), new Vector2(1.0f, 1.0f)); 

    var easeOut = _compositor.CreateCubicBezierEasingFunction( 
            new Vector2(0.0f, 0.0f), new Vector2(0.5f, 1.0f)); 

    // 
    // Add a set of key frames to describe how the Offset should change over time.   
    // 

    animation.InsertKeyFrame(0.00f, new Vector3(100.0f, 100.0f, 0.0f)); 
    animation.InsertKeyFrame(0.25f, new Vector3(300.0f, 100.0f, 0.0f), easeIn); 
    animation.InsertKeyFrame(0.50f, new Vector3(300.0f, 300.0f, 0.0f), linear); 
    animation.InsertKeyFrame(0.75f, new Vector3(100.0f, 300.0f, 0.0f), linear); 
    animation.InsertKeyFrame(1.00f, new Vector3(100.0f, 100.0f, 0.0f), easeOut); 

    // 
    // The animation curve defined by the key frames will scale to match the duration. 
    // 

    animation.Duration = TimeSpan.FromMilliseconds(4000); 

    targetVisual.StartAnimation("Offset", animation); 
}     

Remarques

Si une animation est déjà liée à la propriété d’un objet lors de l’appel de StartAnimation, l’animation appliquée précédente est déconnectée et la nouvelle animation est affectée. De même, la définition directe de la propriété entraîne la déconnexion de l’animation précédente et la nouvelle valeur de propriété prend effet.

Le tableau suivant montre la liste des propriétés animatables :

Object Nom de la propriété Type de propriété
Visual AnchorPoint Vector2
--- CenterPoint Vector3
--- Offset Vector3
--- Opacity Scalaire
--- Orientation Vector4
--- RotationAngle Scalaire
--- RotationAxis Vector3
--- Taille Vector2
--- TransformMatrix Matrix4x4
InsetClip BottomInset Scalaire
--- LeftInset Scalaire
--- RightInset Scalaire
--- TopInset Scalaire
CompositionColorBrush Color Windows.UI.Color
CompositionPropertySet Ensemble de propriétés spécifiées par le développeur.

En outre, les propriétés de certains effets sous l’objet CompositionEffectBrush peuvent être animées :

Nom de l’effet Nom de la propriété Type de propriété
SaturationEffect Saturation Scalaire
ColorSourceEffect Color Vector4
ArithmétiqueComposite Offset Scalaire
--- Source1Amount Scalaire
--- Source2Amount Scalaire
--- MultiplyAmount Scalaire
Transform2d TransformMatrix Matrix3x2
ContrastEffect Contraste Float
ExposureEffect Exposition : Float
HueRotationEffect Angle Float
SépiaEffect Intensité Float
TemperatureAndTintEffect Température Float
--- Teinte Float
GammaTransferEffect RedAmplitude Float
--- RedExponent Float
--- RedOffset Float
--- GreenAmplitude Float
--- GreenExponent Float
--- GreenOffset Float
--- BlueAmplitude Float
--- BlueExponent Float
--- BlueOffset Float
--- AlphaAmplitude Float
--- AlphaExponent Float
--- AlphaOffset Float

S’applique à

StartAnimation(String, CompositionAnimation, AnimationController)

Connecte une animation à la propriété spécifiée de l’objet et démarre l’animation.

public:
 virtual void StartAnimation(Platform::String ^ propertyName, CompositionAnimation ^ animation, AnimationController ^ animationController) = StartAnimation;
/// [Windows.Foundation.Metadata.Overload("StartAnimationWithController")]
void StartAnimation(winrt::hstring const& propertyName, CompositionAnimation const& animation, AnimationController const& animationController);
[Windows.Foundation.Metadata.Overload("StartAnimationWithController")]
public void StartAnimation(string propertyName, CompositionAnimation animation, AnimationController animationController);
function startAnimation(propertyName, animation, animationController)
Public Sub StartAnimation (propertyName As String, animation As CompositionAnimation, animationController As AnimationController)

Paramètres

propertyName
String

Platform::String

winrt::hstring

Propriété à laquelle associer l’animation.

animation
CompositionAnimation

Animation à associer à la propriété spécifiée.

animationController
AnimationController

Contrôleur d’animation à associer à l’animation.

Attributs

Remarques

Le animationController paramètre vous permet de lier plusieurs animations à la propriété Progress d’un seul contrôleur, ce qui nécessite moins d’objets ExpressionAnimation que la liaison des propriétés de Progress plusieurs animateurs à une propriété CompositionObject.

S’applique à