共用方式為


InteractionTrackerInertiaRestingValue 類別

定義

ExpressionAnimation,定義互動後的其餘位置。

InteractionTrackerInertiaRestingValue 類別會定義兩個 ExpressionAnimation,在符合特定條件時計算 InteractionTracker 的明確待用位置。 InteractionTrackerInertiaRestingValue 定義為兩個部分:如果為 true,則會明確定義 InteractionTracker 的特定待用位置的條件陳述式,以及描述輸出位置之數學關聯性的方程式。 當需要確保 InteractionTracker 在發生互動之後,請利用 InteractionTrackerInertiaRestingValue 類別登陸特定位置。

public ref class InteractionTrackerInertiaRestingValue 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 InteractionTrackerInertiaRestingValue 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 InteractionTrackerInertiaRestingValue : InteractionTrackerInertiaModifier
Public NotInheritable Class InteractionTrackerInertiaRestingValue
Inherits InteractionTrackerInertiaModifier
繼承
Object Platform::Object IInspectable CompositionObject InteractionTrackerInertiaModifier InteractionTrackerInertiaRestingValue
屬性

Windows 需求

裝置系列
Windows 10 Anniversary Edition (已於 10.0.14393.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v3.0 引進)

範例

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);
}

備註

將 InteractionTrackerInertiaRestingValue 修飾詞附加至 InteractionTracker時,您可以將它設定為 X/Y 位置或小數位數。

定義條件屬性的 ExpressionAnimation 只會在互動完成 (手指釋放) 時執行一次,而 RestingValue 運算式則會執行每個框架。

InteractionTrackerInertiaRestingValue 修飾詞會在符合條件時明確定義 InteractionTracker 的其餘位置。 不過,它不會定義此明確位置的動作 – 系統會處理該動作。 因此,如果您需要 InteractionTracker 採取特定動作,但不需要它登陸確切的位置,請使用 InteractionTrackerInertiaMotion 修飾詞。

屬性

Comment

要與 CompositionObject 建立關聯的字串。

(繼承來源 CompositionObject)
Compositor

用來建立這個CompositionObjectCompositor

(繼承來源 CompositionObject)
Condition

ExpressionAnimation,描述何時應套用修飾詞。

Condition 屬性是 ExpressionAnimation ,可定義 InteractionTracker 何時應該有特定的待用位置。 此運算式會在互動發生之後執行一次,而且必須解析為 Bool 類型,否則評估條件時會擲回錯誤。 如需建置運算式的詳細資訊,請參閱 ExpressionAnimation 類別頁面。

Dispatcher

CompositionObject的發送器。

(繼承來源 CompositionObject)
DispatcherQueue

取得 CompostionObject 的 DispatcherQueue

(繼承來源 CompositionObject)
ImplicitAnimations

附加至這個物件的隱含動畫集合。

(繼承來源 CompositionObject)
Properties

CompositionObject相關聯的屬性集合。

(繼承來源 CompositionObject)
RestingValue

如果 Condition 屬性中的運算式為 true,則 ExpressionAnimation 可定義 InteractionTracker 的其餘值。

Resting 屬性是 ExpressionAnimation ,描述如果符合對應的條件, InteractionTracker 會在互動之後移至何處。 當 InteractionTracker 處於慣性且必須解析為 Float 類型時,此運算式將會執行每個畫面,否則評估方程式時會擲回錯誤。 如需建置運算式的詳細資訊,請參閱 ExpressionAnimation 類別頁面。

方法

Close()

關閉 CompositionObject 並釋放系統資源。

(繼承來源 CompositionObject)
ConnectAnimation(String, CompositionAnimation)

連接和動畫。

(繼承來源 CompositionObject)
Create(Compositor)

建立 InteractionTrackerInertiaRestingValue的實例。

DisconnectAnimation(String)

中斷動畫的連接。

(繼承來源 CompositionObject)
Dispose()

執行與釋放 (Free)、釋放 (Release) 或重設 Unmanaged 資源相關聯之應用程式定義的工作。

(繼承來源 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)

適用於

另請參閱