Blob bounciness #67

Merged
zach merged 9 commits from bounce-test into main 2026-04-22 00:01:47 +02:00
8 changed files with 28 additions and 32 deletions
Showing only changes of commit 007cb32690 - Show all commits
+13 -3
View File
@@ -219,10 +219,20 @@ Variants {
PanelBg {
id: popoutBg
deformAmount: 0.15 * Config.appearance.deform.scale
implicitWidth: panels.popouts.width
// Extra height to prevent vertical movement deformation partially detaching panel from bar
property real extraHeight: panels.popouts.isDetached ? 0 : 0.2
deformAmount: panels.popouts.isDetached ? 0.05 * Config.appearance.deform.scale : panels.popouts.hasCurrent ? 0.15 * Config.appearance.deform.scale : 0.1 * Config.appearance.deform.scale
implicitHeight: panels.popouts.height * (1 + extraHeight)
implicitWidth: panels.popoutsWrapper.width
panel: panels.popoutsWrapper
radius: (panels.popouts.currentName.startsWith("audio") || panels.popouts.currentName.startsWith("updates")) ? Appearance.rounding.normal : Appearance.rounding.smallest
y: panels.popoutsWrapper.y + panels.popouts.y + bar.implicitHeight - panels.popouts.height * extraHeight
Behavior on extraHeight {
Anim {
}
}
}
PanelBg {
@@ -342,7 +352,7 @@ Variants {
required property Item panel
deformScale: deformAmount / 10000
group: panel.width > 0 && panel.height > 0 ? blobGroup : null
group: blobGroup
implicitHeight: panel.height
implicitWidth: panel.width
radius: Appearance.rounding.smallest
+5 -1
View File
@@ -17,12 +17,16 @@ Item {
implicitWidth: content.implicitWidth
visible: width > 0 && height > 0
x: {
const off = content.currentCenter - content.nonAnimWidth / 2;
if (content.isDetached)
return (parent.width - content.nonAnimWidth) / 2;
const off = content.currentCenter - Config.barConfig.border - content.nonAnimWidth / 2;
const diff = parent.width - Math.floor(off + content.nonAnimWidth);
if (diff < 0)
return off + diff;
return Math.floor(Math.max(off, 0));
}
y: content.isDetached ? (parent.height - content.nonAnimHeight) / 2 : 0
Behavior on offsetScale {
Anim {
+1 -1
View File
@@ -25,7 +25,7 @@ CustomClippingRect {
anchors.centerIn: parent
height: 200
visible: script.values.length === 0
width: 300
width: 600
MaterialIcon {
id: noUpdatesIcon
+1 -2
View File
@@ -15,6 +15,7 @@ Item {
property real currentCenter
property alias currentName: popoutState.currentName
property string detachedMode
readonly property bool isDetached: detachedMode.length > 0
property alias hasCurrent: popoutState.hasCurrent
readonly property real nonAnimHeight: children.find(c => c.shouldBeActive)?.implicitHeight ?? content.implicitHeight
readonly property real nonAnimWidth: children.find(c => c.shouldBeActive)?.implicitWidth ?? content.implicitWidth
@@ -50,8 +51,6 @@ Item {
implicitWidth: nonAnimWidth
Behavior on implicitHeight {
enabled: root.offsetScale < 1
Anim {
duration: root.animLength
easing.bezierCurve: root.animCurve
+2 -2
View File
@@ -14,8 +14,6 @@ BlobRect::~BlobRect() {
}
void BlobRect::updatePolish() {
BlobShape::updatePolish();
if (m_physicsActive) {
// Check if deformation is visually imperceptible
float totalDelta = std::abs(m_dm00 - 1.0f) + std::abs(m_dm01) + std::abs(m_dm11 - 1.0f);
@@ -41,6 +39,8 @@ void BlobRect::updatePolish() {
Qt::QueuedConnection);
}
}
BlobShape::updatePolish();
}
void BlobRect::updatePhysics() {
+1 -14
View File
@@ -68,22 +68,9 @@ void BlobShape::componentComplete() {
void BlobShape::geometryChange(const QRectF& newGeometry, const QRectF& oldGeometry) {
QQuickItem::geometryChange(newGeometry, oldGeometry);
updateCenteredDeformMatrix();
if (m_group) {
// Accumulate sub-pixel drift so slow movements don't desync the shader
m_pendingDx += static_cast<float>(newGeometry.x() - oldGeometry.x());
m_pendingDy += static_cast<float>(newGeometry.y() - oldGeometry.y());
m_pendingDw += static_cast<float>(newGeometry.width() - oldGeometry.width());
m_pendingDh += static_cast<float>(newGeometry.height() - oldGeometry.height());
if (std::abs(m_pendingDx) > 0.5f || std::abs(m_pendingDy) > 0.5f ||
std::abs(m_pendingDw) > 0.5f || std::abs(m_pendingDh) > 0.5f) {
m_pendingDx = 0;
m_pendingDy = 0;
m_pendingDw = 0;
m_pendingDh = 0;
if (m_group && newGeometry != oldGeometry) {
m_group->markShapeDirty(this);
}
}
}
void BlobShape::updateCenteredDeformMatrix() {
+3 -7
View File
@@ -82,13 +82,9 @@ float m_cachedPaddedW = 0;
float m_cachedPaddedH = 0;
QRectF m_localPaddedRect;
QVector<BlobRectData> m_cachedRects;
int m_cachedMyIndex = -2;
float m_pendingDx = 0;
float m_pendingDy = 0;
float m_pendingDw = 0;
float m_pendingDh = 0;
bool m_cachedHasInverted = false;
float m_cachedInvertedRadius = 0;
int m_cachedMyIndex = -2;
bool m_cachedHasInverted = false;
float m_cachedInvertedRadius = 0;
float m_cachedInvertedOuter[4] = {};
float m_cachedInvertedInner[4] = {};
};
+1 -1
View File
@@ -1,6 +1,6 @@
//@ pragma UseQApplication
//@ pragma Env QSG_RENDER_LOOP=threaded
//@ pragma Env QSG_RHI_BACKEND=vulkan
// @ pragma Env QSG_RHI_BACKEND=vulkan
//@ pragma Env QSG_USE_SIMPLE_ANIMATION_DRIVER=0
//@ pragma Env QS_NO_RELOAD_POPUP=1
//@ pragma Env QT_SCALE_FACTOR_ROUNDING_POLICY=Round