Share via


CompositionAnimation.SetReferenceParameter(String, CompositionObject) Metodo

Definizione

Imposta un riferimento a un oggetto Composition da usare con un oggetto ExpressionAnimation o un keyframe di espressione.

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)

Parametri

key
String

Platform::String

winrt::hstring

Nome del parametro da impostare. Il nome può essere usato per fare riferimento al parametro in ExpressionAnimation.

compositionObject
CompositionObject

Valore CompositionObject .

Esempio

L'esempio seguente descrive come usare un'espressioneAnimation per creare un effetto parallax tra uno sfondo e un oggetto visivo in primo piano. Questo tipo di animazione può essere visualizzato nella schermata start di Windows e nelle UI dell'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); 
} 

Commenti

Impostando un riferimento a un Oggetto CompositionObject, un'espressioneAnimation può fare riferimento a qualsiasi proprietà animabile in tale CompositionObject. Il valore corrente della proprietà CompositionObject nel compositore verrà usato durante il calcolo del valore dell'espressione. Per altre informazioni, vedere la sezione osservazioni di ExpressionAnimation .

Si applica a