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. Slowing down the speed of the Transition
Forum Updated to NodeBB v4.3 + New Features

Slowing down the speed of the Transition

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 2 Posters 1.5k Views 1 Watching
  • 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.
  • H Offline
    H Offline
    houmingc
    wrote on last edited by
    #1

    Current animation (pslogo.png) transit from high to low opacity, and from left to right.
    I would like to slow down the speed of the transition.

    Also, i can't make pslogo.png to transit from current location upwards even after i change x to y both in states and transition.

    @
    Image {
    source: "close.png"
    anchors.right: parent.right
    anchors.top: parent.top
    anchors.margins: 10

    //onClicked: Qt.quit()
    

    MouseArea {
    anchors.fill: parent
    onClicked: myApp.state == "" ? myApp.state= "hideLogo": myApp.state= ""
    }
    }
    Image{
    id:myImage
    source:"pslogo.png"
    anchors.verticalCenter: parent.verticalCenter
    }

    states:[
    State{
            name:"hideLogo"
            PropertyChanges{
                target:myImage
                opacity:0
                x:100           //change to y: 0
              }
    }
    ]
    transitions: [
        Transition {
            NumberAnimation{ properties: "opacity,x"}     //change to y
                   }
    ]
    

    @

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      To slow down the transition, you can add a duration to your number animation:
      @
      NumberAnimation {
      properties: "opacity,x"
      duration: 3000
      }
      @

      (Z(:^

      1 Reply Last reply
      0
      • H Offline
        H Offline
        houmingc
        wrote on last edited by
        #3

        ; duration 3000 works.
        How to make "pslogo.png" move back to its original location?

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          Create a state definition for your default state and make sure you set the position well there.

          By default, your image is anchored, so when you change the state to "hideLogo", that anchor is broken.

          An alternative would be to define "hideLogo" transition as AnchorAnimation instead of NumberAnimation. You can also look up reversible property of Transition - "link":http://doc.qt.io/qt-5/qml-qtquick-transition.html#reversible-prop. And "this":http://doc.qt.io/qt-5/qml-qtquick-propertychanges.html#restoreEntryValues-prop.

          (Z(:^

          1 Reply Last reply
          0
          • sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #5

            Create a state definition for your default state and make sure you set the position well there.

            By default, your image is anchored, so when you change the state to hideLogo, that anchor is broken. An alternative would be to define hideLogo transition as AnchorAnimation instead of NumberAnimation.

            You can also look up reversible property of Transition - "link":http://doc.qt.io/qt-5/qml-qtquick-transition.html#reversible-prop. And restoreEntryValues in ProeprtyChanges - "link":http://doc.qt.io/qt-5/qml-qtquick-propertychanges.html#restoreEntryValues-prop.

            (Z(:^

            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