Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. animation behavior different when using constant property value vs direct value for duration

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

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 304 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • DiracsbracketD Offline
    DiracsbracketD Offline
    Diracsbracket
    wrote on last edited by Diracsbracket
    #1

    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!

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved