~paulliu/unity8/lp1378469_MessageMenu

« back to all changes in this revision

Viewing changes to Hud/ShowingAnimation.qml

  • Committer: Michał Sawicz
  • Date: 2013-06-05 22:03:08 UTC
  • Revision ID: michal.sawicz@canonical.com-20130605220308-yny8fv3futtr04fg
Inital unity8 commit.

Previous history can be found at https://code.launchpad.net/~unity-team/unity/phablet

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2013 Canonical, Ltd.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; version 3.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 */
 
16
 
 
17
import QtQuick 2.0
 
18
import Ubuntu.Components 0.1
 
19
import "../Components"
 
20
 
 
21
Item {
 
22
    id: root
 
23
    property real yOffsetAtAnimationStart: units.gu(2)
 
24
    property real progress: 0
 
25
    property int animationDuration: 200
 
26
    default property alias __itemsToAnimate: container.children
 
27
 
 
28
    property bool showing: progress > 0
 
29
 
 
30
    height: childrenRect.height
 
31
 
 
32
    Item {
 
33
        id: container
 
34
        anchors {
 
35
            left: parent.left
 
36
            right: parent.right
 
37
        }
 
38
        height: childrenRect.height
 
39
    }
 
40
 
 
41
    NumberAnimation {id: opacityAnimation; target: container; property: "opacity"; from: 0; to: 1; duration: animationDuration}
 
42
    NumberAnimation {id: yAnimation; target: container; property: "y"; from: yOffsetAtAnimationStart; to: 0; duration: animationDuration}
 
43
 
 
44
    // FIXME This would much more sense in a ParallelAnimation and just
 
45
    // one AnimationController but that goes something crazy and rendering never stops
 
46
    AnimationController {
 
47
        animation: opacityAnimation
 
48
        progress: root.progress
 
49
    }
 
50
    AnimationController {
 
51
        animation: yAnimation
 
52
        progress: root.progress
 
53
    }
 
54
}