다음을 통해 공유


CompositionAnimation.SetExpressionReferenceParameter 메서드

정의

IAnimationObjectExpressionAnimation에서 참조 매개 변수로 구현하는 개체를 설정합니다.

public:
 virtual void SetExpressionReferenceParameter(Platform::String ^ parameterName, IAnimationObject ^ source) = SetExpressionReferenceParameter;
void SetExpressionReferenceParameter(winrt::hstring const& parameterName, IAnimationObject const& source);
public void SetExpressionReferenceParameter(string parameterName, IAnimationObject source);
function setExpressionReferenceParameter(parameterName, source)
Public Sub SetExpressionReferenceParameter (parameterName As String, source As IAnimationObject)

매개 변수

parameterName
String

Platform::String

winrt::hstring

설정할 매개 변수의 이름입니다.

source
IAnimationObject

소스 개체입니다.

예제

// CustomObject that implements IAnimationObject.
class CustomObject : IAnimationObject
{
    public CustomObject(Compositor compositor)
    {
        _targetVisual = compositor.CreateSpriteVisual();
    }

    // Implement PopulatePropertyInfo method that 
    // redirects the property named "CustomOffset"
    // to the Offset property of the underlying visual.
    void IAnimationObject.PopulatePropertyInfo(
        string propertyName,
        AnimationPropertyInfo propertyInfo)
    {
        if (propertyName.Equals(“CustomOffset”)
        {
            _targetVisual.PopulatePropertyInfo(
                “Offset”,
                propertyInfo);           
        }
    }

    private SpriteVisual _targetVisual = null;
}

// Sample usage of CustomObject in an ExpressionAnimation.
void SetupExpression(
    Compositor compositor, 
    IAnimationObject customObject,
    SpriteVisual target)
{
    var expAnim = compositor.CreateExpressionAnimation(
        “customObject.CustomOffset + vector3(100.0f, 0.0f, 0.0f)”);

    expAnim.SetExpressionReferenceParameter(“customObject”, customObject);

    targetVisual.StartAnimation(“Offset”, expAnim);        
}

적용 대상