1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-08-02 03:28:28 -04:00

media: throttle frame rate of media-related animations

port 1.5

related #2869
This commit is contained in:
bbedward
2026-07-15 12:57:25 -04:00
parent bf408f8d00
commit cdaedad969
4 changed files with 53 additions and 37 deletions
+6 -10
View File
@@ -182,16 +182,12 @@ Item {
}
}
FrameAnimation {
running: blobEffect.visible
property real pending: 0
onTriggered: {
pending += frameTime;
if (pending < 0.03)
return;
root.stepBlob(Math.min(pending, 0.05));
pending = 0;
}
// Timer, not FrameAnimation — a running animation commits frames every vsync (#2863)
Timer {
running: blobEffect.visible && root.onScreen
interval: 33
repeat: true
onTriggered: root.stepBlob(0.033)
}
ShaderEffect {
+4
View File
@@ -147,6 +147,10 @@ Item {
trackColor: MediaAccentService.accentTrack
actualProgressColor: MediaAccentService.accentSubtle
isPlaying: activePlayer && activePlayer.playbackState === MprisPlaybackState.Playing
onFrameTicked: {
if (!root.isSeeking)
activePlayer.positionChanged();
}
MouseArea {
id: waveMouseArea
+7 -3
View File
@@ -50,11 +50,15 @@ Item {
fragmentShader: Qt.resolvedUrl("../Shaders/qsb/wave_progress.frag.qsb")
}
signal frameTicked
FrameAnimation {
running: root.visible && (root.isPlaying || root.currentAmp > 0)
running: root.visible && (root.isPlaying || root.currentAmp > 0) && (root.Window.window?.visible ?? false)
onTriggered: {
if (root.isPlaying)
root.phase += 0.03 * frameTime * 60;
if (!root.isPlaying)
return;
root.phase = (root.phase + 0.03 * frameTime * 60) % 6.28318530718;
root.frameTicked();
}
}
}