このページでは

XAnimator QML Type

XAnimator 型は、アイテムの x 座標をアニメーション化します。詳細...

Import Statement: import QtQuick
Inherits:

Animator

詳細な説明

Animator この型は、通常の Animation 型とは異なります。Animator を使用する場合、アニメーションはレンダリングスレッドで実行され、アニメーションが完了するとプロパティの値は終了位置にジャンプします。

Item::x の値は、アニメーションが終了した後に更新されます。

以下のスニペットは、XAnimator を Rectangle アイテムと組み合わせて使用する方法を示しています。

Rectangle {
    id: xmovingBox
    width: 50
    height: 50
    color: "lightsteelblue"
    XAnimator {
        target: xmovingBox;
        from: 10;
        to: 0;
        duration: 1000
        running: true
    }
}

また、on キーワードを使用して、XAnimator を Item インスタンスに直接結び付けることも可能です。

Rectangle {
    width: 50
    height: 50
    color: "lightsteelblue"
    XAnimator on x {
        from: 10;
        to: 0;
        duration: 1000
    }
}

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

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

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