Animation on event [solved]
-
wrote on 12 May 2011, 22:15 last edited by
I want to fire off a ColorAnimation upon an event (onTextChanged) but couldn't find an example of how to accomplish this.
Can you hint me into the right direction?
-
wrote on 13 May 2011, 04:08 last edited by
"Here":http://doc.qt.nokia.com/latest/qml-behavior.html
I think that's what you need, play around with Behavior on text property.
-
wrote on 13 May 2011, 06:35 last edited by
This doesn't seem to help me much since I want to change the color-property of a TextEdit once the text-property changes. Behaviours can only be assigned to the same property.
The following example doesn't work b/c of the on color in ColorAnimation
@ Behavior on text {
ColorAnimation on color { from: "yellow"; duration: 1000 }
}@EDIT: With state-changes it works at least once. I want the text turn every time it changes from red to black.
Changing the state to something else upon completion of the animation (onCompleted) doesn't seem to work at all.So what am I supposed to do?
@ TextEdit {
id: txtCurrentTrack
text: "trololol"
onTextChanged: txtCurrentTrack.state = 'changed'states: [ State { name: "changed" PropertyChanges { target: txtCurrentTrack; color: "black" } }, State { name: "finished" PropertyChanges { target: txtCurrentTrack; color: "grey" } } ] transitions: Transition { ColorAnimation { from: "red"; to: "black"; duration: 1000; onCompleted: txtCurrentTrack.state = "finished" } } }@
-
wrote on 13 May 2011, 13:02 last edited by
Hello, try this:
@TextEdit {
id: text_edit1
x: 117
y: 62
width: 80
height: 20
text: "textEdit"onTextChanged: { colAnim.start(); } PropertyAnimation { id: colAnim target: text_edit1 property: "color" from: "red" to: "blue"; duration: 1000 running: false } }@
-
wrote on 13 May 2011, 17:28 last edited by
awesome, it works like a charm.
1/5