Partage via


InteractionTracker.TryUpdateScaleWithAnimation Méthode

Définition

Tente de mettre à jour l’échelle avec l’animation spécifiée.

La méthode TryUpdateScaleWithAnimation met à jour la position d’échelle d’InteractionTracker en fonction de la compositionAnimation entrée en tant que paramètre. Cette méthode est utilisée dans les situations dans lesquelles le mouvement d’InteractionTracker doit être défini par une animation spécifique, au lieu de l’expérience d’inertie traditionnelle. TryUpdateScaleWithAnimation peut être appelé à partir de l’état Inactif ou Inertie . Ainsi, la position d’InteractionTracker est pilotée par l’animation définie et entre dans l’état CustomAnimation.

public:
 virtual int TryUpdateScaleWithAnimation(CompositionAnimation ^ animation, float3 centerPoint) = TryUpdateScaleWithAnimation;
int TryUpdateScaleWithAnimation(CompositionAnimation const& animation, float3 const& centerPoint);
public int TryUpdateScaleWithAnimation(CompositionAnimation animation, Vector3 centerPoint);
function tryUpdateScaleWithAnimation(animation, centerPoint)
Public Function TryUpdateScaleWithAnimation (animation As CompositionAnimation, centerPoint As Vector3) As Integer

Paramètres

animation
CompositionAnimation

Animation à appliquer à l’échelle.

centerPoint
Vector3 Vector3

float3

Nouveau point central.

Retours

Int32

int

Retourne l’ID de demande. Lors des transitions d’état, la demande qui a provoqué le changement d’état est incluse dans les arguments. Ces ID commencent à 1 et augmentent à chaque appel d’essai pendant la durée de vie de l’application.

Exemples

void CustomAnimationForIT(float newScale, Vector3 newCenterPoint)
{
  // Create a cubic bezier easing function that will be used in the KeyFrames
  CompositionEasingFunction cubicBezier = _compositor.CreateCubicBezierEasingFunction(new Vector2(.17f, .67f), new Vector2(1f, 1f);

  // Create the Vector3 KFA
  ScalarKeyFrameAnimation kfa = _compositor.CreateScalarKeyFrameAnimation();
  kfa.Duration = TimeSpan.FromSeconds(3);

  // Create the KeyFrames
  kfa.InsertKeyFrame(1.0f, newScale, cubicBezier);

  // Update InteractionTracker position using this animation
  _tracker.TryUpdatePositionWithAnimation(kfa, newCenterPoint);
}

Remarques

Lorsque vous créez l’animation avec laquelle vous souhaitez mettre à jour la position d’InteractionTracker , vous n’avez pas besoin d’appeler StartAnimation. Le système s’en chargera en arrière-plan une fois l’animation passée via TryUpdateScaleWithAnimation.

Lorsque vous définissez l’animation qui animera la position d’échelle d’InteractionTracker , veillez à utiliser une ScalarKeyFrameAnimation ou une ExpressionAnimation qui se résout en scalaire.

Le tableau ci-dessous récapitule le comportement attendu lorsque cette méthode est appelée dans un état particulier :

État actuelRésultat
IdleL’animation demandée démarre sur la propriété demandée, l’état passe à CustomAnimation
InteractionDemande ignorée
InertieL’animation demandée démarre sur la propriété demandée, l’état passe à CustomAnimation
CustomAnimationL’animation actuelle s’arrête et la nouvelle animation demandée démarre sur la propriété demandée, l’état entre de nouveau Dans CustomAnimation

S’applique à