CompositionAnimation.SetReferenceParameter(String, CompositionObject) Méthode

Définition

Définit une référence à un objet Composition à utiliser avec une expressionAnimation ou une image clé d’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 d’arrière-plan et un visuel de premier plan. Ce type d’animation est visible sur l’écran d’accueil de Windows et Windows Phone’interface utilisateur hub.

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, une ExpressionAnimation peut faire référence à n’importe quelle propriété animatable sur cet Objet CompositionObject. La valeur de propriété actuelle de l’objet CompositionObject dans le compositeur sera utilisée lors du calcul de la valeur de l’expression. Pour plus d’informations, consultez la section remarques de ExpressionAnimation .

S’applique à