CompositionAnimation.SetReferenceParameter(String, CompositionObject) Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
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 ExpressionAnimation pour créer un effet parallaxe entre un arrière-plan et un visuel de 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, une ExpressionAnimation peut faire référence à n’importe quelle propriété animatable sur cet Objet CompositionObject. La valeur de propriété actuelle de CompositionObject dans le Compositor est utilisée lors du calcul de la valeur de l’expression. Pour plus d’informations, consultez la section notes d’ExpressionAnimation .