InteractionTrackerInertiaRestingValue InteractionTrackerInertiaRestingValue InteractionTrackerInertiaRestingValue InteractionTrackerInertiaRestingValue Class


An ExpressionAnimation that defines the rest position after an interaction.

The InteractionTrackerInertiaRestingValue class defines two ExpressionAnimation s that calculate an explicit resting position for InteractionTracker when a particular condition is met. The InteractionTrackerInertiaRestingValue is defined as two parts: The conditional statement in which the InteractionTracker ’s specific resting location needs to be explicitly defined if true and the equation that describes a mathematical relationship that outputs the location. Utilize the InteractionTrackerInertiaRestingValue class when needing to ensure InteractionTracker lands on a specific location after an interaction occurs.

public : sealed class InteractionTrackerInertiaRestingValue : InteractionTrackerInertiaModifier
struct winrt::Windows::UI::Composition::Interactions::InteractionTrackerInertiaRestingValue : InteractionTrackerInertiaModifier
public sealed class InteractionTrackerInertiaRestingValue : InteractionTrackerInertiaModifier
Public NotInheritable Class InteractionTrackerInertiaRestingValue Inherits InteractionTrackerInertiaModifier

Windows 10 requirements

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


void MandatorySingleSnapPoints(ContainerVisual containerVisual, Visual contentVisual)
  // Set up our inertia modifiers to behave as dmanip's "single mandatory" snap-points, at a
  // regular interval of 50px.
  const float snapPointRange = 50.0f;
  // Configure a "snap-point" to handle upward direction (to previous item).
  var modifier1 = InteractionTrackerInertiaRestingValue.Create(_compositor);
  // Add a condition for when this upward “snap-point” applies.
  modifier1.Condition = _compositor.CreateExpressionAnimation(
    "this.Target.NaturalRestingPosition.y < " + 
    "(this.StartingValue - mod(this.StartingValue, snapPointRange) + snapPointRange / 2)");
  modifier1.Condition.SetScalarParameter("snapPointRange", snapPointRange);
  // Configure the resting spot when the condition is met 
  modifier1.EndPoint = _compositor.CreateExpressionAnimation(
    "this.StartingValue - mod(this.StartingValue, snapPointRange)");
  modifier1.EndPoint.SetScalarParameter("snapPointRange", snapPointRange);
  // Configure a "snap-point" to handle downward direction (to next item).
  var modifier2 = InteractionTrackerInertiaRestingValue.Create(_compositor);
  // Add a condition for when this downward “snap-point” applies.
  modifier2.Condition = _compositor.CreateExpressionAnimation(
    "this.Target.NaturalRestingPosition.y >= " + 
    "(this.StartingValue - mod(this.StartingValue, snapPointRange) + snapPointRange / 2)");
  modifier2.Condition.SetScalarParameter("snapPointRange", snapPointRange);
  // Configure the resting spot when the condition is met.
  modifier2.EndPoint = _compositor.CreateExpressionAnimation(
    "this.StartingValue + snapPointRange - mod(this.StartingValue, snapPointRange)");
  modifier2.EndPoint.SetScalarParameter("snapPointRange", snapPointRange);
  var modifiers = new InteractionTrackerInertiaRestingValue[] { modifier1, modifier2 };

  // Add our "snap-point" inertia modifiers to the Y position of the InteractionTracker.


When attaching the InteractionTrackerInertiaRestingValue modifier to the InteractionTracker, you configure it to either the X/Y Position or Scale.

The ExpressionAnimation defining the condition property only gets run once, when the interaction completes (finger released), while the RestingValue Expression gets run every frame.

InteractionTrackerInertiaRestingValue modifiers explicitly defines the resting position of InteractionTracker when the condition is met. It does not however define the motion to this explicit location – the system will handle that. Thus, if you need InteractionTracker to take a particular motion, but do not require it to land at an exact spot, utilize the InteractionTrackerInertiaMotion modifier.


Comment Comment Comment Comment

A string to associate with the CompositionObject.

(Inherited from CompositionObject)
Compositor Compositor Compositor Compositor

The Compositor used to create this CompositionObject.

