59131c023a378923219862e157e3d35b64d5df7b
[apps/homescreen.git] / homescreen / qml / IconItem.qml
1 import QtQuick 2.0
2
3 Item {
4     id: main
5     Image {
6         id: item; parent: loc
7         x: main.x + 5; y: main.y + 5
8         width: main.width - 10; height: main.height - 10;
9         source: './images/HMI_AppLauncher_%1_%2-01.png'.arg(model.icon).arg(loc.pressed && (loc.index === model.index || loc.currentId === model.id) ? 'Active' : 'Inactive')
10         antialiasing: item.state !== ''
11         Behavior on x { enabled: item.state !== 'active'; NumberAnimation { duration: 400; easing.type: Easing.OutCubic } }
12         Behavior on y { enabled: item.state !== 'active'; NumberAnimation { duration: 400; easing.type: Easing.OutCubic } }
13         SequentialAnimation on rotation {
14             NumberAnimation { to:  5; duration: 100 }
15             NumberAnimation { to: -5; duration: 200 }
16             NumberAnimation { to:  0; duration: 100 }
17             running: loc.currentId !== '' && item.state !== 'active'
18             loops: Animation.Infinite; alwaysRunToEnd: true
19         }
20         states: [
21             State {
22                 name: 'active'
23                 when: loc.currentId == model.id
24                 PropertyChanges { target: item; x: loc.mouseX - width/2; y: loc.mouseY - height/2; scale: 1.15; z: 10 }
25             },
26             State {
27                 when: loc.currentId !== ''
28                 PropertyChanges {
29                     target: item
30                     scale: 0.85
31                     opacity: 0.75
32                 }
33             }
34         ]
35         transitions: Transition { NumberAnimation { properties: 'scale, opacity, x, y'; duration: 150; easing.type: Easing.OutCubic} }
36     }
37 }