import QtQuick import "../theme" // Follows `target`, easing only visible jumps (at least `threshold`); smaller // changes snap. Easing every small sample change kept windows rendering at the // display's refresh rate. QtObject { id: root property real target property real threshold: 2 property int duration: Theme.duration * 2 property real value property bool animate: false onTargetChanged: { animate = Math.abs(target - value) >= threshold; value = target; } Component.onCompleted: value = target Behavior on value { enabled: root.animate NumberAnimation { duration: root.duration easing.type: Easing.OutCubic } } }