InteractionTrackerInertiaMotion クラス

定義

慣性状態中の InteractionTracker のモーションを定義する ExpressionAnimation

InteractionTrackerMotion クラスには、特定の条件が満たされたときに慣性の開始から終了までのモーションを定義するために InteractionTracker が使用する位置の 2 番目の微分方程式を表す 2 つの ExpressionAnimationが含まれています。 InteractionTrackerMotion クラスは、2 つの部分として定義されます。モーションがいつ行われるかを定義する条件付きステートメントと、 InteractionTracker が最後の静止位置に到達する方法のモーションを表す数式です。 InteractionTracker が慣性状態のときに使用するカスタマイズされたモーション (スプリング モーションなど) を定義する必要がある場合は 、InteractionTrackerInertiaMotion クラスを使用します。

public ref class InteractionTrackerInertiaMotion sealed : InteractionTrackerInertiaModifier
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 196608)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class InteractionTrackerInertiaMotion final : InteractionTrackerInertiaModifier
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 196608)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class InteractionTrackerInertiaMotion : InteractionTrackerInertiaModifier
Public NotInheritable Class InteractionTrackerInertiaMotion
Inherits InteractionTrackerInertiaModifier
継承
Object Platform::Object IInspectable CompositionObject InteractionTrackerInertiaModifier InteractionTrackerInertiaMotion
属性

Windows の要件

デバイス ファミリ
Windows 10 Anniversary Edition (10.0.14393.0 で導入)
API contract
Windows.Foundation.UniversalApiContract (v3.0 で導入)

void CustomSpringInertiaMotion(float dampingCoefficient, 	float springStiffnessCoefficient)
{
  //
  // Set up our inertia modifiers to use our custom motion
  //
  InteractionTrackerInertiaMotion[] modifiers = 
  new InteractionTrackerInertiaMotion[1];

  var modifier1 = InteractionTrackerInertiaMotion.Create(_compositor);

  /*
  We create a custom spring motion for when the InteractionTracker passes the
  maximum boundary. 
  When we hit the boundary, the amount of oscillation is determined by the 	distance to the far end point, the spring stiffness and damping rate.
  */ 

  // Define the condition that the spring motion gets applied – when we pass the
  // maximum boundary
  modifier1.Condition = _compositor.CreateExpressionAnimation(
  "this.Target.NaturalRestingPosition.X > this.Target.MaxPosition.X");

  // Define the second derivative equation as a custom spring force motion
  // Equation = kx–cv where (k is spring constant, c is damping, x is displacement)
  modifier1.Motion = _compositor.CreateExpressionAnimation(
    "(-springStiffnessCoefficient * (this.Target.Position.X – this.Target.MaxPosition.X)) + " +
    "(-dampingCoefficient * target.PositionVelocityInPixelsPerSecond.X");

  modifier1.Motion.SetScalarParameter("springStiffnessCoefficient", springStiffnessCoefficient);
  modifier1.Motion.SetScalarParameter("dampingCoefficient", dampingCoefficient);

  modifiers[0] = modifier1;

  // Attach InertiaModifiers to the Y position component of InteractionTracker
  _tracker.ConfigurePositionYInertiaModifiers(modifiers);
}

注釈

InteractionTrackerInertiaMotion のモーション コンポーネントの ExpressionAnimation を構築する場合、式は 2 番目の微分方程式として記述されます。 たとえば、上記のコード スニペットでは、ダンピングを使用したスプリングフォースモーションの基本的な数式を使用します。

InteractionTrackerInertiaMotion 修飾子を InteractionTracker にアタッチする場合は、X/Y 位置またはスケールに構成します。

条件プロパティを定義する ExpressionAnimation は、 InteractionTracker が慣性に入ったときに 1 回だけ評価されます (指の解放など、操作が完了した場合)。 条件が true と評価された場合、慣性式は、条件式が技術的に true ではなくなった場合でも、慣性の残りの部分のすべてのフレームで評価されます。

InteractionTrackerInertiaMotion 修飾子は、InteractionTracker が位置の計算に使用する数式を変更します。 したがって、最終的な静止位置は、式自体の性質によって決定されます。 InteractionTracker を特定の場所で停止する必要がある場合は、 InteractionTrackerInertiaRestingValue 修飾子を 使用します。

プロパティ

Comment

CompositionObject に関連付ける文字列。

(継承元 CompositionObject)
Compositor

この CompositionObject の作成に使用するコンポジター

(継承元 CompositionObject)
Condition

修飾子を適用するタイミングを記述する ExpressionAnimation

Condition プロパティは ExpressionAnimation で、慣性時に InteractionTracker によって指定されたモーション式が使用されるタイミングを定義します。 この式は、相互作用が発生した後に 1 回評価され、型 Bool に解決する必要があります。それ以外の場合は、条件の評価時にエラーがスローされます。 式の構築の詳細については、「 ExpressionAnimation クラス」ページを参照してください。

Dispatcher

CompositionObject のディスパッチャー。

(継承元 CompositionObject)
DispatcherQueue

CompostionObject の DispatcherQueue を取得します。

(継承元 CompositionObject)
ImplicitAnimations

このオブジェクトにアタッチされている暗黙的なアニメーションのコレクション。

(継承元 CompositionObject)
Motion

Condition プロパティの式が true の場合に InteractionTracker の変更されたモーションを記述する ExpressionAnimation

Motion プロパティは ExpressionAnimation で、対応する条件が満たされたときに慣性時に InteractionTracker が使用するモーションを記述します。 InteractionTracker が慣性状態にあり、Float 型に解決する必要がある場合、式はフレームごとに評価されます。それ以外の場合は、式が評価されるときにエラーがスローされます。 式の構築の詳細については、「 ExpressionAnimation クラス」ページを参照してください。

Properties

CompositionObject に関連付けられているプロパティのコレクション。

(継承元 CompositionObject)

メソッド

Close()

CompositionObject を閉じ、システム リソースを解放します。

(継承元 CompositionObject)
ConnectAnimation(String, CompositionAnimation)

接続とアニメーション。

(継承元 CompositionObject)
Create(Compositor)

InteractionTrackerInertiaMotion のインスタンスを作成します。

DisconnectAnimation(String)

アニメーションを切断します。

(継承元 CompositionObject)
Dispose()

アンマネージ リソースの解放またはリセットに関連付けられているアプリケーション定義のタスクを実行します。

(継承元 CompositionObject)
PopulatePropertyInfo(String, AnimationPropertyInfo)

アニメーション化できるプロパティを定義します。

(継承元 CompositionObject)
StartAnimation(String, CompositionAnimation)

アニメーションをオブジェクトの指定したプロパティに接続し、アニメーションを開始します。

(継承元 CompositionObject)
StartAnimation(String, CompositionAnimation, AnimationController)

アニメーションをオブジェクトの指定したプロパティに接続し、アニメーションを開始します。

(継承元 CompositionObject)
StartAnimationGroup(ICompositionAnimationBase)

アニメーション グループを開始します。

CompositionObject の StartAnimationGroup メソッドを使用すると、CompositionAnimationGroup を開始できます。 グループ内のすべてのアニメーションは、オブジェクトで同時に開始されます。

(継承元 CompositionObject)
StopAnimation(String)

指定したプロパティからアニメーションを切断し、アニメーションを停止します。

(継承元 CompositionObject)
StopAnimationGroup(ICompositionAnimationBase)

アニメーション グループを停止します。

(継承元 CompositionObject)
TryGetAnimationController(String)

指定したプロパティで実行されているアニメーションの AnimationController を返します。

(継承元 CompositionObject)

適用対象

こちらもご覧ください