このページでは

Qt3DAnimation::QKeyframeAnimation Class

class Qt3DAnimation::QKeyframeAnimation

QTransform に対して、簡単なキーフレームアニメーションを実装するクラスです。詳細はこちら...

ヘッダー: #include <qkeyframeanimation.h>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3danimation)
target_link_libraries(mytarget PRIVATE Qt6::3danimation)
qmake: QT += 3danimation
QML内: KeyframeAnimation
継承元: Qt3DAnimation::QAbstractAnimation
ステータス: テクノロジープレビュー

このクラスはテクノロジープレビュー段階にあり、変更される可能性があります。

パブリック型

enum RepeatMode { None, Constant, Repeat }

プロパティ

パブリック関数

QKeyframeAnimation(QObject *parent = nullptr)
void addKeyframe(Qt3DCore::QTransform *keyframe)
QEasingCurve easing() const
Qt3DAnimation::QKeyframeAnimation::RepeatMode endMode() const
QList<float> framePositions() const
QList<Qt3DCore::QTransform *> keyframeList() const
void removeKeyframe(Qt3DCore::QTransform *keyframe)
void setKeyframes(const QList<Qt3DCore::QTransform *> &keyframes)
Qt3DAnimation::QKeyframeAnimation::RepeatMode startMode() const
Qt3DCore::QTransform *target() const
QString targetName() const

パブリックスロット

void setEasing(const QEasingCurve &easing)
void setEndMode(Qt3DAnimation::QKeyframeAnimation::RepeatMode mode)
void setFramePositions(const QList<float> &positions)
void setStartMode(Qt3DAnimation::QKeyframeAnimation::RepeatMode mode)
void setTarget(Qt3DCore::QTransform *target)
void setTargetName(const QString &name)

シグナル

void easingChanged(const QEasingCurve &easing)
void endModeChanged(Qt3DAnimation::QKeyframeAnimation::RepeatMode endMode)
void framePositionsChanged(const QList<float> &positions)
void startModeChanged(Qt3DAnimation::QKeyframeAnimation::RepeatMode startMode)
void targetChanged(Qt3DCore::QTransform *target)
void targetNameChanged(const QString &name)

詳細な説明

Qt3DAnimation::QKeyframeAnimation クラスは、QTransform をアニメーション化するために使用できる、シンプルなキーフレームアニメーションを実装しています。 キーフレームは、複数の時間指定された QTransforms で構成されており、これらは補間されてターゲットのQTransform に適用されます。キーフレーム間で、QEasingCurve を使用して補間器を制御します。RepeatMode は、QKeyframeAnimation に設定された位置が、キーフレームの位置で定義された値より下または上にある場合に設定できます。

メンバ型のドキュメント

enum QKeyframeAnimation::RepeatMode

この列挙型は、キーフレームの範囲外の位置値がどのように扱われるかを指定します。

定数値説明
Qt3DAnimation::QKeyframeAnimation::None0ターゲットのトランスフォームにはアニメーションが適用されません。
Qt3DAnimation::QKeyframeAnimation::Constant1エッジキーフレームの値が使用されます。
Qt3DAnimation::QKeyframeAnimation::Repeat2アニメーションが繰り返されます。

プロパティのドキュメント

easing : QEasingCurve

キーフレーム間の補間関数のイージングカーブを保持します。

アクセス関数:

QEasingCurve easing() const
void setEasing(const QEasingCurve &easing)

通知シグナル:

void easingChanged(const QEasingCurve &easing)

endMode : RepeatMode

前回のフレーム位置より大きい位置値について、リピートモードを維持します。

アクセス関数:

Qt3DAnimation::QKeyframeAnimation::RepeatMode endMode() const
void setEndMode(Qt3DAnimation::QKeyframeAnimation::RepeatMode mode)

通知信号:

void endModeChanged(Qt3DAnimation::QKeyframeAnimation::RepeatMode endMode)

framePositions : QList<float>

キーフレームの位置を保持します。リスト内の各位置は、同じインデックスを持つ対応するキーフレームの位置を指定します。値は昇順で指定する必要があります。値は正または負の値をとることができ、あらかじめ定義された単位はありません。

アクセス関数:

QList<float> framePositions() const
void setFramePositions(const QList<float> &positions)

通知シグナル:

void framePositionsChanged(const QList<float> &positions)

startMode : RepeatMode

最初のフレーム位置より小さい位置値について、リピートモードを維持します。

アクセス関数:

Qt3DAnimation::QKeyframeAnimation::RepeatMode startMode() const
void setStartMode(Qt3DAnimation::QKeyframeAnimation::RepeatMode mode)

通知信号:

void startModeChanged(Qt3DAnimation::QKeyframeAnimation::RepeatMode startMode)

target : Qt3DCore::QTransform*

アニメーションが適用される対象のQTransform を保持します。

アクセス関数:

Qt3DCore::QTransform *target() const
void setTarget(Qt3DCore::QTransform *target)

通知シグナル:

void targetChanged(Qt3DCore::QTransform *target)

targetName : QString

ターゲットトランスフォームの名前を保持します。これは、ターゲットトランスフォームをキーフレームアニメーションと照合しやすくするための便利なプロパティです。通常、この名前はターゲットトランスフォームの親エンティティの名前と同じですが、必ずしもそうである必要はありません。

アクセス関数:

QString targetName() const
void setTargetName(const QString &name)

通知シグナル:

void targetNameChanged(const QString &name)

メンバ関数のドキュメント

[explicit] QKeyframeAnimation::QKeyframeAnimation(QObject *parent = nullptr)

parent を使用して QKeyframeAnimation を生成します。

void QKeyframeAnimation::addKeyframe(Qt3DCore::QTransform *keyframe)

アニメーションの最後に新しいkeyframe を追加します。QTransform は、アニメーションに複数回追加することができます。

QList<Qt3DCore::QTransform *> QKeyframeAnimation::keyframeList() const

キーフレームのリストを返します。

void QKeyframeAnimation::removeKeyframe(Qt3DCore::QTransform *keyframe)

アニメーションからkeyframe を削除します。同じQTransform がキーフレームとして複数回設定されている場合、そのすべてのインスタンスが削除されます。

void QKeyframeAnimation::setKeyframes(const QList<Qt3DCore::QTransform *> &keyframes)

アニメーションのkeyframes を設定します。古いキーフレームはクリアされます。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.