(Inherited from CompositionObject)
Condition Condition Condition Condition

An ExpressionAnimation describing when the modifier should be applied.

The Condition property is an ExpressionAnimation that defines when the InteractionTracker should have a specific resting position. This expression gets run once after the interaction occurs and must resolve to a type Bool, otherwise an error will be thrown when the condition is evaluated. See the ExpressionAnimation class page for more details on building expressions.

Dispatcher Dispatcher Dispatcher Dispatcher

The dispatcher for the CompositionObject.

(Inherited from CompositionObject)
DispatcherQueue DispatcherQueue DispatcherQueue DispatcherQueue

Gets the DispatcherQueue for the CompostionObject.

(Inherited from CompositionObject)
ImplicitAnimations ImplicitAnimations ImplicitAnimations ImplicitAnimations

The collection of implicit animations attached to this object.

(Inherited from CompositionObject)
Properties Properties Properties Properties

The collection of properties associated with the CompositionObject.

(Inherited from CompositionObject)
RestingValue RestingValue RestingValue RestingValue

An ExpressionAnimation to define the resting value of InteractionTracker if the expression in the Condition property is true.

The Resting property is an ExpressionAnimation that describes where InteractionTracker will move to after an interaction if it’s corresponding condition is met. This expression will be run every frame while InteractionTracker is in Inertia and must resolve to a type Float, otherwise an error will be thrown when the equation is evaluated. See the ExpressionAnimation class page for more details on building expressions.


Close Close Close Close

Closes the CompositionObject and releases system resources.

(Inherited from CompositionObject)
Create(Compositor) Create(Compositor) Create(Compositor) Create(Compositor)

Creates an instance of InteractionTrackerInertiaRestingValue.

PopulatePropertyInfo(String,AnimationPropertyInfo) PopulatePropertyInfo(String,AnimationPropertyInfo) PopulatePropertyInfo(String,AnimationPropertyInfo) PopulatePropertyInfo(String,AnimationPropertyInfo)

Defines a property that can be animated.

(Inherited from CompositionObject)
StartAnimation(String,CompositionAnimation) StartAnimation(String,CompositionAnimation) StartAnimation(String,CompositionAnimation) StartAnimation(String,CompositionAnimation)

Connects an animation with the specified property of the object and starts the animation.

(Inherited from CompositionObject)
StartAnimationGroup(ICompositionAnimationBase) StartAnimationGroup(ICompositionAnimationBase) StartAnimationGroup(ICompositionAnimationBase) StartAnimationGroup(ICompositionAnimationBase)

Starts 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)
StartAnimationGroupWithIAnimationObject(IAnimationObject,ICompositionAnimationBase) StartAnimationGroupWithIAnimationObject(IAnimationObject,ICompositionAnimationBase) StartAnimationGroupWithIAnimationObject(IAnimationObject,ICompositionAnimationBase) StartAnimationGroupWithIAnimationObject(IAnimationObject,ICompositionAnimationBase)

Starts an animation group on the specified target.

(Inherited from CompositionObject)
StartAnimationWithIAnimationObject(IAnimationObject,String,CompositionAnimation) StartAnimationWithIAnimationObject(IAnimationObject,String,CompositionAnimation) StartAnimationWithIAnimationObject(IAnimationObject,String,CompositionAnimation) StartAnimationWithIAnimationObject(IAnimationObject,String,CompositionAnimation)

Connects an animation with the specified property of the target object and starts the animation.

(Inherited from CompositionObject)
StopAnimation(String) StopAnimation(String) StopAnimation(String) StopAnimation(String)

Disconnects an animation from the specified property and stops the animation.

(Inherited from CompositionObject)
StopAnimationGroup(ICompositionAnimationBase) StopAnimationGroup(ICompositionAnimationBase) StopAnimationGroup(ICompositionAnimationBase) StopAnimationGroup(ICompositionAnimationBase)

Stops an animation group.

(Inherited from CompositionObject)
TryGetAnimationController(String) TryGetAnimationController(String) TryGetAnimationController(String) TryGetAnimationController(String)

Returns an AnimationController for the animation running on the specified property.

(Inherited from CompositionObject)

See also