feat: gradient ripple

This commit is contained in:
2 * r + 2 * t 2026-06-04 01:11:04 +10:00
parent 5f34907bfa
commit d6d53ed7bc

View file

@ -1,5 +1,6 @@
import QtQuick
import QtQuick.Shapes
import Caelestia
import Caelestia.Config
import qs.services
@ -11,7 +12,7 @@ MouseArea {
readonly property alias rect: base
property bool shapeMorph
property real stateOpacity: pressed ? 0.1 : containsMouse ? 0.08 : 0
property real stateOpacity: containsMouse ? 0.08 : 0
property real pressX: width / 2
property real pressY: height / 2
@ -29,7 +30,7 @@ MouseArea {
const d2 = distSq(width, 0);
const d3 = distSq(0, height);
const d4 = distSq(width, height);
return Math.sqrt(Math.max(d1, d2, d3, d4)) + (shapeMorph ? 24 : 0);
return (Math.sqrt(Math.max(d1, d2, d3, d4)) + (shapeMorph ? 24 : 0)) * 1.3;
}
property real endRadiusAtPress
@ -75,7 +76,7 @@ MouseArea {
target: root
property: "circleRadius"
to: root.endRadius
easing: Tokens.anim.expressiveSlowEffects
easing: Tokens.anim.standard
duration: Tokens.anim.durations.expressiveSlowEffects * 2
}
@ -121,12 +122,12 @@ MouseArea {
color: Qt.alpha(base.color, 1)
}
GradientStop {
position: 0.99
position: CUtils.clamp(1 - 0.2 * root.endRadius / root.circleRadius, 0.01, 0.99)
color: Qt.alpha(base.color, 1)
}
GradientStop {
position: 1
color: Qt.alpha(base.color, 0)
color: Qt.alpha(base.color, CUtils.clamp((root.circleRadius / root.endRadius - 0.9) / 0.1, 0, 1))
}
}