CompositionAnimation CompositionAnimation CompositionAnimation CompositionAnimation Class

Definition

Represents the base animation class.

public : class CompositionAnimation : CompositionObject, ICompositionAnimation, ICompositionAnimation2, ICompositionAnimation3, ICompositionAnimationBase
public class CompositionAnimation : CompositionObject, ICompositionAnimation, ICompositionAnimation2, ICompositionAnimation3, ICompositionAnimationBase
Public Class CompositionAnimation Inherits CompositionObject Implements ICompositionAnimation, ICompositionAnimation2, ICompositionAnimation3, ICompositionAnimationBase
// This class does not provide a public constructor.
Inheritance
CompositionAnimationCompositionAnimationCompositionAnimationCompositionAnimation
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

This is the base class for ExpressionAnimation and KeyFrameAnimation.

Use the CompostionObject.StartAnimation and CompostionObject.StopAnimation methods to start and stop the animation.

Value parameters (as opposed to reference parameters which are set using SetReferenceParameter ) are copied and "embedded" into an expression at the time CompositionObject::StartAnimation is called. Changing the value of the variable after CompositionObject::StartAnimation is called will not affect the value of the ExpressionAnimation. See the remarks section of ExpressionAnimation for additional information.

Properties

InitialValueExpressions InitialValueExpressions InitialValueExpressions InitialValueExpressions

Gets the initial values for the animation.

public : InitialValueExpressionCollection InitialValueExpressions { get; }
public InitialValueExpressionCollection InitialValueExpressions { get; }
Public ReadOnly Property InitialValueExpressions As InitialValueExpressionCollection
var initialValueExpressionCollection = compositionAnimation.initialValueExpressions;
Additional features and requirements
Device family
Windows 10 Fall Creators Update (introduced v10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

Target Target Target Target

The target of the animation.

public : Platform::String Target { get; set; }
public string Target { get; set; }
Public ReadWrite Property Target As string
var string = compositionAnimation.target;
compositionAnimation.target = string;
Value
Platform::String string string string

The target of the animation.

Additional features and requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

Comment Comment Comment Comment

Inherited from CompositionObject

Compositor Compositor Compositor Compositor

Inherited from CompositionObject

Dispatcher Dispatcher Dispatcher Dispatcher

Inherited from CompositionObject

DispatcherQueue DispatcherQueue DispatcherQueue DispatcherQueue

Inherited from CompositionObject

ImplicitAnimations ImplicitAnimations ImplicitAnimations ImplicitAnimations

Inherited from CompositionObject

Properties Properties Properties Properties

Inherited from CompositionObject

Methods

ClearAllParameters() ClearAllParameters() ClearAllParameters() ClearAllParameters()

Clears all of the parameters of the animation.

public : void ClearAllParameters()
public void ClearAllParameters()
Public Function ClearAllParameters() As void
compositionAnimation.clearAllParameters();

ClearParameter(String) ClearParameter(String) ClearParameter(String) ClearParameter(String)

Clears a parameter from the animation.

public : void ClearParameter(Platform::String key)
public void ClearParameter(String key)
Public Function ClearParameter(key As String) As void
compositionAnimation.clearParameter(key);
Parameters
key
Platform::String String String String

The parameter to clear.

SetBooleanParameter(String, Boolean) SetBooleanParameter(String, Boolean) SetBooleanParameter(String, Boolean) SetBooleanParameter(String, Boolean)

Sets a boolean value parameter for use with an ExpressionAnimation or an expression keyframe.

public : void SetBooleanParameter(Platform::String key, bool value)
public void SetBooleanParameter(String key, Boolean value)
Public Function SetBooleanParameter(key As String, value As Boolean) As void
compositionAnimation.setBooleanParameter(key, value);
Parameters
key
Platform::String String String String

The name of the parameter to set.

value
bool Boolean Boolean Boolean

The boolean value.

Additional features and requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

SetColorParameter(String, Color) SetColorParameter(String, Color) SetColorParameter(String, Color) SetColorParameter(String, Color)

Sets a Color value parameter for use with an ExpressionAnimation or an expression keyframe.

public : void SetColorParameter(Platform::String key, Color value)
public void SetColorParameter(String key, Color value)
Public Function SetColorParameter(key As String, value As Color) As void
compositionAnimation.setColorParameter(key, value);
Parameters
key
Platform::String String String String

The name of the parameter to set.

value
Color Color Color Color

The Color value.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10586.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v2)

SetMatrix3x2Parameter(String, Matrix3x2) SetMatrix3x2Parameter(String, Matrix3x2) SetMatrix3x2Parameter(String, Matrix3x2) SetMatrix3x2Parameter(String, Matrix3x2)

Sets a Matrix3x2 value parameter for use with an ExpressionAnimation or an expression keyframe.

public : void SetMatrix3x2Parameter(Platform::String key, Matrix3x2 value)
public void SetMatrix3x2Parameter(String key, Matrix3x2 value)
Public Function SetMatrix3x2Parameter(key As String, value As Matrix3x2) As void
compositionAnimation.setMatrix3x2Parameter(key, value);
Parameters
key
Platform::String String String String

The name of the parameter to set.

value
Matrix3x2 Matrix3x2 Matrix3x2 Matrix3x2

The Matrix3x2 value.

SetMatrix4x4Parameter(String, Matrix4x4) SetMatrix4x4Parameter(String, Matrix4x4) SetMatrix4x4Parameter(String, Matrix4x4) SetMatrix4x4Parameter(String, Matrix4x4)

