Share via


CompositionAnimation.SetReferenceParameter(String, CompositionObject) Método

Definição

Define uma referência a um objeto Composition para uso com um ExpressionAnimation ou um quadro-chave de expressão.

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)

Parâmetros

key
String

Platform::String

winrt::hstring

O nome do parâmetro a ser definido. O nome pode ser usado para referenciar o parâmetro no ExpressionAnimation.

compositionObject
CompositionObject

O valor CompositionObject .

Exemplos

O exemplo a seguir descreve como usar um ExpressionAnimation para criar um efeito paralaxe entre um visual em segundo plano e em primeiro plano. Esse tipo de animação pode ser visto na Tela Inicial do Windows e nas interfaces do usuário do Hub Windows Phone.

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); 
} 

Comentários

Ao definir uma referência a um CompositionObject, um ExpressionAnimation pode se referir a qualquer propriedade animável nesse CompositionObject. O valor da propriedade atual do CompositionObject no Compositor será usado ao calcular o valor da expressão. Consulte a seção de comentários de ExpressionAnimation para obter informações adicionais.

Aplica-se a