aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick
diff options
context:
space:
mode:
authorKaj Grönholm <kaj.gronholm@qt.io>2023-08-18 10:37:46 +0300
committerKaj Grönholm <kaj.gronholm@qt.io>2023-09-15 13:04:19 +0300
commit75a33aceab62d12cf9bc9567676c118af631fd32 (patch)
tree152fdf1d270a15a293618a93fa23baeb3434a880 /examples/quick
parent542687a2088276748e13ea38e188b17489823716 (diff)
Small improvements into Graph example
Use FrameAnimation instead of Timer and double the amount of samples to make the example smoother. Pick-to: 6.6 Change-Id: I6f5bb1414fd7532e16aeb25f886879828ce29854 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'examples/quick')
-rw-r--r--examples/quick/scenegraph/graph/main.qml12
1 files changed, 4 insertions, 8 deletions
diff --git a/examples/quick/scenegraph/graph/main.qml b/examples/quick/scenegraph/graph/main.qml
index e9b684c3ba..5f2abbbd58 100644
--- a/examples/quick/scenegraph/graph/main.qml
+++ b/examples/quick/scenegraph/graph/main.qml
@@ -15,27 +15,23 @@ Item {
anchors.margins: 100
function newSample(i) {
- return (Math.sin(i / 100.0 * Math.PI * 2) + 1) * 0.4 + Math.random() * 0.05;
+ return (Math.sin(i / 200.0 * Math.PI * 2) + 1) * 0.4 + Math.random() * 0.05;
}
Component.onCompleted: {
- for (var i=0; i<100; ++i)
+ for (var i=0; i<graph.offset; ++i)
appendSample(newSample(i));
}
- property int offset: 100;
+ property int offset: 200
}
- Timer {
- id: timer
- interval: 500
- repeat: true
+ FrameAnimation {
running: true
onTriggered: {
graph.removeFirstSample();
graph.appendSample(graph.newSample(++graph.offset));
}
-
}
Rectangle {