QuaternionKeyFrameAnimation クラス

定義

1 つ以上のキー フレームを持つ Orientation プロパティを対象とする時間ベースのアニメーション。

QuaternionKeyFrameAnimation クラスは、Visual のOrientation プロパティをアニメーション化するために使用される、サポートされている種類の KeyFrameAnimationの 1 つです。 四元数は、回転について考えるのに便利で、時には簡単な方法です。四元数は角度間の最短パスを取り、回転角度/軸と回転行列が実行されるジンバル ロックのような問題を回避します。 四元数は、スカラー部分とベクトル部分の 2 つのコンポーネントで構成されます。

public ref class QuaternionKeyFrameAnimation sealed : KeyFrameAnimation
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.Foundation.LiftedContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class QuaternionKeyFrameAnimation final : KeyFrameAnimation
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.Foundation.WindowsAppSDKContract, 65536)]
class QuaternionKeyFrameAnimation final : KeyFrameAnimation
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.Foundation.LiftedContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class QuaternionKeyFrameAnimation : KeyFrameAnimation
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.Foundation.WindowsAppSDKContract), 65536)]
public sealed class QuaternionKeyFrameAnimation : KeyFrameAnimation
Public NotInheritable Class QuaternionKeyFrameAnimation
Inherits KeyFrameAnimation
継承
Object Platform::Object IInspectable CompositionObject CompositionAnimation KeyFrameAnimation QuaternionKeyFrameAnimation
属性

void QuaternionAnimation(SpriteVisual visual)
{
  // Create the QuaternionKeyFrameAnimation
  var quaternionKFA = _compositor.CreateQuaternionKeyFrameAnimation();

  // Create a Quaternion that represents a 45 degree rotation around X Axis
  Quaternion quaternion = new Quaternion(0.380f, 0f, 0.0f, 0.92f);

  // Insert the Quaternion into the KeyFrame
  quaternionKFA.InsertKeyFrame(1.0f, quaternion);
  quaternionKFA.Duration = TimeSpan.FromSeconds(1);

  // Attach to the Orientation property of Visual
  visual.StartAnimation("Orientation", quaternionKFA);
}

注釈

アニメーションは、 CompositionObject.StartAnimation を呼び出し、プロパティ名とアニメーションを指定することで、オブジェクトのプロパティに関連付けられます。 アニメーション化可能なプロパティの一覧については 、CompositionObject.StartAnimation の解説セクションを参照してください。

四元数は、ベクトルとスカラーコンポーネントの 2 つの区別可能な部分で構成されます。 KeyFrame アニメーションで を使用する場合、四元数は、4 floats または Vector3 とスカラーの System.Numerics の表記によって定義できます。 System.Numerics には、これらの表記のいずれかのコンストラクターが用意されています。

回転を四元数に変換する場合は、System.Numerics 四元数ヘルパー関数を使用して、軸/角度コンボ、回転行列、またはヨー/ピッチ/ロールから四元数を作成できます。 上の例では、次のヘルパーから同じ四元数を構築できます。

Quaternion quaternion = Quaternion.CreateFromAxisAngle(new Vector3(1.0f, 0.0f, 0.0f), 0.78f);

プロパティ

Comment

CompositionObject に関連付ける文字列。

(継承元 CompositionObject)
Compositor

この CompositionObject の作成に使用するコンポジター

(継承元 CompositionObject)
DelayBehavior

キー フレーム アニメーションの遅延動作。

(継承元 KeyFrameAnimation)
DelayTime

CompositionObject.StartAnimation が呼び出された後にアニメーションが開始されるまでの遅延。

(継承元 KeyFrameAnimation)
Direction

アニメーションの再生方向。

Direction プロパティを使用すると、アニメーションに IterationCount が 1 より大きい場合は、アニメーションを開始から終了、開始、または開始と終了の間で切り替えて開始することができます。 これにより、アニメーション定義を簡単にカスタマイズできます。

(継承元 KeyFrameAnimation)
DispatcherQueue

CompositionObject の DispatcherQueue を取得します。

(継承元 CompositionObject)
Duration

アニメーションの継続時間。

(継承元 KeyFrameAnimation)
ImplicitAnimations

このオブジェクトにアタッチされている暗黙的なアニメーションのコレクション。

(継承元 CompositionObject)
InitialValueExpressions

アニメーションの初期値を取得します。

(継承元 CompositionAnimation)
IterationBehavior

キー フレーム アニメーションの反復動作。

(継承元 KeyFrameAnimation)
IterationCount

キー フレーム アニメーションを繰り返す回数。

(継承元 KeyFrameAnimation)
KeyFrameCount

