C
Qt Quick Ultralite Motorcycle Cluster Demo
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
import QtQuick 2.0
ItemWithAcivationAnimations {
id: root
property bool isDayMode: false
width: img.width
height: img.height
Image {
id: img
source: "qrc:///images/mainScreen/road.png"
}
property real opacityReal: 1
onIsDayModeChanged: {
if (active) {
changeDayModeAnimation.start()
}
}
SequentialAnimation {
id: changeDayModeAnimation
PauseAnimation {
duration: 600
}
NumberAnimation {
target: img
property: "opacity"
to: 0
duration: 500
easing.type: Easing.OutCubic
}
ScriptAction {
script: img.source = isDayMode ? "qrc:///images/mainScreen/road-day.png" :
"qrc:///images/mainScreen/road.png"
}
NumberAnimation {
target: img
property: "opacity"
to: 1
duration: 500
easing.type: Easing.OutCubic
}
}
}