InteractionTracker.ScaleVelocityInPercentPerSecond Свойство

Определение

Скорость изменения масштаба.

Свойство ScaleVelocityInPercentPerSecond представляет текущую скорость масштабирования InteractionTracker в режиме инерции. Захват скорости позиции InteractionTracker сразу после возникновения взаимодействия или ссылка на самую текущую скорость InteractionTracker в ExpressionAnimation.

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

Комментарии

При доступе к свойству ScaleVelocityInPercentPerSecond из события InertiaStateEntered вы будете получать snapshot вычисляемой скорости на основе взаимодействия. Это событие срабатывает только один раз после того, как произошло взаимодействие.

Применяется к