このページでは

RotationAnimator QML Type

RotationAnimator 型は、アイテムの回転をアニメーション化します。詳細...

Import Statement: import QtQuick
Inherits:

Animator

プロパティ

詳細な説明

Animator これらのタイプは、通常のアニメーションタイプとは異なります。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 キーワードを使用して、RotationAnimatorをItemインスタンスのrotation プロパティに直接紐付けることも可能です。

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

注: スレッド化されていないレンダリングループを使用する場合、Animator タイプにはメリットがありません。

注: アプリケーションでは、メイン(GUI)スレッドで負荷の高いブロック処理を実行しながらアニメーションコンテンツを表示するために Animator に依存するのではなく、マルチスレッドおよび非同期の原則に基づいた設計を検討することをお勧めします 。長時間かかるブロック処理の代わりに、QML では `WorkerScript ` および `asynchronous image loading ` を、C++ ではワーカースレッド、並列アルゴリズム、 Qt Concurrent、およびC++のコルーチンなどを優先的に使用することで、アプリケーション全体とUIの応答性を常に維持することを推奨します。

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.