Reputation: 32393
My problem is that I can't animate integer.
I am showing some result as integer number in Text element, like this:
Text
{
text: someResult
}
And I have defined behavior:
Behavior on text
{
NumberAnimation{ duration: 1000; easing.type: Easing.InOutQuad}
}
Problem is that animated text gets real numbers, and I want integers to be.
Example: previous value is 0, and I set new value as 2, this is how animation looks like:
0
0.01
0.05
0.1
0.156
0.36
...
1.81
1.95
2
But what I want to be is:
0
1
2
Upvotes: 2
Views: 1015
Reputation: 3851
You can achieve this by explicitly animating an integer property:
Text {
property int value: 0
text: value
Behavior on value {
NumberAnimation { duration: 1000; easing.type: Easing.InOutQuad }
}
}
Upvotes: 3