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