次の方法で共有


InteractionTracker.TryUpdateScaleWithAnimation メソッド

定義

指定したアニメーションを使用してスケールの更新を試みます。

TryUpdateScaleWithAnimation メソッドは、パラメーターとして入力された CompositionAnimation に基づいて InteractionTracker のスケール位置を更新します。 このメソッドは、従来の慣性エクスペリエンスではなく、 InteractionTracker のモーションを特定のアニメーションで定義する必要がある状況で使用されます。 TryUpdateScaleWithAnimation は、アイドル状態または慣性状態から呼び出すことができます。これにより、 InteractionTracker の位置は、定義されたアニメーションによって駆動され、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

パラメーター

animation
CompositionAnimation

スケールに適用するアニメーション。

centerPoint
Vector3 Vector3

float3

新しい中心点。

戻り値

Int32

int

要求 ID を返します。 状態遷移では、状態の変化の原因となった要求が args に含まれます。 これらの ID は 1 から開始され、アプリケーションの有効期間中に各 try 呼び出しで増加します。

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

注釈

InteractionTracker の位置を更新するアニメーションを作成するときに、StartAnimation を呼び出す必要はありません。 TryUpdateScaleWithAnimation 経由でアニメーションが渡されると、システムによってバックグラウンドでこの処理が行われます。

InteractionTracker のスケール位置をアニメーション化するアニメーションを定義する場合は、ScalarKeyFrameAnimation またはスカラーに解決される ExpressionAnimation を使用してください。

次の表は、このメソッドが特定の状態で呼び出されたときの予想される動作をまとめたものです。

現在の状態結果
アイドル要求されたアニメーションは、要求されたプロパティで開始され、CustomAnimation に対する状態の変更
操作中要求が無視される
慣性要求されたアニメーションは、要求されたプロパティで開始され、CustomAnimation に対する状態の変更
CustomAnimation現在のアニメーションが停止し、要求されたプロパティで新しい要求されたアニメーションが開始され、状態が CustomAnimation に再入力されます

適用対象