~ubuntu-branches/debian/jessie/2048-qt/jessie

« back to all changes in this revision

Viewing changes to qml/Tile.qml

  • Committer: Package Import Robot
  • Author(s): Alejandro Garrido Mota
  • Date: 2014-05-10 07:42:23 UTC
  • Revision ID: package-import@ubuntu.com-20140510074223-dh308niyg7ey1z07
Tags: upstream-0.1.4
ImportĀ upstreamĀ versionĀ 0.1.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import QtQuick 2.2
 
2
 
 
3
Rectangle {
 
4
    id: tileContainer
 
5
    width: 425/4
 
6
    height: 425/4
 
7
    radius: 3
 
8
    color: "white"
 
9
    property string tileText: ""
 
10
    property int tileFontSize: 55
 
11
    property color tileColor: "black"
 
12
    property int moveAnimTime: 100
 
13
    property int newTileAnimTime: 200
 
14
    property bool runNewTileAnim: false
 
15
    property bool destroyFlag: false
 
16
 
 
17
    FontLoader { id: localFont; source: "qrc:///fonts/DroidSansFallback.ttf" }
 
18
 
 
19
    Text {
 
20
        id: tileLabel
 
21
        text: tileText
 
22
        color: tileColor
 
23
        font.family: localFont.name
 
24
        font.pixelSize: tileFontSize
 
25
        font.bold: true
 
26
        anchors.centerIn: parent
 
27
        Behavior on text {
 
28
            PropertyAnimation { target: tileContainer
 
29
                property: "opacity"
 
30
                from: 0.5
 
31
                to: 1
 
32
                duration: moveAnimTime
 
33
            }
 
34
        }
 
35
    }
 
36
 
 
37
    ParallelAnimation {
 
38
        running: runNewTileAnim
 
39
        NumberAnimation {
 
40
            target: tileContainer
 
41
            property: "opacity"
 
42
            from: 0.0
 
43
            to: 1.0
 
44
            duration: newTileAnimTime
 
45
        }
 
46
 
 
47
        ScaleAnimator {
 
48
            target: tileContainer
 
49
            from: 0
 
50
            to: 1
 
51
            duration: newTileAnimTime
 
52
            easing.type: Easing.OutQuad
 
53
        }
 
54
    }
 
55
 
 
56
    Behavior on color {
 
57
        ColorAnimation {
 
58
            duration: moveAnimTime
 
59
        }
 
60
    }
 
61
 
 
62
    Behavior on y {
 
63
        NumberAnimation {
 
64
            duration: moveAnimTime
 
65
            onRunningChanged: {
 
66
                if ((!running) && destroyFlag) {
 
67
                    tileContainer.destroy();
 
68
                }
 
69
            }
 
70
        }
 
71
    }
 
72
 
 
73
    Behavior on x {
 
74
        NumberAnimation {
 
75
            duration: moveAnimTime
 
76
            onRunningChanged: {
 
77
                if ((!running) && destroyFlag) {
 
78
                    tileContainer.destroy();
 
79
                }
 
80
            }
 
81
        }
 
82
    }
 
83
}