Skip to main content

ExpressionAnimation Class

Definition

Assembly:Avalonia.Base
Package:Avalonia

A Composition Animation that uses a mathematical equation to calculate the value for an animating property every frame.

public class ExpressionAnimation

Inheritance: object -> CompositionObject -> CompositionAnimation -> ExpressionAnimation

Remarks

The core of ExpressionAnimations allows a developer to define a mathematical equation that can be used to calculate the value of a targeted animating property each frame. This contrasts Avalonia.Rendering.Composition.Animations.KeyFrameAnimations, which use an interpolator to define how the animating property changes over time. The mathematical equation can be defined using references to properties of Composition objects, mathematical functions and operators and Input. Use the Avalonia.Rendering.Composition.CompositionObject.StartAnimation(string,Avalonia.Rendering.Composition.Animations.CompositionAnimation) method to start the animation.

Methods

NameDescription
ClearAllParametersClears all of the parameters of the animation. Inherited from CompositionAnimation.
ClearParameterClears a parameter from the animation. Inherited from CompositionAnimation.
SetColorParameterInherited from CompositionAnimation.
SetMatrix3x2ParameterInherited from CompositionAnimation.
SetMatrix4x4ParameterInherited from CompositionAnimation.
SetQuaternionParameterInherited from CompositionAnimation.
SetReferenceParameterInherited from CompositionAnimation.
SetScalarParameterInherited from CompositionAnimation.
SetVector2ParameterInherited from CompositionAnimation.
SetVector3ParameterInherited from CompositionAnimation.
SetVector4ParameterInherited from CompositionAnimation.
StartAnimationConnects an animation with the specified property of the object and starts the animation. Inherited from CompositionObject.
StartAnimationGroupStarts an animation group. The StartAnimationGroup method on CompositionObject lets you start CompositionAnimationGroup. All the animations in the group will be started at the same time on the object. Inherited from CompositionObject.
StopAnimationDisconnects an animation from the specified property and stops the animation. Inherited from CompositionObject.
StopAnimationGroupStops an animation group. Inherited from CompositionObject.

Properties

NameDescription
ExpressionThe mathematical equation specifying how the animated value is calculated each frame. The Expression is the core of an Avalonia.Rendering.Composition.Animations.ExpressionAnimation and represents the equation the system will use to calculate the value of the animation property each frame. The equation is set on this property in the form of a string. Although expressions can be defined by simple mathematical equations such as "2+2", the real power lies in creating mathematical relationships where the input values can change frame over frame.
TargetInherited from CompositionAnimation.
CompositorThe associated Compositor Inherited from CompositionObject.
ImplicitAnimationsThe collection of implicit animations attached to this object. Inherited from CompositionObject.
IsDisposedInherited from CompositionObject.

Expression Property

The mathematical equation specifying how the animated value is calculated each frame. The Expression is the core of an Avalonia.Rendering.Composition.Animations.ExpressionAnimation and represents the equation the system will use to calculate the value of the animation property each frame. The equation is set on this property in the form of a string. Although expressions can be defined by simple mathematical equations such as "2+2", the real power lies in creating mathematical relationships where the input values can change frame over frame.

public string Expression { get; set; }