Sets a Matrix4x4 value parameter for use with an ExpressionAnimation or an expression keyframe.

public : void SetMatrix4x4Parameter(Platform::String key, Matrix4x4 value)
public void SetMatrix4x4Parameter(String key, Matrix4x4 value)
Public Function SetMatrix4x4Parameter(key As String, value As Matrix4x4) As void
compositionAnimation.setMatrix4x4Parameter(key, value);
Parameters
key
Platform::String String String String

The name of the parameter to set.

value
Matrix4x4 Matrix4x4 Matrix4x4 Matrix4x4

The Matrix4x4 value.

SetQuaternionParameter(String, Quaternion) SetQuaternionParameter(String, Quaternion) SetQuaternionParameter(String, Quaternion) SetQuaternionParameter(String, Quaternion)

Sets a Quaternion value for use with an ExpressionAnimation or an expression keyframe.

public : void SetQuaternionParameter(Platform::String key, Quaternion value)
public void SetQuaternionParameter(String key, Quaternion value)
Public Function SetQuaternionParameter(key As String, value As Quaternion) As void
compositionAnimation.setQuaternionParameter(key, value);
Parameters
key
Platform::String String String String

The name of the parameter to set.

value
Quaternion Quaternion Quaternion Quaternion

The quaternion value.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10586.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v2)

SetReferenceParameter(String, CompositionObject) SetReferenceParameter(String, CompositionObject) SetReferenceParameter(String, CompositionObject) SetReferenceParameter(String, CompositionObject)

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

public : void SetReferenceParameter(Platform::String key, CompositionObject compositionObject)
public void SetReferenceParameter(String key, CompositionObject compositionObject)
Public Function SetReferenceParameter(key As String, compositionObject As CompositionObject) As void
compositionAnimation.setReferenceParameter(key, compositionObject);
Parameters
key
Platform::String 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.

SetScalarParameter(String, Single) SetScalarParameter(String, Single) SetScalarParameter(String, Single) SetScalarParameter(String, Single)

Sets a Scalar value parameter for use with an ExpressionAnimation or an expression keyframe.

public : void SetScalarParameter(Platform::String key, float value)
public void SetScalarParameter(String key, Single value)
Public Function SetScalarParameter(key As String, value As Single) As void
compositionAnimation.setScalarParameter(key, value);
Parameters
key
Platform::String String String String

The name of the parameter to set.

value
float Single Single Single

The Single value.

SetVector2Parameter(String, Vector2) SetVector2Parameter(String, Vector2) SetVector2Parameter(String, Vector2) SetVector2Parameter(String, Vector2)

Sets a Vector2 value parameter for use with an ExpressionAnimation or an expression keyframe.

public : void SetVector2Parameter(Platform::String key, Vector2 value)
public void SetVector2Parameter(String key, Vector2 value)
Public Function SetVector2Parameter(key As String, value As Vector2) As void
compositionAnimation.setVector2Parameter(key, value);
Parameters
key
Platform::String String String String

The name of the parameter to set.

value
Vector2 Vector2 Vector2 Vector2

The Vector2 value.

SetVector3Parameter(String, Vector3) SetVector3Parameter(String, Vector3) SetVector3Parameter(String, Vector3) SetVector3Parameter(String, Vector3)

Sets a Vector3 value parameter for use with an ExpressionAnimation or an expression keyframe.

public : void SetVector3Parameter(Platform::String key, Vector3 value)
public void SetVector3Parameter(String key, Vector3 value)
Public Function SetVector3Parameter(key As String, value As Vector3) As void
compositionAnimation.setVector3Parameter(key, value);
Parameters
key
Platform::String String String String

The name of the parameter to set.

value
Vector3 Vector3 Vector3 Vector3

The Vector3 value.

SetVector4Parameter(String, Vector4) SetVector4Parameter(String, Vector4) SetVector4Parameter(String, Vector4) SetVector4Parameter(String, Vector4)

Sets a Vector4 value parameter for use with an ExpressionAnimation or an expression keyframe.

public : void SetVector4Parameter(Platform::String key, Vector4 value)
public void SetVector4Parameter(String key, Vector4 value)
Public Function SetVector4Parameter(key As String, value As Vector4) As void
compositionAnimation.setVector4Parameter(key, value);
Parameters
key
Platform::String String String String

The name of the parameter.

value
Vector4 Vector4 Vector4 Vector4

The Vector4 value.

Close Close Close Close

Inherited from CompositionObject

StartAnimation(String,CompositionAnimation) StartAnimation(String,CompositionAnimation) StartAnimation(String,CompositionAnimation) StartAnimation(String,CompositionAnimation)

Inherited from CompositionObject

StartAnimationGroup(ICompositionAnimationBase) StartAnimationGroup(ICompositionAnimationBase) StartAnimationGroup(ICompositionAnimationBase) StartAnimationGroup(ICompositionAnimationBase)

Inherited from CompositionObject

StopAnimation(String) StopAnimation(String) StopAnimation(String) StopAnimation(String)

Inherited from CompositionObject

StopAnimationGroup(ICompositionAnimationBase) StopAnimationGroup(ICompositionAnimationBase) StopAnimationGroup(ICompositionAnimationBase) StopAnimationGroup(ICompositionAnimationBase)

Inherited from CompositionObject

See Also