Compartir a través de


CompositionAnimation.SetExpressionReferenceParameter Método

Definición

Establece un objeto que implementa IAnimationObject como parámetro de referencia en expressionAnimation.

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)

Parámetros

parameterName
String

Platform::String

winrt::hstring

Nombre del parámetro que se va a establecer.

source
IAnimationObject

El objeto de origen.

Requisitos de Windows

Familia de dispositivos
Windows 10, version 1809 (se introdujo en la versión 10.0.17763.0)
API contract
Windows.Foundation.UniversalApiContract (se introdujo en la versión v7.0)

Ejemplos

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

Se aplica a