C

Qt Quick Ultralite Motorcycle Cluster Demo

// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
import QtQuick 2.0

Item {
    id: root

    opacity: 0

    property bool active: false
    property int welcomeAnimationDuration: 500
    property int welcomeAnimationDelay: 0

    onActiveChanged: {
        if(active) {
            showAnimation.start()
        }
        else {
            hideAnimation.start()
        }
    }

    SequentialAnimation {
        id: showAnimation
        PauseAnimation {  duration: root.welcomeAnimationDelay }
        NumberAnimation {
            target: root
            property: "opacity"
            duration: root.welcomeAnimationDuration
            to: 1
        }
    }

    NumberAnimation {
        id: hideAnimation
        target: root
        property: "opacity"
        duration: root.welcomeAnimationDuration
        to: 0
    }
}