Dekko
Loading...
Searching...
No Matches
DekkoAnimation.qml
1/* Copyright (C) 2016 - 2017 Dan Chapman <dpniel@ubuntu.com>
2
3 This file is part of Dekko email client for Ubuntu devices
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of
8 the License or (at your option) version 3
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18pragma Singleton
19import QtQuick 2.4
20import Dekko.Controls 1.0
21
22QtObject {
23
24 property Transition listViewAddTransition: Transition {
25 NumberAnimation { property: "opacity"; from: 0; to: 1.0; duration: 250 }
26 NumberAnimation { property: "scale"; easing.type: Easing.InOutSine; from: 0.75; to: 1.0; duration: 250 }
27 }
28
29 property Transition listViewAddDisplacedTransition: Transition {
30 NumberAnimation { properties: "y"; duration: 400; easing.type: Easing.InBack }
31 }
32
33 property Transition listViewRemoveTransition: Transition {
34 NumberAnimation { property: "opacity"; from: 1.0; to: 0; duration: 100 }
35 }
36
37 property Transition listViewRemoveDisplacedTransition: Transition {
38 SequentialAnimation {
39 PauseAnimation { duration: 300 }
40 NumberAnimation { properties: "x,y"; duration: 400; easing.type: Easing.OutBack }
41 }
42 }
43 // This animation fades and slides in from the bottom for a push and slides out to the right for pop
44 property StackViewDelegate customStackViewDelegate1: StackViewDelegate {
45 function transitionFinished(properties)
46 {
47 properties.exitItem.opacity = 1
48 }
49
50 pushTransition: StackViewTransition {
51 PropertyAnimation {
52 target: enterItem
53 property: "y"
54 from: target.height / 2
55 to: 0
56 duration: 400
57 easing.type: Easing.OutCubic
58 }
59 PropertyAnimation {
60 target: enterItem
61 property: "opacity"
62 from: 0
63 to: 1
64 duration: 400
65 }
66 PropertyAnimation {
67 target: exitItem
68 property: "opacity"
69 from: 1
70 to: 0
71 }
72 }
73 popTransition: StackViewTransition {
74 PropertyAnimation {
75 target: enterItem
76 property: "x"
77 from: -target.width
78 to: 0
79 duration: 400
80 easing.type: Easing.OutCubic
81 }
82 PropertyAnimation {
83 target: exitItem
84 property: "x"
85 from: 0
86 to: target.width
87 duration: 400
88 easing.type: Easing.OutCubic
89 }
90 }
91 replaceTransition: pushTransition
92 }
93
94 // Just does a simple fade in/out animation
95 property StackViewDelegate customStackViewDelegate2: StackViewDelegate {
96 function transitionFinished(properties)
97 {
98 properties.exitItem.opacity = 1
99 }
100
101 pushTransition: StackViewTransition {
102 PropertyAnimation {
103 target: enterItem
104 property: "opacity"
105 from: 0
106 to: 1
107 duration: 400
108 }
109 PropertyAnimation {
110 target: exitItem
111 property: "opacity"
112 from: 1
113 to: 0
114 }
115 }
116 popTransition: StackViewTransition {
117 PropertyAnimation {
118 target: enterItem
119 property: "opacity"
120 from: 0
121 to: 1
122 duration: 400
123 }
124 PropertyAnimation {
125 target: exitItem
126 property: "opacity"
127 from: 1
128 to: 0
129 }
130 }
131 replaceTransition: pushTransition
132 }
133
134
135}
136