このページでは

RotationAnimator QML Type

RotationAnimator タイプは、Item の回転をアニメーション化します。詳細...

Import Statement: import QtQuick
Inherits:

Animator

プロパティ

詳細説明

Animator タイプは通常のAnimationタイプとは異なります。Animatorを使用する場合、アニメーションはレンダースレッドで実行することができ、アニメーションが完了するとプロパティ値は最後にジャンプします。

アニメーションが終了すると、Item::rotation の値が更新されます。

次のスニペットは、RotationAnimator を Rectangle アイテムと一緒に使用する方法を示しています。

Rectangle {
    id: rotatingBox
    width: 50
    height: 50
    color: "lightsteelblue"
    RotationAnimator {
        target: rotatingBox;
        from: 0;
        to: 360;
        duration: 1000
        running: true
    }
}

また、on キーワードを使用して、Item インスタンスのrotation プロパティに RotationAnimator を直接結びつけることも可能です。

Rectangle {
    width: 50
    height: 50
    color: "lightsteelblue"
    RotationAnimator on rotation {
        from: 0;
        to: 360;
        duration: 1000
    }
}

注: 非スレッドのレンダリングループを使用する場合、Animator タイプは何のメリットもありません。

:アプリケーションでは、メイン(GUI)スレッドで高価なブロッキング処理を行いながらアニメーション・コンテンツを表示するアニメーターに依存するのではなく、マルチスレッド、非同期の原則に基づく設計を考慮することをお勧めします。QMLではWorkerScriptasynchronous image loading 、C++ではワーカースレッド、並列アルゴリズムなどを使用します、 Qt ConcurrentC++では、ワーカースレッド、並列アルゴリズム、コルーチンを使用します。

Item::transformOrigin およびScaleAnimatorも参照して ください。

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

direction : enumeration

このプロパティは回転方向を保持する。

取り得る値は以下の通り:

定数説明
RotationAnimator.Numerical(デフォルト) 2つの数値の間を線形補間して回転させる。10から350までの回転は、時計回りに340度回転する。
RotationAnimator.Clockwise2つの値の間を時計回りに回転
RotationAnimator.Counterclockwise2つの値の間を反時計回りに回転
RotationAnimator.Shortest最も短いアニメーションパスを生成する方向に回転します。10から350までの回転は、反時計回りに20度回転します。

© 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.