CompositionAnimation.SetReferenceParameter(String, CompositionObject) Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Imposta un riferimento a un oggetto Composition da utilizzare con un oggetto ExpressionAnimation o un fotogramma chiave dell'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 illustra come usare expressionAnimation per creare un effetto parallasse tra uno sfondo e un oggetto visivo in primo piano. Questo tipo di animazione può essere visualizzato nel menu Start Windows 10.
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 CompositionObject, expressionAnimation può fare riferimento a qualsiasi proprietà animabile in tale CompositionObject. Il valore corrente della proprietà CompositionObject in Compositor verrà usato per calcolare il valore dell'espressione. Per altre informazioni, vedere la sezione osservazioni di ExpressionAnimation .