Kuesa Car-Scene QML Example
import QtQuick 2.12
import QtQuick.Controls 2.12
Item {
id: root
property alias running: mainAnimation.running
property int minWidth: width
signal reset()
function restartTimer() {
idleTimer.restart()
if (mainAnimation.running) {
mainAnimation.running = false
root.reset()
}
}
Timer {
id: idleTimer
repeat: false
running: true
interval: 2 * 60 * 1000
onTriggered: mainAnimation.running = true
}
SequentialAnimation {
id: mainAnimation
ScriptAction { script: root.reset() }
ScriptAction { script: menuIcon.expanded = true }
PauseAnimation { duration: 1000 }
ScriptAction { script: titlePanel.showTitle("Use GLTF Cameras") }
SequentialAnimation {
NumberAnimation { target: speedC; property: "value"; to: 10; duration: 100 }
PauseAnimation { duration: 2500 }
NumberAnimation { target: speedC; property: "value"; to: 40; duration: 1100 }
PauseAnimation { duration: 1500 }
}
SequentialAnimation {
ScriptAction { script: titlePanel.showTitle("Trigger GLTF Animations") }
PauseAnimation { duration: 1000 }
PropertyAction { target: openRightDoorSwitch; property: "checked"; value: true }
PauseAnimation { duration: 5000 }
PropertyAction { target: openRightDoorSwitch; property: "checked"; value: false }
PropertyAction { target: openHoodSwitch; property: "checked"; value: true }
PauseAnimation { duration: 2500 }
PropertyAction { target: openLeftDoorSwitch; property: "checked"; value: true }
PauseAnimation { duration: 5000 }
PropertyAction { target: openLeftDoorSwitch; property: "checked"; value: false }
PropertyAction { target: openHoodSwitch; property: "checked"; value: false }
PauseAnimation { duration: 1000 }
}
SequentialAnimation {
PauseAnimation { duration: 1000 }
PropertyAction { targets: showSkyboxSwitch; property: "checked"; value: true }
ScriptAction { script: titlePanel.showTitle("Environment Maps") }
PauseAnimation { duration: 2000 }
ScriptAction { script: menuIcon.expanded = false }
PauseAnimation { duration: 1000 }
PropertyAction { targets: envNeuerZollhof; property: "checked"; value: true }
PauseAnimation { duration: 5000 }
PropertyAction { targets: envStudioSmall04; property: "checked"; value: true }
PauseAnimation { duration: 5000 }
PropertyAction { targets: envPinkSunrise; property: "checked"; value: true }
PauseAnimation { duration: 2000 }
PropertyAction { targets: showSkyboxSwitch; property: "checked"; value: false }
PauseAnimation { duration: 1000 }
}
PauseAnimation { duration: 1000 }
PropertyAction { targets: useOpacityMaskSwitch; property: "checked"; value: true }
ScriptAction { script: titlePanel.showTitle("Opacity Mask") }
PauseAnimation { duration: 10000 }
ScriptAction { script: menuIcon.expanded = true }
SequentialAnimation {
id: colorAnimations
PauseAnimation { duration: 2000 }
ScriptAction { script: titlePanel.showTitle("Dynamic Materials") }
ParallelAnimation {
NumberAnimation { target: redColor; property: "value"; to: 1.; duration: 1000 }
NumberAnimation { target: greenColor; property: "value"; to: 1.; duration: 1000 }
NumberAnimation { target: blueColor; property: "value"; to: 0.; duration: 1000 }
}
PauseAnimation { duration: 5000 }
ParallelAnimation {
NumberAnimation { target: redColor; property: "value"; to: 1.; duration: 1000 }
NumberAnimation { target: greenColor; property: "value"; to: 0.; duration: 1000 }
NumberAnimation { target: blueColor; property: "value"; to: 0.; duration: 1000 }
}
PauseAnimation { duration: 5000 }
ParallelAnimation {
NumberAnimation { target: redColor; property: "value"; to: 0.; duration: 1000 }
NumberAnimation { target: greenColor; property: "value"; to: 0.07; duration: 1000 }
NumberAnimation { target: blueColor; property: "value"; to: 0.2; duration: 1000 }
}
PauseAnimation { duration: 1000 }
}
PropertyAction { targets: useOpacityMaskSwitch; property: "checked"; value: false }
PauseAnimation { duration: 2000 }
PropertyAction { target: speedC; property: "value"; value: 0 }
PauseAnimation { duration: 1500 }
ScriptAction { script: menuIcon.expanded = false }
PauseAnimation { duration: 1500 }
SequentialAnimation {
PropertyAction { targets: envStudioSmall04; property: "checked"; value: true }
PauseAnimation { duration: 1000 }
ScriptAction { script: titlePanel.showTitle("Bloom Effect") }
PauseAnimation { duration: 1000 }
PropertyAction { targets: useBloomEffectSwitch; property: "checked"; value: true }
PauseAnimation { duration: 8000 }
PropertyAction { targets: useBloomEffectSwitch; property: "checked"; value: false }
PropertyAction { targets: envPinkSunrise; property: "checked"; value: true }
}
PauseAnimation { duration: 5000 }
loops: Animation.Infinite
}
Rectangle {
id: titlePanel
visible: opacity > 0
opacity: 0
scale: 0
radius: 20
color: "#33ffffff"
width: childrenRect.width + 20
height: childrenRect.height + 20
anchors {
bottom: parent.bottom
bottomMargin: 180
horizontalCenter: parent.horizontalCenter
horizontalCenterOffset: menu.width / 2
}
function showTitle(title) {
if (titleLabel.font.pixelSize < 20)
return
titleLabel.text = title
titleAnimation.running = true
}
function dismiss() {
titleAnimation.running = false
opacity = 0
}
Label {
id: titleLabel
x: 10
y: 10
width: implicitWidth
color: "#99ffffff"
font.pixelSize: (root.width - root.minWidth) / 15
}
}
SequentialAnimation {
id: titleAnimation
ParallelAnimation {
PropertyAnimation { target: titlePanel; property: "opacity"; from: .1; to: 1.; duration: 500; easing.type: Easing.InOutQuad }
PropertyAnimation { target: titlePanel; property: "scale"; from: .1; to: 1.; duration: 500; easing.type: Easing.OutBack }
}
PauseAnimation { duration: 3000 }
ParallelAnimation {
PropertyAnimation { target: titlePanel; property: "opacity"; to: 0.; duration: 500; easing.type: Easing.OutQuad }
PropertyAnimation { target: titlePanel; property: "scale"; to: 0.; duration: 500; easing.type: Easing.OutQuad }
}
}
onRunningChanged: {
if (!running)
titlePanel.dismiss()
}
}