From adc076322bc31e6191f82b1333d8b197f04ec2e9 Mon Sep 17 00:00:00 2001 From: Yifan Zhu Date: Fri, 19 Jan 2024 09:32:40 -0800 Subject: [PATCH] plugins/fallapart: use InCubic easing This visual effect corresponds to visible to invisible. So use InCubic easing for opacity and speed. --- src/plugins/fallapart/fallapart.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/fallapart/fallapart.cpp b/src/plugins/fallapart/fallapart.cpp index 4ebae911aa..4f79bbfc83 100644 --- a/src/plugins/fallapart/fallapart.cpp +++ b/src/plugins/fallapart/fallapart.cpp @@ -12,6 +12,8 @@ // KConfigSkeleton #include "fallapartconfig.h" +#include + #include Q_LOGGING_CATEGORY(KWIN_FALLAPART, "kwin_effect_fallapart", QtWarningMsg) @@ -72,7 +74,8 @@ void FallApartEffect::apply(EffectWindow *w, int mask, WindowPaintData &data, Wi { auto animationIt = windows.constFind(w); if (animationIt != windows.constEnd() && isRealWindow(w)) { - const qreal t = animationIt->progress; + QEasingCurve easing(QEasingCurve::InCubic); + const qreal t = easing.valueForProgress(animationIt->progress); // Request the window to be divided into cells quads = quads.makeGrid(blockSize); int cnt = 0; @@ -94,7 +97,7 @@ void FallApartEffect::apply(EffectWindow *w, int mask, WindowPaintData &data, Wi if (p1.y() > w->height() / 2) { ydiff = (p1.y() - w->height() / 2) / w->height() * 100; } - double modif = t * t * 64; + double modif = t * 64; srandom(cnt); // change direction randomly but consistently xdiff += (rand() % 21 - 10); ydiff += (rand() % 21 - 10);