Partage via


InteractionTracker.ScaleVelocityInPercentPerSecond Propriété

Définition

Taux de modification pour la mise à l’échelle.

La propriété ScaleVelocityInPercentPerSecond représente la vitesse d’échelle actuelle d’InteractionTracker dans Inertie. Saisir la vitesse de position d’InteractionTracker juste après qu’une interaction s’est produite ou référencer la vitesse la plus actuelle d’InteractionTracker dans une ExpressionAnimation.

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

Valeur de propriété

Single

float

Taux de modification pour la mise à l’échelle.

Exemples

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

Remarques

Lorsque vous accédez à la propriété ScaleVelocityInPercentPerSecond à partir de l’événement InertiaStateEntered, vous récupérez un instantané de la vitesse calculée en fonction de l’interaction. Cet événement ne se déclenche qu’une seule fois après que l’interaction s’est produite.

S’applique à