共用方式為


InteractionTracker.ScaleVelocityInPercentPerSecond 屬性

定義

調整的變更速率。

ScaleVelocityInPercentPerSecond 屬性代表 InteractionTracker 目前在慣性中的縮放速度。 在 Interaction 發生之後抓取InteractionTracker的位置速度,或在ExpressionAnimation中參考InteractionTracker的最新速度。

public:
 property float ScaleVelocityInPercentPerSecond { float get(); };
float ScaleVelocityInPercentPerSecond();
public float ScaleVelocityInPercentPerSecond { get; }
var single = interactionTracker.scaleVelocityInPercentPerSecond;
Public ReadOnly Property ScaleVelocityInPercentPerSecond As Single

屬性值

Single

float

調整的變更速率。

範例

// Listen for the InertiaStateEntered event
public void InertiaStateEntered(InteractionTracker sender, 	InteractionTrackerInertiaStateEnteredArgs args)
{
  // Grab the Scale velocity out of the args when the event is fired. 
  float scaleVelocity = args.ScaleVelocityInPercentPerSecond;
}

void CustomSpringMotion(float springCoefficient, float dampingCoefficient, float 	maxScale)
{
  // Create the InertiaModifier that will be a custom motion emulating a spring
  InteractionTrackerInertiaMotion modifier = InteractionTrackerInertiaMotion.Create(_compositor);
  modifier.Condition = _compositor.CreateExpressionAnimation("this.Target.NaturalRestingPosition.X > maxScale");
  modifier.Condition.SetScalarParameter("maxScale", maxScale);

  // Utilize the current Velocity of InteractionTracker in the Expression defining 	the custom spring motion
  modifier.Motion = _compositor.CreateExpressionAnimation("(-springStiffnessCoefficient * (this.Target.Position.X – maxScale)) + " +
    "(-dampingCoefficient * this.target.ScaleVelocityInPercentPerSecond");
  modifier.Motion.SetScalarParameter("springStiffnessCoefficient", springCoefficient);
  modifier.Motion.SetScalarParameter("dampingCoefficient", dampingCoefficient);
  modifier.Motion.SetScalarParameter("maxScale", maxScale);
}

備註

InertiaStateEntered 事件存取 ScaleVelocityInPercentPerSecond 屬性時,您會根據互動來擷取計算速度的快照集。 此事件只會在互動發生之後引發一次。

適用於