There is no way to do animations in the UI at the moment. That has to be done
in the edit mode for now. You need a MouseArea to do things based on clicking
the screen. See below.
Br, Nigel
import Qt 4.6
Rectangle {
id: rectangle1
width: 200
height: 200
MouseArea {
id: clickArea
anchors.fill: parent
onClicked: {
switch (rectangle1.state) {
case "":
rectangle1.state = "State1";
break;
case "State1":
rectangle1.state = "State2";
break;
case "State2":
rectangle1.state = "State3";
break;
case "State3":
rectangle1.state = "";
break;
}
}
}
Text {
id: text1
x: 37
y: 78
text: "Hello World"
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
font.pointSize: 25
font.family: "NiteClub"
color: "red"
}
states: [
State {
name: "State1"
PropertyChanges {
target: text1
x: 68
y: 6
anchors.verticalCenterOffset: -77
anchors.horizontalCenterOffset: 31
opacity: 0.33
}
},
State {
name: "State2"
PropertyChanges {
target: text1
x: 68
y: 161
anchors.horizontalCenterOffset: 31
anchors.verticalCenterOffset: 78
opacity: 1
}
},
State {
name: "State3"
PropertyChanges {
target: text1
x: 37
y: 84
color: "#0011ff"
anchors.horizontalCenterOffset: 0
anchors.verticalCenterOffset: 0
opacity: 1
}
}
]
transitions:
[
Transition {
from: "*"
to: "State1"
reversible: true
ParallelAnimation {
NumberAnimation {
property: "opacity"
duration: 1000
target: text1
}
NumberAnimation {
duration: 1000
target: text1
properties: "x,y"
}
}
}
]
}
On Mar 11, 2010, at 6:00 PM, ext Jason H wrote:
I am trying to use the new QtCreator 2.0 to make animations.
The GUI is simple enough, I have created several states, but I cannot figure
out how to animate between them. This trivial example defines a couple states
which chance location, opacity and color. I would like to start from the
initial state, then progress from state1 to state2 ... etc, after state3,
return to the original.
I can't figure out how to kick off and chain the animations. Any help would
be... well, helpful. (And appreciated)
Also, is there a way to set this in the GUI, for now I am hand-editing the file.
import Qt 4.6
Rectangle {
id: rectangle1
width: 200
height: 200
Text {
id: text1
x: 37
y: 78
text: "Hello World"
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
font.pointSize: 25
font.family: "NiteClub"
color: "red"
}
states: [
State {
name: "State1"
PropertyChanges {
target: text1
x: 68
y: 6
anchors.verticalCenterOffset: -77
anchors.horizontalCenterOffset: 31
opacity: 0.33
}
},
State {
name: "State2"
PropertyChanges {
target: text1
x: 68
y: 161
anchors.horizontalCenterOffset: 31
anchors.verticalCenterOffset: 78
opacity: 1
}
},
State {
name: "State3"
PropertyChanges {
target: text1
x: 37
y: 84
color: "#0011ff"
anchors.horizontalCenterOffset: 0
anchors.verticalCenterOffset: 0
opacity: 1
}
}
]
transitions:
[
Transition {
from: "*"
to: "State1"
reversible: true
ParallelAnimation {
NumberAnimation {
property: "opacity"
duration: 1000
target: text1
}
NumberAnimation {
duration: 1000
target: text1
properties: "x,y"
}
}
}
]
}
_______________________________________________
Qt4-preview-feedback mailing list
[email protected]<mailto:[email protected]>
http://lists.trolltech.com/mailman/listinfo/qt4-preview-feedback
_______________________________________________
Qt4-preview-feedback mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt4-preview-feedback