This commit is contained in:
flickowoa
2025-02-27 20:57:50 +05:30
parent 2cd8cdae14
commit dede4bf0eb
7 changed files with 621 additions and 339 deletions

View File

@@ -8,7 +8,7 @@ Singleton {
property bool centerPillOnScreen: false
property bool darkMode: true
property bool darkMode: false
property bool musicMode: false
property bool slowPill: !musicMode

View File

@@ -34,6 +34,18 @@ Rectangle {
// border.color: "white"
// border.width: 1
RectangularGlow {
id: shadow
visible: !Config.darkMode
z: -2
anchors.centerIn: pill
height: pill.height
width: pill.width
color: Colors.primary
cornerRadius: pill.radius
}
RectangularGlow {
id: glow
visible: Config.musicMode

View File

@@ -13,153 +13,82 @@ layout(std140, binding = 0) uniform buf {
uniform int gheight;
uniform int gwidth;
uniform float treshold;
uniform float strength;
uniform float pointA_x;
uniform float pointA_y;
uniform float pointB_x;
uniform float pointB_y;
uniform float pointC_x;
uniform float pointC_y;
uniform float radiusA;
uniform float radiusB;
uniform float radiusC;
uniform float xshift;
uniform float t;
uniform vec4 colorA;
uniform vec4 colorB;
uniform vec4 colorC;
uniform float invert;
uniform int heightOverflow;
uniform float strength;
uniform float cava;
// uniform float seed;
} ubuf;
float squareDistance(float x1, float y1, float x2, float y2) {
float dx = x1 - x2;
float dy = y1 - y2;
return dx * dx + dy * dy;
float random(float seed, float t) {
return fract(sin(dot(vec2(seed, t), vec2(12.9898, 78.233))) * 43758.5453);
}
void main() {
float x = qt_TexCoord0.x * ubuf.gwidth;
float y = qt_TexCoord0.y * ubuf.gheight;
float t = ubuf.t;
float influenceBg = 0.0;
float gwidth = float(ubuf.gwidth);
float gheight = float(ubuf.gheight);
// influence wraps around edges
float A = squareDistance(x, y, ubuf.pointA_x, ubuf.pointA_y);
float B = squareDistance(x, y, ubuf.pointB_x, ubuf.pointB_y);
float C = squareDistance(x, y, ubuf.pointC_x, ubuf.pointC_y);
// wrap around
float wrappedTopA = squareDistance(x, y, ubuf.pointA_x, ubuf.pointA_y + ubuf.gheight);
float wrappedTopB = squareDistance(x, y, ubuf.pointB_x, ubuf.pointB_y + ubuf.gheight);
float wrappedTopC = squareDistance(x, y, ubuf.pointC_x, ubuf.pointC_y + ubuf.gheight);
float wrappedBottomA = squareDistance(x, y, ubuf.pointA_x, ubuf.pointA_y - ubuf.gheight);
float wrappedBottomB = squareDistance(x, y, ubuf.pointB_x, ubuf.pointB_y - ubuf.gheight);
float wrappedBottomC = squareDistance(x, y, ubuf.pointC_x, ubuf.pointC_y - ubuf.gheight);
// A *= squareDistance(x, y, ubuf.pointA_x + ubuf.gwidth, ubuf.pointA_y);
// B *= squareDistance(x, y, ubuf.pointB_x + ubuf.gwidth, ubuf.pointB_y);
// C *= squareDistance(x, y, ubuf.pointC_x + ubuf.gwidth, ubuf.pointC_y);
// A *= squareDistance(x, y, ubuf.pointA_x - ubuf.gwidth, ubuf.pointA_y);
// B *= squareDistance(x, y, ubuf.pointB_x - ubuf.gwidth, ubuf.pointB_y);
// C *= squareDistance(x, y, ubuf.pointC_x - ubuf.gwidth, ubuf.pointC_y);
// A *= squareDistance(x, y, ubuf.pointA_x, ubuf.pointA_y + ubuf.gheight);
// B *= squareDistance(x, y, ubuf.pointB_x, ubuf.pointB_y + ubuf.gheight);
// C *= squareDistance(x, y, ubuf.pointC_x, ubuf.pointC_y + ubuf.gheight);
// A *= squareDistance(x, y, ubuf.pointA_x, ubuf.pointA_y - ubuf.gheight);
// B *= squareDistance(x, y, ubuf.pointB_x, ubuf.pointB_y - ubuf.gheight);
// C *= squareDistance(x, y, ubuf.pointC_x, ubuf.pointC_y - ubuf.gheight);
// float influenceA = ubuf.radiusA * ubuf.radiusA / A;
// float influenceB = ubuf.radiusB * ubuf.radiusB / B;
// float influenceC = ubuf.radiusC * ubuf.radiusC / C;
float influenceA = ubuf.radiusA * ubuf.radiusA / A;
float influenceB = ubuf.radiusB * ubuf.radiusB / B;
float influenceC = ubuf.radiusC * ubuf.radiusC / C;
float influenceTopA = ubuf.radiusA * ubuf.radiusA / wrappedTopA;
float influenceTopB = ubuf.radiusB * ubuf.radiusB / wrappedTopB;
float influenceTopC = ubuf.radiusC * ubuf.radiusC / wrappedTopC;
float influenceBottomA = ubuf.radiusA * ubuf.radiusA / wrappedBottomA;
float influenceBottomB = ubuf.radiusB * ubuf.radiusB / wrappedBottomB;
float influenceBottomC = ubuf.radiusC * ubuf.radiusC / wrappedBottomC;
// vec4 colorA = vec4(0.95, 0.59, 1.0, 1.0);
// vec4 colorB = vec4(0.95, 0.42, 1.0, 1.0);
// vec4 colorC = vec4(1.0, 0.58, 0.78, 1.0);
influenceBg = influenceA + influenceB + influenceC + influenceTopA + influenceTopB + influenceTopC + influenceBottomA + influenceBottomB + influenceBottomC;
float seeds[200] = float[](0.24, 0.13424, 0.6457, 0.234, 0.8754, 0.1234, 0.876, 0.247, 0.4635, 0.465, 0.24, 0.13424, 0.6457, 0.234, 0.8754, 0.1234, 0.876, 0.247, 0.4635, 0.465, 0.24, 0.13424, 0.6457, 0.234, 0.8754, 0.1234, 0.876, 0.247, 0.4635, 0.465, 0.24, 0.13424, 0.6457, 0.234, 0.8754, 0.1234, 0.876, 0.247, 0.4635, 0.465, 0.24, 0.13424, 0.6457, 0.234, 0.8754, 0.1234, 0.876, 0.247, 0.4635, 0.465, 0.24, 0.13424, 0.6457, 0.234, 0.8754, 0.1234, 0.876, 0.247, 0.4635, 0.465, 0.24, 0.13424, 0.6457, 0.234, 0.8754, 0.1234, 0.876, 0.247, 0.4635, 0.465, 0.24, 0.13424, 0.6457, 0.234, 0.8754, 0.1234, 0.876, 0.247, 0.4635, 0.465, 0.24, 0.13424, 0.6457, 0.234, 0.8754, 0.1234, 0.876, 0.247, 0.4635, 0.465, 0.24, 0.13424, 0.6457, 0.234, 0.8754, 0.1234, 0.876, 0.247, 0.4635, 0.465, 0.24, 0.13424, 0.6457, 0.234, 0.8754, 0.1234, 0.876, 0.247, 0.4635, 0.465, 0.24, 0.13424, 0.6457, 0.234, 0.8754, 0.1234, 0.876, 0.247, 0.4635, 0.465, 0.24, 0.13424, 0.6457, 0.234, 0.8754, 0.1234, 0.876, 0.247, 0.4635, 0.465, 0.24, 0.13424, 0.6457, 0.234, 0.8754, 0.1234, 0.876, 0.247, 0.4635, 0.465, 0.24, 0.13424, 0.6457, 0.234, 0.8754, 0.1234, 0.876, 0.247, 0.4635, 0.465, 0.24, 0.13424, 0.6457, 0.234, 0.8754, 0.1234, 0.876, 0.247, 0.4635, 0.465, 0.24, 0.13424, 0.6457, 0.234, 0.8754, 0.1234, 0.876, 0.247, 0.4635, 0.465, 0.24, 0.13424, 0.6457, 0.234, 0.8754, 0.1234, 0.876, 0.247, 0.4635, 0.465, 0.24, 0.13424, 0.6457, 0.234, 0.8754, 0.1234, 0.876, 0.247, 0.4635, 0.465, 0.24, 0.13424, 0.6457, 0.234, 0.8754, 0.1234, 0.876, 0.247, 0.4635, 0.465);
float influence[200];
vec2 particles[200];
fragColor = texture(source, qt_TexCoord0) * ubuf.qt_Opacity;
float ratioA = influenceA * (ubuf.radiusA / ubuf.strength) / influenceBg;
float ratioB = influenceB * (ubuf.radiusB / ubuf.strength) / influenceBg;
float ratioC = influenceC * (ubuf.radiusC / ubuf.strength) / influenceBg;
float ratioTopA = influenceTopA * (ubuf.radiusA / ubuf.strength) / influenceBg;
float ratioTopB = influenceTopB * (ubuf.radiusB / ubuf.strength) / influenceBg;
float ratioTopC = influenceTopC * (ubuf.radiusC / ubuf.strength) / influenceBg;
float ratioBottomA = influenceBottomA * (ubuf.radiusA / ubuf.strength) / influenceBg;
float ratioBottomB = influenceBottomB * (ubuf.radiusB / ubuf.strength) / influenceBg;
float ratioBottomC = influenceBottomC * (ubuf.radiusC / ubuf.strength) / influenceBg;
float radius[200];
ratioA = pow(ratioA, ubuf.invert);
ratioB = pow(ratioB, ubuf.invert);
ratioC = pow(ratioC, ubuf.invert);
ratioTopA = pow(ratioTopA, ubuf.invert);
ratioTopB = pow(ratioTopB, ubuf.invert);
ratioTopC = pow(ratioTopC, ubuf.invert);
ratioBottomA = pow(ratioBottomA, ubuf.invert);
ratioBottomB = pow(ratioBottomB, ubuf.invert);
ratioBottomC = pow(ratioBottomC, ubuf.invert);
vec4 colors[3] = vec4[](ubuf.colorA, ubuf.colorB, ubuf.colorC);
if(influenceA > ubuf.treshold) {
fragColor = mix(fragColor, ubuf.colorA, ratioA) * ubuf.qt_Opacity;
}
if(influenceB > ubuf.treshold) {
fragColor = mix(fragColor, ubuf.colorB, ratioB) * ubuf.qt_Opacity;
}
if(influenceC > ubuf.treshold) {
fragColor = mix(fragColor, ubuf.colorC, ratioC) * ubuf.qt_Opacity;
}
if(influenceTopA > ubuf.treshold) {
fragColor = mix(fragColor, ubuf.colorA, ratioTopA) * ubuf.qt_Opacity;
}
if(influenceTopB > ubuf.treshold) {
fragColor = mix(fragColor, ubuf.colorB, ratioTopB) * ubuf.qt_Opacity;
}
if(influenceTopC > ubuf.treshold) {
fragColor = mix(fragColor, ubuf.colorC, ratioTopC) * ubuf.qt_Opacity;
}
if(influenceBottomA > ubuf.treshold) {
fragColor = mix(fragColor, ubuf.colorA, ratioBottomA) * ubuf.qt_Opacity;
}
if(influenceBottomB > ubuf.treshold) {
fragColor = mix(fragColor, ubuf.colorB, ratioBottomB) * ubuf.qt_Opacity;
}
if(influenceBottomC > ubuf.treshold) {
fragColor = mix(fragColor, ubuf.colorC, ratioBottomC) * ubuf.qt_Opacity;
for(int i = 0; i < 200; i++) {
radius[i] = 5 * random(seeds[i], 0.2);
float xshift = ubuf.xshift;
float loopedY = cos(seeds[i]) * (ubuf.gheight) * (1 - t * random(seeds[i], 0.2));
float loopedX = sin(seeds[i]) * ubuf.gwidth - xshift / (radius[i]);
particles[i] = vec2(mod(loopedX, gwidth + 10), mod(loopedY, gheight + 50) - 25);
// radius[i] += 1 * random(seeds[i], t);
// float D = distance(vec2(x, y), particles[i]);
// influence[i] = D;
// totalInfluence += influence[i];
float d = distance(vec2(x, y), particles[i]);
vec4 color = colors[int(random(seeds[i], 0.4) * 2)];
float radius = radius[i];
radius *= 1 + (ubuf.cava * (int(random(seeds[i], 0.4) + 0.5) - 0.5));
if(d / 2 < radius) {
fragColor = mix(fragColor, color, 0 + d / radius / ubuf.strength);
}
}
// if(distance(vec2(x, y), vec2(ubuf.pointA_x, ubuf.pointA_y)) < 10) {
// fragColor = vec4(0.0, 0.0, 0.0, 1.0) * ubuf.qt_Opacity;
// for(int i = 0; i < 5; i++) {
// float ratio = influence[i] / totalInfluence;
// ratio *= radius / strength;
// fragColor = mix(fragColor, vec4(0.0, 0.0, 0.0, 1.0), ratio / 1.3);
// }
// if(distance(vec2(x, y), vec2(ubuf.pointB_x, ubuf.pointB_y)) < 10) {
// fragColor = vec4(0.0, 0.0, 0.0, 1.0) * ubuf.qt_Opacity;
// float x1 = sin(seed * t * t) * ubuf.gwidth + ubuf.xshift;
// float y1 = cos(seed) * ubuf.gheight * (1 - t);
// if(distance(vec2(x, y), vec2(x1, y1)) < 5) {
// fragColor = vec4(1.0, 0.0, 0.0, 1.0);
// }
// if(distance(vec2(x, y), vec2(ubuf.pointC_x, ubuf.pointC_y)) < 10) {
// fragColor = vec4(0.0, 0.0, 0.0, 1.0) * ubuf.qt_Opacity;
// }
}

View File

@@ -0,0 +1,165 @@
#version 440
layout(location = 0) in vec2 qt_TexCoord0;
layout(location = 0) out vec4 fragColor;
layout(binding = 1) uniform sampler2D source;
layout(std140, binding = 0) uniform buf {
mat4 qt_Matrix;
float qt_Opacity;
uniform int gheight;
uniform int gwidth;
uniform float treshold;
uniform float strength;
uniform float pointA_x;
uniform float pointA_y;
uniform float pointB_x;
uniform float pointB_y;
uniform float pointC_x;
uniform float pointC_y;
uniform float radiusA;
uniform float radiusB;
uniform float radiusC;
uniform vec4 colorA;
uniform vec4 colorB;
uniform vec4 colorC;
uniform float invert;
uniform int heightOverflow;
} ubuf;
float squareDistance(float x1, float y1, float x2, float y2) {
float dx = x1 - x2;
float dy = y1 - y2;
return dx * dx + dy * dy;
}
void main() {
float x = qt_TexCoord0.x * ubuf.gwidth;
float y = qt_TexCoord0.y * ubuf.gheight;
float influenceBg = 0.0;
// influence wraps around edges
float A = squareDistance(x, y, ubuf.pointA_x, ubuf.pointA_y);
float B = squareDistance(x, y, ubuf.pointB_x, ubuf.pointB_y);
float C = squareDistance(x, y, ubuf.pointC_x, ubuf.pointC_y);
// wrap around
float wrappedTopA = squareDistance(x, y, ubuf.pointA_x, ubuf.pointA_y + ubuf.gheight);
float wrappedTopB = squareDistance(x, y, ubuf.pointB_x, ubuf.pointB_y + ubuf.gheight);
float wrappedTopC = squareDistance(x, y, ubuf.pointC_x, ubuf.pointC_y + ubuf.gheight);
float wrappedBottomA = squareDistance(x, y, ubuf.pointA_x, ubuf.pointA_y - ubuf.gheight);
float wrappedBottomB = squareDistance(x, y, ubuf.pointB_x, ubuf.pointB_y - ubuf.gheight);
float wrappedBottomC = squareDistance(x, y, ubuf.pointC_x, ubuf.pointC_y - ubuf.gheight);
// A *= squareDistance(x, y, ubuf.pointA_x + ubuf.gwidth, ubuf.pointA_y);
// B *= squareDistance(x, y, ubuf.pointB_x + ubuf.gwidth, ubuf.pointB_y);
// C *= squareDistance(x, y, ubuf.pointC_x + ubuf.gwidth, ubuf.pointC_y);
// A *= squareDistance(x, y, ubuf.pointA_x - ubuf.gwidth, ubuf.pointA_y);
// B *= squareDistance(x, y, ubuf.pointB_x - ubuf.gwidth, ubuf.pointB_y);
// C *= squareDistance(x, y, ubuf.pointC_x - ubuf.gwidth, ubuf.pointC_y);
// A *= squareDistance(x, y, ubuf.pointA_x, ubuf.pointA_y + ubuf.gheight);
// B *= squareDistance(x, y, ubuf.pointB_x, ubuf.pointB_y + ubuf.gheight);
// C *= squareDistance(x, y, ubuf.pointC_x, ubuf.pointC_y + ubuf.gheight);
// A *= squareDistance(x, y, ubuf.pointA_x, ubuf.pointA_y - ubuf.gheight);
// B *= squareDistance(x, y, ubuf.pointB_x, ubuf.pointB_y - ubuf.gheight);
// C *= squareDistance(x, y, ubuf.pointC_x, ubuf.pointC_y - ubuf.gheight);
// float influenceA = ubuf.radiusA * ubuf.radiusA / A;
// float influenceB = ubuf.radiusB * ubuf.radiusB / B;
// float influenceC = ubuf.radiusC * ubuf.radiusC / C;
float influenceA = ubuf.radiusA * ubuf.radiusA / A;
float influenceB = ubuf.radiusB * ubuf.radiusB / B;
float influenceC = ubuf.radiusC * ubuf.radiusC / C;
float influenceTopA = ubuf.radiusA * ubuf.radiusA / wrappedTopA;
float influenceTopB = ubuf.radiusB * ubuf.radiusB / wrappedTopB;
float influenceTopC = ubuf.radiusC * ubuf.radiusC / wrappedTopC;
float influenceBottomA = ubuf.radiusA * ubuf.radiusA / wrappedBottomA;
float influenceBottomB = ubuf.radiusB * ubuf.radiusB / wrappedBottomB;
float influenceBottomC = ubuf.radiusC * ubuf.radiusC / wrappedBottomC;
// vec4 colorA = vec4(0.95, 0.59, 1.0, 1.0);
// vec4 colorB = vec4(0.95, 0.42, 1.0, 1.0);
// vec4 colorC = vec4(1.0, 0.58, 0.78, 1.0);
influenceBg = influenceA + influenceB + influenceC + influenceTopA + influenceTopB + influenceTopC + influenceBottomA + influenceBottomB + influenceBottomC;
fragColor = texture(source, qt_TexCoord0) * ubuf.qt_Opacity;
float ratioA = influenceA * (ubuf.radiusA / ubuf.strength) / influenceBg;
float ratioB = influenceB * (ubuf.radiusB / ubuf.strength) / influenceBg;
float ratioC = influenceC * (ubuf.radiusC / ubuf.strength) / influenceBg;
float ratioTopA = influenceTopA * (ubuf.radiusA / ubuf.strength) / influenceBg;
float ratioTopB = influenceTopB * (ubuf.radiusB / ubuf.strength) / influenceBg;
float ratioTopC = influenceTopC * (ubuf.radiusC / ubuf.strength) / influenceBg;
float ratioBottomA = influenceBottomA * (ubuf.radiusA / ubuf.strength) / influenceBg;
float ratioBottomB = influenceBottomB * (ubuf.radiusB / ubuf.strength) / influenceBg;
float ratioBottomC = influenceBottomC * (ubuf.radiusC / ubuf.strength) / influenceBg;
ratioA = pow(ratioA, ubuf.invert);
ratioB = pow(ratioB, ubuf.invert);
ratioC = pow(ratioC, ubuf.invert);
ratioTopA = pow(ratioTopA, ubuf.invert);
ratioTopB = pow(ratioTopB, ubuf.invert);
ratioTopC = pow(ratioTopC, ubuf.invert);
ratioBottomA = pow(ratioBottomA, ubuf.invert);
ratioBottomB = pow(ratioBottomB, ubuf.invert);
ratioBottomC = pow(ratioBottomC, ubuf.invert);
if(influenceA > ubuf.treshold) {
fragColor = mix(fragColor, ubuf.colorA, ratioA) * ubuf.qt_Opacity;
}
if(influenceB > ubuf.treshold) {
fragColor = mix(fragColor, ubuf.colorB, ratioB) * ubuf.qt_Opacity;
}
if(influenceC > ubuf.treshold) {
fragColor = mix(fragColor, ubuf.colorC, ratioC) * ubuf.qt_Opacity;
}
if(influenceTopA > ubuf.treshold) {
fragColor = mix(fragColor, ubuf.colorA, ratioTopA) * ubuf.qt_Opacity;
}
if(influenceTopB > ubuf.treshold) {
fragColor = mix(fragColor, ubuf.colorB, ratioTopB) * ubuf.qt_Opacity;
}
if(influenceTopC > ubuf.treshold) {
fragColor = mix(fragColor, ubuf.colorC, ratioTopC) * ubuf.qt_Opacity;
}
if(influenceBottomA > ubuf.treshold) {
fragColor = mix(fragColor, ubuf.colorA, ratioBottomA) * ubuf.qt_Opacity;
}
if(influenceBottomB > ubuf.treshold) {
fragColor = mix(fragColor, ubuf.colorB, ratioBottomB) * ubuf.qt_Opacity;
}
if(influenceBottomC > ubuf.treshold) {
fragColor = mix(fragColor, ubuf.colorC, ratioBottomC) * ubuf.qt_Opacity;
}
// if(distance(vec2(x, y), vec2(ubuf.pointA_x, ubuf.pointA_y)) < 10) {
// fragColor = vec4(0.0, 0.0, 0.0, 1.0) * ubuf.qt_Opacity;
// }
// if(distance(vec2(x, y), vec2(ubuf.pointB_x, ubuf.pointB_y)) < 10) {
// fragColor = vec4(0.0, 0.0, 0.0, 1.0) * ubuf.qt_Opacity;
// }
// if(distance(vec2(x, y), vec2(ubuf.pointC_x, ubuf.pointC_y)) < 10) {
// fragColor = vec4(0.0, 0.0, 0.0, 1.0) * ubuf.qt_Opacity;
// }
}

Binary file not shown.

View File

@@ -38,7 +38,7 @@ Rectangle {
Text {
text: index + 1
color: activeWs ? Colors.on_primary : Colors.on_background
color: Colors.on_background
anchors.centerIn: parent
font.weight: 500
font.pixelSize: 16
@@ -92,7 +92,7 @@ Rectangle {
Behavior on x {
NumberAnimation {
duration: 400
duration: 300
easing.type: Easing.OutExpo
}
}
@@ -106,6 +106,15 @@ Rectangle {
height: shader.height - Math.min(Math.abs(blur.to_x - blur.x), Math.abs(blur.from_x - blur.x)) / 8
hideSource: true
Text {
id: activeTxt
text: currentIndex
color: Config.darkMode ? Colors.primary : Colors.background
anchors.centerIn: parent
font.weight: 900
font.pixelSize: 20
}
}
ClippingRectangle {
@@ -119,7 +128,7 @@ Rectangle {
Behavior on xshift {
NumberAnimation {
duration: 1000
duration: 2000
easing.type: Easing.OutExpo
}
}
@@ -130,7 +139,7 @@ Rectangle {
Rectangle {
id: shader
color: Colors.background
color: Config.darkMode ? Colors.on_primary : Cava.colors[2]
anchors.fill: parent
layer.enabled: true
@@ -138,220 +147,27 @@ Rectangle {
property int gheight: parent.height
property int gwidth: parent.width
property int heightOverflow: 80
property int widthOverflow: 0
property color colorA: Config.darkMode ? Colors.tertiary : Cava.colors[3]
property color colorB: Config.darkMode ? Colors.tertiary : Cava.colors[3]
property color colorC: Config.darkMode ? Colors.tertiary : Cava.colors[3]
property real cava: Cava.avg_t
property real treshold: 0
property real strength: 5
property real t: 0
property real xshift: shaderClip.xshift
property real pointA_x: 0
property real pointA_y: 0
property real pointB_x: gwidth / 2
property real pointB_y: gheight / 2
property real pointC_x: gwidth
property real pointC_y: gheight
property real pointA_vx: 0
property real pointA_vy: 0
property real pointB_vx: 0
property real pointB_vy: 0
property real pointC_vx: 0
property real pointC_vy: 0
property real radiusA: 2
property real radiusB: 2
property real radiusC: 2
property real angleA: 0
property real angleB: 0
property real angleC: 0
property bool verticalWarp: false
Behavior on radiusA {
NumberAnimation {
duration: Config.slowPill ? 5000 : 0
easing.type: Easing.OutExpo
}
}
Behavior on radiusB {
NumberAnimation {
duration: Config.slowPill ? 5000 : 0
easing.type: Easing.OutExpo
}
}
Behavior on radiusC {
NumberAnimation {
duration: Config.slowPill ? 5000 : 0
easing.type: Easing.OutExpo
}
}
property color colorA: Cava.colors[2]
property color colorB: Cava.colors[2]
property color colorC: Cava.colors[2]
property real minDistance: gwidth / 10
property real invert: -1
property real strength: Config.darkMode ? 80 : 100
fragmentShader: "root:shaders/bubble.frag.qsb"
function distance(x1, y1, x2, y2) {
return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
}
Connections {
target: Cava
function onValuesChanged() {
let points = [[pointA_x, pointA_y, radiusA, pointA_vx, pointA_vy, angleA], [pointB_x, pointB_y, radiusB, pointB_vx, pointB_vy, angleB], [pointC_x, pointC_y, radiusC, pointC_vx, pointC_vy, angleC]];
strength = 0.3;
// blur.radius = 50 * Cava.avg_t;
// blur.samples = 16 + 16 * (1 - Cava.avg_t);
// bright.brightness = 0 + 1 * Cava.avg_t;
// bright.contrast = 0.5 + 0.5 * Cava.avg_t;
points.forEach(function (point, index) {
let x = point[0];
let y = point[1];
let r = point[2];
let vx = point[3];
let vy = point[4];
let angle = point[5];
let cx = gwidth / 2;
let cy = gheight / 2;
let dcx = cx - x;
let dcy = cy - y;
// split Cava.values into 3 by avging them
// let avg_t = Cava.avg_t;
let slice = Cava.values.slice(Cava.barCount / 3 * index, Cava.barCount / 3 * (index + 1));
// console.log(`slice ${index}`, slice);
let t = slice.reduce((a, b) => a + b, 0) / slice.length;
// vx += -25 * avg_t;
angle += 0.1 * t;
angle = angle % (2 * Math.PI);
// angle
// console.log("angle", angle);
// vx += Math.cos(angle) * gwidth / 2 * t;
vy = -30 + 10 * Math.random();
// vy += Math.sin(angle) * gheight / 2 * t;
// console.log("vx", vx);
// vx += dcx * 0.01;
// vy += dcy * 0.01;
// if (x < 0) {
// x = r;
// vx = -vx;
// }
// if (x > gwidth) {
// x = gwidth - r;
// vx = -vx;
// }
// if (y < 0) {
// y = r;
// vy = -vy;
// }
// if (y > gheight) {
// y = gheight - r;
// vy = -vy;
// }
if (x < -widthOverflow) {
x = gwidth;
}
if (x > gwidth + widthOverflow) {
x = 0;
}
if (y < -heightOverflow) {
y = gheight + heightOverflow;
}
if (y > gheight + heightOverflow) {
y = 0 - heightOverflow;
}
// if (vx > 100) {
// vx = 100;
// }
// if (vy > 100) {
// vy = 100;
// }
// if (vx < -100) {
// vx = -100;
// }
// if (vy < -100) {
// vy = -100;
// }
vx *= 0.9 * Math.random();
vy *= 0.9 * Math.random();
if (shaderClip.xshift) {
vx += shaderClip.xshift;
}
x += vx * 0.01;
y += vy * 0.01;
// console.log("point", point);
// nan check
if (isNaN(x) || isNaN(y) || isNaN(vx) || isNaN(vy)) {
console.log("nan detected");
x = 0;
y = 0;
vx = 0;
vy = 0;
}
point[0] = x;
point[1] = y;
point[2] = 50;
point[3] = vx;
point[4] = vy;
point[5] = angle;
});
pointA_x = points[0][0];
pointA_y = points[0][1];
pointB_x = points[1][0];
pointB_y = points[1][1];
pointC_x = points[2][0];
pointC_y = points[2][1];
radiusA = points[0][2];
radiusB = points[1][2];
radiusC = points[2][2];
pointA_vx = points[0][3];
pointA_vy = points[0][4];
pointB_vx = points[1][3];
pointB_vy = points[1][4];
pointC_vx = points[2][3];
pointC_vy = points[2][4];
angleA = points[0][5];
angleB = points[1][5];
angleC = points[2][5];
Timer {
running: true
interval: 25
repeat: true
onTriggered: () => {
t += 0.01;
// if (t > 1) {
// t = 0;
// }
}
}
}

View File

@@ -0,0 +1,360 @@
import QtQuick
import Quickshell.Hyprland
import Quickshell.Widgets
import Qt5Compat.GraphicalEffects
import "root:components"
import "root:"
Rectangle {
id: workspaces
color: "transparent"
height: Config.pillHeight
width: workspacesRow.implicitWidth
property int currentIndex: Hyprland.focusedMonitor.activeWorkspace.id
property var activePill: workspacesRow.children[currentIndex - 1]
Row {
id: workspacesRow
anchors.fill: parent
spacing: 10
Repeater {
model: 10
delegate: Pill {
property bool activeWs: currentIndex === index + 1
color: activeWs ? Qt.rgba(Colors.background.r, Colors.background.g, Colors.background.b, 0.8) : Colors.background
cava_index: index
randomIndex: false
width: Config.pillWidth * 0.7
height: Config.pillHeight
Text {
text: index + 1
color: activeWs ? Colors.on_primary : Colors.on_background
anchors.centerIn: parent
font.weight: 500
font.pixelSize: 16
}
}
}
}
DirectionalBlur {
id: blur
// z: -1
// anchors.fill: shader
height: shaderSource.height
width: shaderSource.width
anchors.verticalCenter: shaderClip.verticalCenter
source: shaderSource
samples: 124
angle: 90
length: Math.min(Math.abs(blur.to_x - x), Math.abs(blur.from_x - x)) * 1.5
property real to_x: activePill.x
property real from_x: 0
Timer {
id: xshiftReset
interval: 150
running: false
onTriggered: {
shaderClip.xshift = 0;
xshiftReset.running = false;
}
}
Connections {
target: workspaces
function onActivePillChanged() {
blur.from_x = blur.x;
blur.to_x = activePill.x;
blur.x = blur.to_x;
shaderClip.xshift = (blur.to_x - blur.from_x);
xshiftReset.running = true;
}
}
x: 0
transparentBorder: true
Behavior on x {
NumberAnimation {
duration: 400
easing.type: Easing.OutExpo
}
}
}
ShaderEffectSource {
id: shaderSource
visible: false
sourceItem: shaderClip
width: shader.width + Math.min(Math.abs(blur.to_x - blur.x), Math.abs(blur.from_x - blur.x)) / 5
height: shader.height - Math.min(Math.abs(blur.to_x - blur.x), Math.abs(blur.from_x - blur.x)) / 8
hideSource: true
}
ClippingRectangle {
id: shaderClip
// visible: false
height: activePill.height
width: activePill.width
property real xshift: 0
Behavior on xshift {
NumberAnimation {
duration: 1000
easing.type: Easing.OutExpo
}
}
// color: "transparent"
radius: 50
Rectangle {
id: shader
color: Colors.background
anchors.fill: parent
layer.enabled: true
layer.effect: ShaderEffect {
property int gheight: parent.height
property int gwidth: parent.width
property int heightOverflow: 80
property int widthOverflow: 0
property real treshold: 0
property real strength: 5
property real pointA_x: 0
property real pointA_y: 0
property real pointB_x: gwidth / 2
property real pointB_y: gheight / 2
property real pointC_x: gwidth
property real pointC_y: gheight
property real pointA_vx: 0
property real pointA_vy: 0
property real pointB_vx: 0
property real pointB_vy: 0
property real pointC_vx: 0
property real pointC_vy: 0
property real radiusA: 2
property real radiusB: 2
property real radiusC: 2
property real angleA: 0
property real angleB: 0
property real angleC: 0
property bool verticalWarp: false
Behavior on radiusA {
NumberAnimation {
duration: Config.slowPill ? 5000 : 0
easing.type: Easing.OutExpo
}
}
Behavior on radiusB {
NumberAnimation {
duration: Config.slowPill ? 5000 : 0
easing.type: Easing.OutExpo
}
}
Behavior on radiusC {
NumberAnimation {
duration: Config.slowPill ? 5000 : 0
easing.type: Easing.OutExpo
}
}
property color colorA: Cava.colors[2]
property color colorB: Cava.colors[2]
property color colorC: Cava.colors[2]
property real minDistance: gwidth / 10
property real invert: -1
fragmentShader: "root:shaders/bubble.frag.qsb"
function distance(x1, y1, x2, y2) {
return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
}
Connections {
target: Cava
function onValuesChanged() {
let points = [[pointA_x, pointA_y, radiusA, pointA_vx, pointA_vy, angleA], [pointB_x, pointB_y, radiusB, pointB_vx, pointB_vy, angleB], [pointC_x, pointC_y, radiusC, pointC_vx, pointC_vy, angleC]];
strength = 0.3;
// blur.radius = 50 * Cava.avg_t;
// blur.samples = 16 + 16 * (1 - Cava.avg_t);
// bright.brightness = 0 + 1 * Cava.avg_t;
// bright.contrast = 0.5 + 0.5 * Cava.avg_t;
points.forEach(function (point, index) {
let x = point[0];
let y = point[1];
let r = point[2];
let vx = point[3];
let vy = point[4];
let angle = point[5];
let cx = gwidth / 2;
let cy = gheight / 2;
let dcx = cx - x;
let dcy = cy - y;
// split Cava.values into 3 by avging them
// let avg_t = Cava.avg_t;
let slice = Cava.values.slice(Cava.barCount / 3 * index, Cava.barCount / 3 * (index + 1));
// console.log(`slice ${index}`, slice);
let t = slice.reduce((a, b) => a + b, 0) / slice.length;
// vx += -25 * avg_t;
angle += 0.1 * t;
angle = angle % (2 * Math.PI);
// angle
// console.log("angle", angle);
// vx += Math.cos(angle) * gwidth / 2 * t;
vy = -30 + 10 * Math.random();
// vy += Math.sin(angle) * gheight / 2 * t;
// console.log("vx", vx);
// vx += dcx * 0.01;
// vy += dcy * 0.01;
// if (x < 0) {
// x = r;
// vx = -vx;
// }
// if (x > gwidth) {
// x = gwidth - r;
// vx = -vx;
// }
// if (y < 0) {
// y = r;
// vy = -vy;
// }
// if (y > gheight) {
// y = gheight - r;
// vy = -vy;
// }
if (x < -widthOverflow) {
x = gwidth;
}
if (x > gwidth + widthOverflow) {
x = 0;
}
if (y < -heightOverflow) {
y = gheight + heightOverflow;
}
if (y > gheight + heightOverflow) {
y = 0 - heightOverflow;
}
// if (vx > 100) {
// vx = 100;
// }
// if (vy > 100) {
// vy = 100;
// }
// if (vx < -100) {
// vx = -100;
// }
// if (vy < -100) {
// vy = -100;
// }
vx *= 0.9 * Math.random();
vy *= 0.9 * Math.random();
if (shaderClip.xshift) {
vx += shaderClip.xshift;
}
x += vx * 0.01;
y += vy * 0.01;
// console.log("point", point);
// nan check
if (isNaN(x) || isNaN(y) || isNaN(vx) || isNaN(vy)) {
console.log("nan detected");
x = 0;
y = 0;
vx = 0;
vy = 0;
}
point[0] = x;
point[1] = y;
point[2] = 50;
point[3] = vx;
point[4] = vy;
point[5] = angle;
});
pointA_x = points[0][0];
pointA_y = points[0][1];
pointB_x = points[1][0];
pointB_y = points[1][1];
pointC_x = points[2][0];
pointC_y = points[2][1];
radiusA = points[0][2];
radiusB = points[1][2];
radiusC = points[2][2];
pointA_vx = points[0][3];
pointA_vy = points[0][4];
pointB_vx = points[1][3];
pointB_vy = points[1][4];
pointC_vx = points[2][3];
pointC_vy = points[2][4];
angleA = points[0][5];
angleB = points[1][5];
angleC = points[2][5];
}
}
}
}
}
}