次の方法で共有


InteractionTrackerInertiaMotion クラス

定義

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

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

public ref class InteractionTrackerInertiaMotion sealed : InteractionTrackerInertiaModifier
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.Foundation.LiftedContract, 65536)]
/// [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.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.Foundation.WindowsAppSDKContract, 65536)]
class InteractionTrackerInertiaMotion final : InteractionTrackerInertiaModifier
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.Foundation.LiftedContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class InteractionTrackerInertiaMotion : InteractionTrackerInertiaModifier
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.Foundation.WindowsAppSDKContract), 65536)]
public sealed class InteractionTrackerInertiaMotion : InteractionTrackerInertiaModifier
Public NotInheritable Class InteractionTrackerInertiaMotion
Inherits InteractionTrackerInertiaModifier
継承
Object Platform::Object IInspectable CompositionObject InteractionTrackerInertiaModifier InteractionTrackerInertiaMotion
属性

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 Position または Scale に構成します。

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

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

プロパティ

Comment

CompositionObject に関連付ける文字列。

(継承元 CompositionObject)
Compositor

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

(継承元 CompositionObject)
Condition

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

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

DispatcherQueue

CompositionObject の DispatcherQueue を取得します。

(継承元 CompositionObject)
ImplicitAnimations

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

(継承元 CompositionObject)
Motion

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

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

Properties

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

(継承元 CompositionObject)

メソッド

Close()

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

(継承元 CompositionObject)
Create(Compositor)

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

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)

適用対象

こちらもご覧ください