added lamp animation

This commit is contained in:
Max Grützner 2019-02-23 15:52:11 +01:00
parent e8d886ccb3
commit 08cebc92a7
3 changed files with 93 additions and 9 deletions

101
main.qml
View file

@ -22,12 +22,6 @@ Window {
background: Item {
id: lamp
Image {
id: lampOn
source: "on.png"
anchors.fill: parent
scale: 0
}
Image {
id: lampOn0
source: "on0.png"
@ -39,30 +33,100 @@ Window {
source: "on1.png"
anchors.fill: parent
scale: 0
Behavior on scale {
SequentialAnimation {
PauseAnimation {
duration: 200
}
NumberAnimation {
duration: 200
properties: "scale"
from: app.state === "on" ? 0:1
to: app.state === "on" ? 1:0
target: lampOn1
}
}
}
}
Image {
id: lampOn2
source: "on2.png"
anchors.fill: parent
scale: 0
Behavior on scale {
SequentialAnimation {
PauseAnimation {
duration: 400
}
NumberAnimation {
duration: 200
properties: "scale"
from: app.state === "on" ? 0:1
to: app.state === "on" ? 1:0
target: lampOn2
}
}
}
}
Image {
id: lampOn3
source: "on3.png"
anchors.fill: parent
scale: 0
Behavior on scale {
SequentialAnimation {
PauseAnimation {
duration: 600
}
NumberAnimation {
duration: 200
properties: "scale"
from: app.state === "on" ? 0:1
to: app.state === "on" ? 1:0
target: lampOn3
}
}
}
}
Image {
id: lampOn4
source: "on4.png"
anchors.fill: parent
scale: 0
Behavior on scale {
SequentialAnimation {
PauseAnimation {
duration: 800
}
NumberAnimation {
duration: 200
properties: "scale"
from: app.state === "on" ? 0:1
to: app.state === "on" ? 1:0
target: lampOn4
}
}
}
}
Image {
id: lampOn5
source: "on4.png"
source: "on5.png"
anchors.fill: parent
scale: 0
Behavior on scale {
SequentialAnimation {
PauseAnimation {
duration: 1000
}
NumberAnimation {
duration: 200
properties: "scale"
from: app.state === "on" ? 0:1
to: app.state === "on" ? 1:0
target: lampOn5
}
}
}
}
Image {
id: lampOff
@ -79,11 +143,32 @@ Window {
}
}
}
states: [
State {
name: "on"
PropertyChanges {
target: lampOn
target: lampOn0
scale: 1
}
PropertyChanges {
target: lampOn1
scale: 1
}
PropertyChanges {
target: lampOn2
scale: 1
}
PropertyChanges {
target: lampOn3
scale: 1
}
PropertyChanges {
target: lampOn4
scale: 1
}
PropertyChanges {
target: lampOn5
scale: 1
}
PropertyChanges {

BIN
on.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

View file

@ -1,7 +1,6 @@
<RCC>
<qresource prefix="/">
<file>off.png</file>
<file>on.png</file>
<file>on5.png</file>
<file>on4.png</file>
<file>on3.png</file>