sequential animation on property change
-
I am attempting to run a
Sequential Animationwhenever theoptionsListEnabledproperty changes:property int maxHeight: 100 property bool optionsListEnabled: modelData.enabled onOptionsListEnabledChanged: heightChange.start() SequentialAnimation { id: heightChange NumberAnimation { from: statusIconButton.implicitHeight to: statusIconButton.maxHeight easing.type: Easing.OutExpo duration: 300 } NumberAnimation { from: statusIconButton.maxHeight to: statusIconButton.implicitHeight easing.type: Easing.OutBounce duration: 300 } }however, I can't figure out how to make
statusIconButton.impliciteHeightbe the target. In other words I am trying to toggle theimplicitHeightof the button to change whenever the property changes. I tried this:SequentialAnimation on implicitHeightbut that causes it to change both when the property changes, and on startup of the application when
implicitHeightis being set which is not what I am looking for. Any suggestions? -
Add
target: yourItem property: "implicitHeight"in your NumberAnimations.
Note that instead of
onOptionsListEnabledChanged: heightChange.start() SequentialAnimation { id: heightChange //... }You can do
Behavior on optionsListEnabled { SequentialAnimation { //... } }