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. Is there an animator with constant speed, without the beginning/end slowing curve.? Long Story short, in the description.
QtWS25 Last Chance

Is there an animator with constant speed, without the beginning/end slowing curve.? Long Story short, in the description.

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
qmlqtquick
4 Posts 2 Posters 1.1k 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.
  • F Offline
    F Offline
    Flavian
    wrote on last edited by A Former User
    #1

    I'm trying to make a 2 custom scrolling buttons(up and down). When normally pressed, it should scroll page by page, with a slight animation. And when long press, it should continuously scroll, page by page, but without stops between pages(basically is an element by element scroll but with the mention that after releasing the button, it should always stop in a page like fashion.

    I used a listview, with with a number animation with easing.type: Easing.OutCubic, on "contentY" property of listview to achieve the first case( page by page on short click). But this is not reliable on continuous scrolling.

    The problem is that the speed and appearance should be the same in both cases, so:
    I was thinking more of a timer with small interval, that would enter a function every time it goes in onTriggered. That function would increase the contentY from listview, in small amounts. (with additional checking if is the end/beginning of the list, etc). But how will I match the speed of them, in means that the duration of the Number Animation is not static, is dependent on pageheight (different usability ).

    Is there another way of achieving this? Am I overcomplicating this?

    ? 1 Reply Last reply
    0
    • F Flavian

      I'm trying to make a 2 custom scrolling buttons(up and down). When normally pressed, it should scroll page by page, with a slight animation. And when long press, it should continuously scroll, page by page, but without stops between pages(basically is an element by element scroll but with the mention that after releasing the button, it should always stop in a page like fashion.

      I used a listview, with with a number animation with easing.type: Easing.OutCubic, on "contentY" property of listview to achieve the first case( page by page on short click). But this is not reliable on continuous scrolling.

      The problem is that the speed and appearance should be the same in both cases, so:
      I was thinking more of a timer with small interval, that would enter a function every time it goes in onTriggered. That function would increase the contentY from listview, in small amounts. (with additional checking if is the end/beginning of the list, etc). But how will I match the speed of them, in means that the duration of the Number Animation is not static, is dependent on pageheight (different usability ).

      Is there another way of achieving this? Am I overcomplicating this?

      ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Hi!

      @Flavian said:

      in means that the duration of the Number Animation is not static

      Simply define your desired velocity (in pixels per millisecond) and distance in pixels (e.g. pageHeight) and then do this:

      NumberAnimation on someValue {
        property real velocity: 0.5
        property real distance: someItem.pageHeight
        duration: distance / velocity
        // ...
      }
      
      1 Reply Last reply
      0
      • F Offline
        F Offline
        Flavian
        wrote on last edited by
        #3

        yes, this is really what I have done.

        1 Reply Last reply
        0
        • F Offline
          F Offline
          Flavian
          wrote on last edited by
          #4

          the question was, how could I match the functionality of a number animation(that has dynamic duration/ and Easing.OutCubic) , with the functionality of an additive step timer ?

          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