animation behavior different when using constant property value vs direct value for duration



  • Hello,
    I have an animation with a given duration (600) and a 2 parallel animations (which are sequential to each other) of duration 300 each, such that the main and last parallel animation end at the same time:

    MyItem {
        id: container
        ....
        transitions: Transition {
            ParallelAnimation {
                NumberAnimation { target: rotation; properties: "angle"; duration: 600}
    
                SequentialAnimation {
                    NumberAnimation { target: container; property: "scale"; to: 0.75; duration:  300 }
                    NumberAnimation { target: container; property: "scale"; to: 1.0; duration:  300 }
                }
            }
        }
    }
    

    This works fine, but if I replace the duration by the following computed values based on a readonly property I define, the animation still works, but is different (the animations don't behave as desired: they don't end at the same time)

    MyItem {
        id: container
        ....
       readonly property int animationSpeed: 600
       ....
        transitions: Transition {
            ParallelAnimation {
                NumberAnimation { target: rotation; properties: "angle"; duration: AnimationSpeed }
    
                SequentialAnimation {
                    NumberAnimation { target: container; property: "scale"; to: 0.75; duration: animationSpeed/2 }
                    NumberAnimation { target: container; property: "scale"; to: 1.0; duration: animationSpeed/2 }
                }
            }
        }
    }
    

    Why is the behavior different when I use a property value instead of a direct value for duration?

    Thanks!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.