共用方式為


InteractionTrackerInertiaRestingValue 類別

定義

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

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

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

範例

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 類別頁面。

DispatcherQueue

取得 CompositionObject 的 DispatcherQueue。

(繼承來源 CompositionObject)
ImplicitAnimations

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

(繼承來源 CompositionObject)
Properties

CompositionObject相關聯的屬性集合。

(繼承來源 CompositionObject)
RestingValue

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

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

方法

Close()

關閉 CompositionObject 並釋放系統資源。

(繼承來源 CompositionObject)
Create(Compositor)

建立 InteractionTrackerInertiaRestingValue的實例。

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)

適用於

另請參閱