feat: gradient ripple
This commit is contained in:
parent
5f34907bfa
commit
d6d53ed7bc
1 changed files with 6 additions and 5 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Shapes
|
import QtQuick.Shapes
|
||||||
|
import Caelestia
|
||||||
import Caelestia.Config
|
import Caelestia.Config
|
||||||
import qs.services
|
import qs.services
|
||||||
|
|
||||||
|
|
@ -11,7 +12,7 @@ MouseArea {
|
||||||
readonly property alias rect: base
|
readonly property alias rect: base
|
||||||
|
|
||||||
property bool shapeMorph
|
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 pressX: width / 2
|
||||||
property real pressY: height / 2
|
property real pressY: height / 2
|
||||||
|
|
@ -29,7 +30,7 @@ MouseArea {
|
||||||
const d2 = distSq(width, 0);
|
const d2 = distSq(width, 0);
|
||||||
const d3 = distSq(0, height);
|
const d3 = distSq(0, height);
|
||||||
const d4 = distSq(width, 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
|
property real endRadiusAtPress
|
||||||
|
|
||||||
|
|
@ -75,7 +76,7 @@ MouseArea {
|
||||||
target: root
|
target: root
|
||||||
property: "circleRadius"
|
property: "circleRadius"
|
||||||
to: root.endRadius
|
to: root.endRadius
|
||||||
easing: Tokens.anim.expressiveSlowEffects
|
easing: Tokens.anim.standard
|
||||||
duration: Tokens.anim.durations.expressiveSlowEffects * 2
|
duration: Tokens.anim.durations.expressiveSlowEffects * 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -121,12 +122,12 @@ MouseArea {
|
||||||
color: Qt.alpha(base.color, 1)
|
color: Qt.alpha(base.color, 1)
|
||||||
}
|
}
|
||||||
GradientStop {
|
GradientStop {
|
||||||
position: 0.99
|
position: CUtils.clamp(1 - 0.2 * root.endRadius / root.circleRadius, 0.01, 0.99)
|
||||||
color: Qt.alpha(base.color, 1)
|
color: Qt.alpha(base.color, 1)
|
||||||
}
|
}
|
||||||
GradientStop {
|
GradientStop {
|
||||||
position: 1
|
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))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue