Composition​Animation Composition​Animation Composition​Animation Class

Definition

Some information relates to pre-released product which may be substantially modified before it’s commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Prerelease APIs are identified by a Prerelease label.

Prerelease. Represents the base animation class.

public : class CompositionAnimation : CompositionObject, ICompositionAnimation, ICompositionAnimation2, ICompositionAnimation3, ICompositionAnimationBasepublic class CompositionAnimation : CompositionObject, ICompositionAnimation, ICompositionAnimation2, ICompositionAnimation3, ICompositionAnimationBasePublic Class CompositionAnimation Inherits CompositionObject Implements ICompositionAnimation, ICompositionAnimation2, ICompositionAnimation3, ICompositionAnimationBase
Inheritance
CompositionAnimationCompositionAnimationCompositionAnimation
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Inherited Members

Inherited methods

Inherited properties

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

Prerelease. Gets the initial values for the animation.

public : InitialValueExpressionCollection InitialValueExpressions { get; }public InitialValueExpressionCollection InitialValueExpressions { get; }Public ReadOnly Property InitialValueExpressions As InitialValueExpressionCollection
Attributes
Additional features and requirements
Device family
Windows 10 Insider Preview (introduced v10.0.16225.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

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
Value
PlatForm::String string string

The target of the animation.

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

Methods

ClearAllParameters() ClearAllParameters() ClearAllParameters()

Clears all of the parameters of the animation.

public : void ClearAllParameters()public void ClearAllParameters()Public Function ClearAllParameters() As void
Attributes

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
Parameters
key
PlatForm::String String String

The parameter to clear.

Attributes

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
Parameters
key
PlatForm::String String String

The name of the parameter to set.

value
bool Boolean Boolean

The boolean value.

Attributes
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)

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
Parameters
key
PlatForm::String String String

The name of the parameter to set.

value
Color Color Color

The Color value.

Attributes
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)

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
Parameters
key
PlatForm::String String String

The name of the parameter to set.

value
Matrix3x2 Matrix3x2 Matrix3x2

The Matrix3x2 value.

Attributes

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
Parameters
key
PlatForm::String String String

The name of the parameter to set.

value
Matrix4x4 Matrix4x4 Matrix4x4

The Matrix4x4 value.

Attributes

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
Parameters
key
PlatForm::String String String

The name of the parameter to set.

value
Quaternion Quaternion Quaternion

The quaternion value.

Attributes
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)

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
Parameters
key
PlatForm::String String String

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

Attributes

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)

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
Parameters
key
PlatForm::String String String

The name of the parameter to set.

value
float Single Single

The Single value.

Attributes

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
Parameters
key
PlatForm::String String String

The name of the parameter to set.

value
Vector2 Vector2 Vector2

The Vector2 value.

Attributes

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
Parameters
key
PlatForm::String String String

The name of the parameter to set.

value
Vector3 Vector3 Vector3

The Vector3 value.

Attributes

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
Parameters
key
PlatForm::String String String

The name of the parameter.

value
Vector4 Vector4 Vector4

The Vector4 value.

Attributes

See Also