forked from Shinonome/dots-hyprland
remove animatedSides, use frameAnimation
This commit is contained in:
@@ -8,7 +8,6 @@ Item {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
property int sides: 12
|
property int sides: 12
|
||||||
property real animatedSides: 12
|
|
||||||
property int implicitSize: 100
|
property int implicitSize: 100
|
||||||
property real amplitude: implicitSize / 50
|
property real amplitude: implicitSize / 50
|
||||||
property int renderPoints: 360
|
property int renderPoints: 360
|
||||||
@@ -19,25 +18,19 @@ Item {
|
|||||||
implicitWidth: implicitSize
|
implicitWidth: implicitSize
|
||||||
implicitHeight: implicitSize
|
implicitHeight: implicitSize
|
||||||
|
|
||||||
property real waveTime: 0
|
property real shapeRotation: 0
|
||||||
|
|
||||||
|
|
||||||
Loader{
|
Loader{
|
||||||
active: constantlyRotate
|
active: constantlyRotate
|
||||||
sourceComponent: Timer{
|
sourceComponent: FrameAnimation{
|
||||||
interval: 16 // Does it effect performance, probably, is it noticeable, not really
|
running: true
|
||||||
running: true; repeat: true
|
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
root.waveTime += 0.05
|
shapeRotation += 0.05
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onSidesChanged: NumberAnimation {
|
|
||||||
target: root
|
|
||||||
property: "animatedSides"
|
|
||||||
to: root.sides
|
|
||||||
duration: 100
|
|
||||||
easing.type: Easing.InOutQuad
|
|
||||||
}
|
|
||||||
|
|
||||||
Shape {
|
Shape {
|
||||||
id: shape
|
id: shape
|
||||||
@@ -59,7 +52,7 @@ Item {
|
|||||||
var radius = root.implicitSize / 2 - root.amplitude
|
var radius = root.implicitSize / 2 - root.amplitude
|
||||||
for (var i = 0; i <= steps; i++) {
|
for (var i = 0; i <= steps; i++) {
|
||||||
var angle = (i / steps) * 2 * Math.PI
|
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 x = Math.cos(angle) * (radius + wave) + cx
|
||||||
var y = Math.sin(angle) * (radius + wave) + cy
|
var y = Math.sin(angle) * (radius + wave) + cy
|
||||||
points.push(Qt.point(x, y))
|
points.push(Qt.point(x, y))
|
||||||
|
|||||||
Reference in New Issue
Block a user