ColorAnimation QML Type

色値の変化をアニメーション化する。もっと詳しく...

Import Statement: import QtQuick
Inherits:

PropertyAnimation

プロパティ

詳細説明

ColorAnimation は、PropertyAnimation に特化したもので、色の値が変化したときに適用されるアニメーションを定義します。

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

import QtQuick

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

    ColorAnimation on color { to: "yellow"; duration: 1000 }
}

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

便宜上、ColorAnimationがTransition で使用される場合、ステート変更中に変更されたcolor プロパティがアニメーション化されます。アニメーションにproperty またはproperties が明示的に設定されている場合は、それらのプロパティが代わりに使用されます。

Qt QuickおよびQt Quick Examples - Animationの Animation and Transitionsも参照してください

プロパティの説明

from : color

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

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

Item {
    states: [
        // States are defined here...
    ]

    transitions: Transition {
        ColorAnimation { from: "#c0c0c0"; duration: 2000 }
    }
}

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

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


to : color

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

ColorAnimationTransition または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.