CompositionAnimation.SetReferenceParameter(String, CompositionObject) CompositionAnimation.SetReferenceParameter(String, CompositionObject) CompositionAnimation.SetReferenceParameter(String, CompositionObject) CompositionAnimation.SetReferenceParameter(String, CompositionObject) CompositionAnimation.SetReferenceParameter(String, CompositionObject) Method

Definition

Sets a reference to a Composition object for use with an ExpressionAnimation or an expression keyframe.

public : void SetReferenceParameter(Platform::String key, CompositionObject compositionObject)
void SetReferenceParameter(winrt::hstring key, CompositionObject compositionObject) const;
public void SetReferenceParameter(String key, CompositionObject compositionObject)
Public Sub SetReferenceParameter(key As String, compositionObject As CompositionObject)
compositionAnimation.setReferenceParameter(key, compositionObject);

Parameters

key
String String String

The name of the parameter to set. The name can be used to reference the parameter in the ExpressionAnimation.

Examples

The sample below outlines how to use an ExpressionAnimation to create a parallax effect between a background and foreground visual. This type of animation can be seen on the Windows Start Screen and Windows Phone Hub UIs.


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

Remarks

By setting a reference to a CompositionObject, an ExpressionAnimation can refer to any animatable property on that CompositionObject. The CompositionObject 's current property value in the Compositor will be used when calculating the value of the expression. See the remarks section of ExpressionAnimation for additional information.