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 の「アニメーションとトランジション」も参照してください


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