KeyFrameAnimation 内のキー フレームの数。

(継承元 KeyFrameAnimation)
Properties

CompositionObject に関連付けられているプロパティのコレクション。

(継承元 CompositionObject)
StopBehavior

StopAnimation が呼び出されたときにプロパティ値を設定する方法を指定します。

(継承元 KeyFrameAnimation)
Target

アニメーションのターゲット。

(継承元 CompositionAnimation)

メソッド

ClearAllParameters()

アニメーションのすべてのパラメーターをクリアします。

(継承元 CompositionAnimation)
ClearParameter(String)

アニメーションからパラメーターをクリアします。

(継承元 CompositionAnimation)
Close()

CompositionObject を閉じ、システム リソースを解放します。

(継承元 CompositionObject)
Dispose()

アンマネージ リソースの解放またはリセットに関連付けられているアプリケーション定義のタスクを実行します。

(継承元 CompositionObject)
InsertExpressionKeyFrame(Single, String)

式のキー フレームを挿入します。

(継承元 KeyFrameAnimation)
InsertExpressionKeyFrame(Single, String, CompositionEasingFunction)

式キーフレームを挿入します。

(継承元 KeyFrameAnimation)
InsertKeyFrame(Single, Quaternion)

キー フレームを挿入します。

InsertKeyFrame(Single, Quaternion, CompositionEasingFunction)

指定したイージング関数を使用してキー フレームを挿入します。

PopulatePropertyInfo(String, AnimationPropertyInfo)

アニメーション化できるプロパティを定義します。

(継承元 CompositionObject)
SetBooleanParameter(String, Boolean)

ExpressionAnimation または式キーフレームで使用するブール値パラメーターを設定します。

(継承元 CompositionAnimation)
SetColorParameter(String, Color)

ExpressionAnimation または式キーフレームで使用する Color 値パラメーターを設定します。

(継承元 CompositionAnimation)
SetExpressionReferenceParameter(String, IAnimationObject)

ExpressionAnimation の参照パラメーターとして IAnimationObject を実装するオブジェクトを設定します。

(継承元 CompositionAnimation)
SetMatrix3x2Parameter(String, Matrix3x2)

ExpressionAnimation または式キーフレームで使用する Matrix3x2 値パラメーターを設定します。

(継承元 CompositionAnimation)
SetMatrix4x4Parameter(String, Matrix4x4)

ExpressionAnimation または式キーフレームで使用する Matrix4x4 値パラメーターを設定します。

(継承元 CompositionAnimation)
SetQuaternionParameter(String, Quaternion)

ExpressionAnimation または式キーフレームで使用する四元数の値を設定します。

(継承元 CompositionAnimation)
SetReferenceParameter(String, CompositionObject)

ExpressionAnimation または式キーフレームで使用する Composition オブジェクトへの参照を設定します。

(継承元 CompositionAnimation)
SetScalarParameter(String, Single)

ExpressionAnimation または式キーフレームで使用するスカラー値パラメーターを設定します。

(継承元 CompositionAnimation)
SetVector2Parameter(String, Vector2)

ExpressionAnimation または式キーフレームで使用する Vector2 値パラメーターを設定します。

(継承元 CompositionAnimation)
SetVector3Parameter(String, Vector3)

ExpressionAnimation または式キーフレームで使用する Vector3 値パラメーターを設定します。

(継承元 CompositionAnimation)
SetVector4Parameter(String, Vector4)

ExpressionAnimation または式キーフレームで使用する Vector4 値パラメーターを設定します。

(継承元 CompositionAnimation)
StartAnimation(String, CompositionAnimation)

アニメーションをオブジェクトの指定したプロパティに接続し、アニメーションを開始します。

(継承元 CompositionObject)
StartAnimation(String, CompositionAnimation, AnimationController)

アニメーションをオブジェクトの指定したプロパティに接続し、アニメーションを開始します。

(継承元 CompositionObject)
StartAnimationGroup(ICompositionAnimationBase)

アニメーション グループを開始します。

CompositionObject の StartAnimationGroup メソッドを使用すると、CompositionAnimationGroup を開始できます。 グループ内のすべてのアニメーションは、オブジェクトで同時に開始されます。

(継承元 CompositionObject)
StopAnimation(String)

指定したプロパティからアニメーションを切断し、アニメーションを停止します。

(継承元 CompositionObject)
StopAnimationGroup(ICompositionAnimationBase)

アニメーション グループを停止します。

(継承元 CompositionObject)
TryGetAnimationController(String)

指定したプロパティで実行されているアニメーションの AnimationController を返します。

(継承元 CompositionObject)

適用対象

こちらもご覧ください