nice animations

This commit is contained in:
Marco Martin 2015-06-04 13:35:46 -07:00
parent bdb4821376
commit 89459bedcb

View file

@ -31,24 +31,57 @@ PlasmaCore.Dialog {
flags: Qt.X11BypassWindowManagerHint flags: Qt.X11BypassWindowManagerHint
backgroundHints: PlasmaCore.Dialog.NoBackground backgroundHints: PlasmaCore.Dialog.NoBackground
onVisibleChanged: {
if (visible) {
showAnim.running = true;
}
}
mainItem: Item { mainItem: Item {
width: workspace.virtualScreenSize.width width: workspace.virtualScreenSize.width
height: workspace.virtualScreenSize.height height: workspace.virtualScreenSize.height
PlasmaComponents.Button { SequentialAnimation {
z: 99 id: hideAnim
text: "close" NumberAnimation {
onClicked: dialog.visible = false; target: view
properties: "contentY"
to: -view.height
duration: units.longDuration
easing.type: Easing.InOutQuad
}
ScriptAction {
script: dialog.visible = false;
}
}
NumberAnimation {
id: showAnim
target: view
properties: "contentY"
to: 0
duration: units.longDuration
easing.type: Easing.InOutQuad
} }
GridView { GridView {
id: view id: view
anchors.fill: parent anchors.fill: parent
cacheBuffer: 9999
cellWidth: units.gridUnit * 20 cellWidth: units.gridUnit * 20
cellHeight: units.gridUnit * 20 // (view.width / view.height) cellHeight: units.gridUnit * 20 // (view.width / view.height)
model: KWin.ClientModel { model: KWin.ClientModel {
id: clientModel id: clientModel
exclusions: KWin.ClientModel.NotAcceptingFocusExclusion exclusions: KWin.ClientModel.NotAcceptingFocusExclusion
} }
onMovingChanged: {
if (contentY < -view.height/2) {
hideAnim.running = true
} else if (contentY >= -view.height/2 && contentY < 0) {
showAnim.running = true
}
}
header: Item {
width: view.width
height: view.height
}
delegate: MouseArea { delegate: MouseArea {
width: view.cellWidth width: view.cellWidth
height: view.cellHeight height: view.cellHeight