InteractionTrackerInertiaRestingValue InteractionTrackerInertiaRestingValue InteractionTrackerInertiaRestingValue InteractionTrackerInertiaRestingValue Class

Definition

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, IInteractionTrackerInertiaRestingValuepublic sealed class InteractionTrackerInertiaRestingValue : InteractionTrackerInertiaModifier, IInteractionTrackerInertiaRestingValuePublic NotInheritable Class InteractionTrackerInertiaRestingValue Inherits InteractionTrackerInertiaModifier Implements IInteractionTrackerInertiaRestingValue// This API is not available in Javascript.
Inheritance
InteractionTrackerInertiaRestingValueInteractionTrackerInertiaRestingValueInteractionTrackerInertiaRestingValueInteractionTrackerInertiaRestingValue
Attributes
Windows 10 requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

Inherited Members

Inherited methods

Inherited properties

Examples


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.
  //

  _tracker.ConfigurePositionYInertiaModifiers(modifiers);
}

Remarks

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.

Properties

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.

public : ExpressionAnimation Condition { get; set; }public ExpressionAnimation Condition { get; set; }Public ReadWrite Property Condition As ExpressionAnimation// This API is not available in Javascript.

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.

public : ExpressionAnimation RestingValue { get; set; }public ExpressionAnimation RestingValue { get; set; }Public ReadWrite Property RestingValue As ExpressionAnimation// This API is not available in Javascript.
Value
ExpressionAnimation ExpressionAnimation ExpressionAnimation ExpressionAnimation

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

Methods

Create(Compositor) Create(Compositor) Create(Compositor) Create(Compositor)

Creates an instance of InteractionTrackerInertiaRestingValue.

public : static InteractionTrackerInertiaRestingValue Create(Compositor compositor)public static InteractionTrackerInertiaRestingValue Create(Compositor compositor)Public Static Function Create(compositor As Compositor) As InteractionTrackerInertiaRestingValue// This API is not available in Javascript.
Parameters
compositor
Compositor Compositor Compositor Compositor

The compositor to use when creating the InteractionTrackerInertiaRestingValue object.

Returns

See Also