From f88535146449d5763ac3c779fe2b4067d101c2d9 Mon Sep 17 00:00:00 2001 From: darksignal7 Date: Sun, 5 Oct 2025 21:33:19 +0300 Subject: [PATCH] remove animatedSides, use frameAnimation --- .../modules/common/widgets/MaterialCookie.qml | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/.config/quickshell/ii/modules/common/widgets/MaterialCookie.qml b/.config/quickshell/ii/modules/common/widgets/MaterialCookie.qml index 268694862..c59e53613 100644 --- a/.config/quickshell/ii/modules/common/widgets/MaterialCookie.qml +++ b/.config/quickshell/ii/modules/common/widgets/MaterialCookie.qml @@ -7,8 +7,7 @@ import qs.modules.common Item { id: root - property int sides: 12 - property real animatedSides: 12 + property int sides: 12 property int implicitSize: 100 property real amplitude: implicitSize / 50 property int renderPoints: 360 @@ -19,25 +18,19 @@ Item { implicitWidth: implicitSize implicitHeight: implicitSize - property real waveTime: 0 + property real shapeRotation: 0 + + Loader{ active: constantlyRotate - sourceComponent: Timer{ - interval: 16 // Does it effect performance, probably, is it noticeable, not really - running: true; repeat: true + sourceComponent: FrameAnimation{ + running: true onTriggered: { - root.waveTime += 0.05 + shapeRotation += 0.05 } } } - onSidesChanged: NumberAnimation { - target: root - property: "animatedSides" - to: root.sides - duration: 100 - easing.type: Easing.InOutQuad - } Shape { id: shape @@ -59,7 +52,7 @@ Item { var radius = root.implicitSize / 2 - root.amplitude for (var i = 0; i <= steps; i++) { var angle = (i / steps) * 2 * Math.PI - var wave = constantlyRotate ? Math.sin(angle * root.animatedSides + Math.PI/2 - root.waveTime) * root.amplitude : Math.sin(angle * root.animatedSides + Math.PI/2) * root.amplitude + var wave = constantlyRotate ? Math.sin(angle * root.sides + Math.PI/2 - root.shapeRotation) * root.amplitude : Math.sin(angle * root.shapeRotation + Math.PI/2) * root.amplitude var x = Math.cos(angle) * (radius + wave) + cx var y = Math.sin(angle) * (radius + wave) + cy points.push(Qt.point(x, y))