I have a login QML page. When the user inputs the code, I have 4 circles in white, and I would like to transition to blue, filling the circle from bottom to top.
So basically, I want to animate the color property so it transitions from white to blue when "isNumberInserted" is true, and just move it back to white without any transition when the user clears PIN (isNumberInserted = false).
Rectangle{
anchors.centerIn: parent;
width: 100; height: width; radius: width/2
color: isNumberInserted ? "blue" : "white"
}
Any ideas? Thanks!
Update:: SOLUTION: Based on the reply (thanks!), it goes like this:
Rectangle{
id: rect
anchors.centerIn: parent;
width: 100; height: width; radius: width/2
property double fillPosition: !isNumberInserted
Behavior on fillPosition {
enabled: !isNumberInserted
NumberAnimation { duration: 500 }
}
gradient: Gradient {
GradientStop { position: 0.0; color: "white" }
GradientStop { position: rect.fillPosition - 0.001; color: "white" }
GradientStop { position: rect.fillPosition + 0.001; color: "blue" }
GradientStop { position: 1.0; color: "blue" }
}
}