Commit b22bbe26 authored by Exc404's avatar Exc404

Анимация движения карточки игры

parent 38ca2d7c
......@@ -25,31 +25,42 @@ Rectangle {
function startAnimation(){
// gameRect.anchors.leftMargin= 8
// gameRect.anchors.topMargin= 70
// gameRect.anchors.left= gameRect.parent.left
// gameRect.anchors.top= gameRect.parent.top
startPos.x = startX
startPos.y = startY
gameRect.anchors.left = startPos.left
gameRect.anchors.top = startPos.top
container.state = "completed"
}
states:[
State {
name: "finish"
AnchorChanges {
target: gameRect;
anchors.left: startPos.left
anchors.top: startPos.top
}
states: State {
},
State {
name: "completed"
AnchorChanges {
target: gameRect;
//anchors.leftMargin: 8
//anchors.topMargin: 70
anchors.left: gameRect.parent.left
anchors.top: gameRect.parent.top
anchors.left: finishPos.left
anchors.top: finishPos.top
}
}
]
transitions: Transition {
// smoothly reanchor myRect and move into new position
AnchorAnimation { duration: 1000 }
AnchorAnimation { duration: 300 }
}
Component.onCompleted: container.state = "completed"
onVisibleChanged: function(){
......@@ -67,13 +78,24 @@ Rectangle {
//
// Start pos
Item {
id: startPos
x: startX
y: startY
}
// finish pos
Item {
id: finishPos
anchors.left: gameRect.parent.left
anchors.top: gameRect.parent.top
anchors.leftMargin: 8
anchors.topMargin: 70
}
Rectangle {
id: rectangle
......@@ -96,6 +118,11 @@ Rectangle {
imageUrl: "../images/back.svg"
onClicked: function(){
window.scene = S.homeScene;
//gameRect.anchors.leftMargin= 0
//gameRect.anchors.topMargin= 0
container.state = "finish"
}
}
......@@ -195,8 +222,6 @@ Rectangle {
anchors.left: startPos.left
anchors.top: startPos.top
Image {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment