Partager via


CompositionAnimation.SetReferenceParameter(String, CompositionObject) Méthode

Définition

Définit une référence à un objet Composition à utiliser avec une image cléExpressionAnimation ou expression.

public:
 virtual void SetReferenceParameter(Platform::String ^ key, CompositionObject ^ compositionObject) = SetReferenceParameter;
void SetReferenceParameter(winrt::hstring const& key, CompositionObject const& compositionObject);
public void SetReferenceParameter(string key, CompositionObject compositionObject);
function setReferenceParameter(key, compositionObject)
Public Sub SetReferenceParameter (key As String, compositionObject As CompositionObject)

Paramètres

key
String

Platform::String

winrt::hstring

Nom du paramètre à définir. Le nom peut être utilisé pour référencer le paramètre dans ExpressionAnimation.

compositionObject
CompositionObject

Valeur CompositionObject .

Exemples

L’exemple ci-dessous explique comment utiliser une ExpressionAnimation pour créer un effet de parallaxe entre un visuel en arrière-plan et au premier plan. Ce type d’animation est visible dans le menu Démarrer Windows 10.

void CreateParallaxExpression(Visual foreground, Visual background) 
{ 
    var animation = _compositor.CreateExpressionAnimation(); 

    animation.Expression = "foreground.Offset * (foreground.Size / background.Size)"; 

    animation.SetReferenceParameter("foreground", foreground); 
    animation.SetReferenceParameter("background", background); 

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

Remarques

En définissant une référence à un Objet CompositionObject, expressionAnimation peut faire référence à n’importe quelle propriété animatable sur cet Objet CompositionObject. La valeur de la propriété actuelle de CompositionObject dans le Compositor sera utilisée lors du calcul de la valeur de l’expression. Pour plus d’informations, consultez la section remarques de ExpressionAnimation .

S’applique à