summaryrefslogtreecommitdiffstats
path: root/demos/declarative/samegame/content/FastBlock.qml
blob: 04eb59b644e73280dad05f21c75736510849683d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Rect { id:block
    //Note: These properties are the interface used to control the blocks
    property bool dying: false
    property bool spawning: false
    property int type: 0
    property int targetY: 0
    property int targetX: 0

    color: {if(type==0){"red";}else if(type==1){"blue";}else{"green";}}
    pen.width: 1
    pen.color: "black"
    opacity: 0
    y: targetY
    x: targetX
    y: Behavior { NumberAnimation { properties:"y"; duration: 200 } }
    opacity: Behavior { NumberAnimation { properties:"opacity"; duration: 200 } }

    states: [

        State{ name: "SpawnState"; when: spawning == true && dying == false
            SetProperties { target: block; opacity: 1 }
        },
        State{ name: "DeathState"; when: dying == true
            SetProperties { target: block; opacity: 0 }
        }
    ]
}