BlueGit

timfa kwin-marble

Marble Magic Lamp: single scale animation 1 -> 0.001 (old settings), drop anchors/compensation

timfa Tim Falken · pushed by timfa

Authored 2026-11-02 · 2 weeks ago

Hash
c3950352d8ad44b9b2fb6241f3e015c0f5c744b5
Parent
23d86a02
1 file changed +5 −14
kwin6_effect_marble_minimize/contents/code/main.js +5 −14
@@ -230,20 +230,11 @@ class BurnMyWindowsMarbleMinimizeEffect {
230 230 { type: Effect.Opacity, from: 1.0, to: 1.0 }] });
231 231 window.bmwYAnimation = animate({ window: window, curve: yCurve, duration: f.T,
232 232 animations: [{ type: Effect.Translation, from: {value1: 0.0, value2: ay[0]}, to: {value1: 0.0, value2: ay[1]} }] });
233 // scale 100% -> 10% essentially in the last part (InExpo stays ~1 until late); reverse = OutExpo
233 // single scale 100% -> ~0 (0.001, never 0) essentially in the last part (InExpo stays ~1 until late); reverse = OutExpo
234 234 window.bmwScaleAnimation = animate({ window: window, curve: fwd ? QEasingCurve.InExpo : QEasingCurve.OutExpo, duration: f.T,
235 animations: [{ type: Effect.Scale, sourceAnchor: Effect.Horizontal | Effect.Vertical, targetAnchor: Effect.Horizontal | Effect.Vertical, from: {value1: fwd ? 1.0 : 0.1, value2: fwd ? 1.0 : 0.1},
236 to: {value1: fwd ? 0.1 : 1.0, value2: fwd ? 0.1 : 1.0} }] });
237 // anchor compensation that grows with the shrink (same late curve), so the marble stays on
238 // the path and ends exactly on the icon centre
239 window.bmwCompAnimation = animate({ window: window, curve: fwd ? QEasingCurve.InExpo : QEasingCurve.OutExpo, duration: f.T,
240 animations: [{ type: Effect.Translation, from: {value1: fwd ? 0 : f.ox, value2: fwd ? 0 : f.oy},
241 to: {value1: fwd ? f.ox : 0, value2: fwd ? f.oy : 0} }] });
242 // second, multiplying scale: ~1 until the very end, then to ~0 (combined ~10% at 95%,
243 // ~0 at 100%), so the last frames are effectively invisible. 0.001 instead of 0 (no /0).
244 window.bmwScale2Animation = animate({ window: window, curve: fwd ? QEasingCurve.InExpo : QEasingCurve.OutExpo, duration: f.T,
245 animations: [{ type: Effect.Scale, sourceAnchor: Effect.Horizontal | Effect.Vertical, targetAnchor: Effect.Horizontal | Effect.Vertical, from: {value1: fwd ? 1.0 : 0.001, value2: fwd ? 1.0 : 0.001},
235 animations: [{ type: Effect.Scale, from: {value1: fwd ? 1.0 : 0.001, value2: fwd ? 1.0 : 0.001},
246 236 to: {value1: fwd ? 0.001 : 1.0, value2: fwd ? 0.001 : 1.0} }] });
237
247 238 }
248 239
249 240 slotWindowMinimized(window) {
@@ -314,8 +305,8 @@ class BurnMyWindowsMarbleMinimizeEffect {
314 305 } else if (window.bmwMode == "fall") { // arrived: invisible hold at the icon
315 306 window.bmwTailAnimation = animate({
316 307 window: window, curve: QEasingCurve.Linear, duration: 250,
317 animations: [{ type: Effect.Translation, from: {value1: f.dx + f.ox, value2: f.dy + f.oy}, to: {value1: f.dx + f.ox, value2: f.dy + f.oy} },
318 { type: Effect.Scale, sourceAnchor: Effect.Horizontal | Effect.Vertical, targetAnchor: Effect.Horizontal | Effect.Vertical, from: {value1: 0.001, value2: 0.001}, to: {value1: 0.001, value2: 0.001} },
308 animations: [{ type: Effect.Translation, from: {value1: f.dx, value2: f.dy}, to: {value1: f.dx, value2: f.dy} },
309 { type: Effect.Scale, from: {value1: 0.001, value2: 0.001}, to: {value1: 0.001, value2: 0.001} },
319 310 { type: Effect.Opacity, from: 0.0, to: 0.0 }]
320 311 });
321 312 window.bmwMode = "tail"; window.bmwSegEnd = Date.now() + 250 - 8;
@@ -230,20 +230,11 @@ class BurnMyWindowsMarbleMinimizeEffect {
230 { type: Effect.Opacity, from: 1.0, to: 1.0 }] });
230 { type: Effect.Opacity, from: 1.0, to: 1.0 }] });
231 window.bmwYAnimation = animate({ window: window, curve: yCurve, duration: f.T,
231 window.bmwYAnimation = animate({ window: window, curve: yCurve, duration: f.T,
232 animations: [{ type: Effect.Translation, from: {value1: 0.0, value2: ay[0]}, to: {value1: 0.0, value2: ay[1]} }] });
232 animations: [{ type: Effect.Translation, from: {value1: 0.0, value2: ay[0]}, to: {value1: 0.0, value2: ay[1]} }] });
233 // scale 100% -> 10% essentially in the last part (InExpo stays ~1 until late); reverse = OutExpo
233 // single scale 100% -> ~0 (0.001, never 0) essentially in the last part (InExpo stays ~1 until late); reverse = OutExpo
234 window.bmwScaleAnimation = animate({ window: window, curve: fwd ? QEasingCurve.InExpo : QEasingCurve.OutExpo, duration: f.T,
234 window.bmwScaleAnimation = animate({ window: window, curve: fwd ? QEasingCurve.InExpo : QEasingCurve.OutExpo, duration: f.T,
235 animations: [{ type: Effect.Scale, sourceAnchor: Effect.Horizontal | Effect.Vertical, targetAnchor: Effect.Horizontal | Effect.Vertical, from: {value1: fwd ? 1.0 : 0.1, value2: fwd ? 1.0 : 0.1},
235 animations: [{ type: Effect.Scale, from: {value1: fwd ? 1.0 : 0.001, value2: fwd ? 1.0 : 0.001},
236 to: {value1: fwd ? 0.1 : 1.0, value2: fwd ? 0.1 : 1.0} }] });
237 // anchor compensation that grows with the shrink (same late curve), so the marble stays on
238 // the path and ends exactly on the icon centre
239 window.bmwCompAnimation = animate({ window: window, curve: fwd ? QEasingCurve.InExpo : QEasingCurve.OutExpo, duration: f.T,
240 animations: [{ type: Effect.Translation, from: {value1: fwd ? 0 : f.ox, value2: fwd ? 0 : f.oy},
241 to: {value1: fwd ? f.ox : 0, value2: fwd ? f.oy : 0} }] });
242 // second, multiplying scale: ~1 until the very end, then to ~0 (combined ~10% at 95%,
243 // ~0 at 100%), so the last frames are effectively invisible. 0.001 instead of 0 (no /0).
244 window.bmwScale2Animation = animate({ window: window, curve: fwd ? QEasingCurve.InExpo : QEasingCurve.OutExpo, duration: f.T,
245 animations: [{ type: Effect.Scale, sourceAnchor: Effect.Horizontal | Effect.Vertical, targetAnchor: Effect.Horizontal | Effect.Vertical, from: {value1: fwd ? 1.0 : 0.001, value2: fwd ? 1.0 : 0.001},
246 to: {value1: fwd ? 0.001 : 1.0, value2: fwd ? 0.001 : 1.0} }] });
236 to: {value1: fwd ? 0.001 : 1.0, value2: fwd ? 0.001 : 1.0} }] });
237
247 }
238 }
248
239
249 slotWindowMinimized(window) {
240 slotWindowMinimized(window) {
@@ -314,8 +305,8 @@ class BurnMyWindowsMarbleMinimizeEffect {
314 } else if (window.bmwMode == "fall") { // arrived: invisible hold at the icon
305 } else if (window.bmwMode == "fall") { // arrived: invisible hold at the icon
315 window.bmwTailAnimation = animate({
306 window.bmwTailAnimation = animate({
316 window: window, curve: QEasingCurve.Linear, duration: 250,
307 window: window, curve: QEasingCurve.Linear, duration: 250,
317 animations: [{ type: Effect.Translation, from: {value1: f.dx + f.ox, value2: f.dy + f.oy}, to: {value1: f.dx + f.ox, value2: f.dy + f.oy} },
308 animations: [{ type: Effect.Translation, from: {value1: f.dx, value2: f.dy}, to: {value1: f.dx, value2: f.dy} },
318 { type: Effect.Scale, sourceAnchor: Effect.Horizontal | Effect.Vertical, targetAnchor: Effect.Horizontal | Effect.Vertical, from: {value1: 0.001, value2: 0.001}, to: {value1: 0.001, value2: 0.001} },
309 { type: Effect.Scale, from: {value1: 0.001, value2: 0.001}, to: {value1: 0.001, value2: 0.001} },
319 { type: Effect.Opacity, from: 0.0, to: 0.0 }]
310 { type: Effect.Opacity, from: 0.0, to: 0.0 }]
320 });
311 });
321 window.bmwMode = "tail"; window.bmwSegEnd = Date.now() + 250 - 8;
312 window.bmwMode = "tail"; window.bmwSegEnd = Date.now() + 250 - 8;