このページでは

NumberAnimation QML Type

qreal型の値の変化をアニメートする。詳細...

Import Statement: import QtQuick
Inherits:

PropertyAnimation

Inherited By:

SmoothedAnimation and SpringAnimation

プロパティ

詳細説明

NumberAnimationは、数値が変化したときに適用されるアニメーションを定義する特殊なPropertyAnimation

ここでは、Rectanglex プロパティをプロパティ値のソースとして、NumberAnimation を適用しています。これは、x の値を、現在の値から 50 の値まで、1000 ミリ秒かけてアニメーション化します:

import QtQuick

Rectangle {
    width: 100; height: 100
    color: "red"

    NumberAnimation on x { to: 50; duration: 1000 }
}

他のアニメーションタイプと同様に、NumberAnimationは、トランジション、ビヘイビア、プロパティ値ソースなど、さまざまな方法で適用できます。 Qt Quick のAnimation and Transitionsのドキュメントでは、アニメーションを作成するためのさまざまな方法を紹介しています。

NumberAnimationは、トラッキングする数値に不規則な変化がある場合、スムーズにアニメーションしないことがあります。その場合は、SmoothedAnimation

Qt Quick Qt Quick Examples - Animationのアニメーションとトランジションも参照してください

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

from : real

このプロパティは、アニメーションの開始値を保持します。

例えば、x の値が 100 に達するまで、以下のアニメーションは適用されません:

Item {
    states: [
        // ...
    ]

    transitions: Transition {
        NumberAnimation { properties: "x"; from: 100; duration: 200 }
    }
}

NumberAnimationTransition またはBehavior 内で定義されている場合、この値はTransition の開始状態で定義された値、またはBehavior がトリガーされた時点でのプロパティの現在値にデフォルト設定されます。

Qt Quick のアニメーションとトランジションも参照してください

to : real

このプロパティは、アニメーションの終了値を保持する。

NumberAnimationTransition またはBehavior 内で定義されている場合、この値はデフォルトでTransition の終了状態で定義された値、またはBehavior のトリガーとなったプロパティ変更の値になります。

Qt Quick の「アニメーションとトランジション」も参照してください

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