Spaces:
Running on Zero
Running on Zero
mk8c: Leinwand-Seitenverhältnis mobil korrekt, weiche Ausblendung ohne Kante
Browse files- app.py +1 -1
- assets/stoms.css +2 -1
- assets/stoms.js +7 -3
app.py
CHANGED
|
@@ -46,7 +46,7 @@ ROOT = Path(__file__).resolve().parent
|
|
| 46 |
ASSETS = ROOT / "assets"
|
| 47 |
gr.set_static_paths([str(ASSETS)])
|
| 48 |
ASSET_URL = "/gradio_api/file=" + str(ASSETS)
|
| 49 |
-
V = "
|
| 50 |
CSS = (ASSETS / "stoms.css").read_text(encoding="utf-8").replace("__ASSETS__", ASSET_URL)
|
| 51 |
# Gradio scoped `css=` unter `.gradio-container .contain` – Media-Queries, Intro, Dock und Modals brauchen zusätzlich ein
|
| 52 |
# ungescoptes Stylesheet.
|
|
|
|
| 46 |
ASSETS = ROOT / "assets"
|
| 47 |
gr.set_static_paths([str(ASSETS)])
|
| 48 |
ASSET_URL = "/gradio_api/file=" + str(ASSETS)
|
| 49 |
+
V = "mk8c"
|
| 50 |
CSS = (ASSETS / "stoms.css").read_text(encoding="utf-8").replace("__ASSETS__", ASSET_URL)
|
| 51 |
# Gradio scoped `css=` unter `.gradio-container .contain` – Media-Queries, Intro, Dock und Modals brauchen zusätzlich ein
|
| 52 |
# ungescoptes Stylesheet.
|
assets/stoms.css
CHANGED
|
@@ -432,7 +432,7 @@ html.st-embed body{height:100%;overflow-x:hidden;overflow-y:auto;overscroll-beha
|
|
| 432 |
|
| 433 |
/* mk8 · Visualisierung ohne Kante: Leinwand blendet weich ins Video aus (kein Rechteck) */
|
| 434 |
.st-orbit__canvas{mix-blend-mode:screen;
|
| 435 |
-
-webkit-mask-image:radial-gradient(ellipse
|
| 436 |
.st-orbit.is-vizbg .st-orbit__canvas{-webkit-mask-image:none;mask-image:none}
|
| 437 |
.st-viz-bg{-webkit-mask-image:none!important;mask-image:none!important}
|
| 438 |
/* letzte Flächen: Mastering-Ziele & Hinweis randlos */
|
|
@@ -440,3 +440,4 @@ html.st-embed body{height:100%;overflow-x:hidden;overflow-y:auto;overscroll-beha
|
|
| 440 |
#st-ms-preset label.selected,#st-ms-preset label:has(input:checked){background:rgba(126,240,208,.16)!important;box-shadow:0 0 22px -6px rgba(126,240,208,.55)!important}
|
| 441 |
.vm-station .st-preset-info{border:0!important;background:linear-gradient(90deg,rgba(166,224,74,.10),transparent 70%)!important}
|
| 442 |
.vm-station .icon-button-wrapper{box-shadow:none!important;background:transparent!important;border:0!important}
|
|
|
|
|
|
| 432 |
|
| 433 |
/* mk8 · Visualisierung ohne Kante: Leinwand blendet weich ins Video aus (kein Rechteck) */
|
| 434 |
.st-orbit__canvas{mix-blend-mode:screen;
|
| 435 |
+
-webkit-mask-image:radial-gradient(ellipse 50% 50% at 50% 50%,#000 62%,transparent 100%);mask-image:radial-gradient(ellipse 50% 50% at 50% 50%,#000 62%,transparent 100%)}
|
| 436 |
.st-orbit.is-vizbg .st-orbit__canvas{-webkit-mask-image:none;mask-image:none}
|
| 437 |
.st-viz-bg{-webkit-mask-image:none!important;mask-image:none!important}
|
| 438 |
/* letzte Flächen: Mastering-Ziele & Hinweis randlos */
|
|
|
|
| 440 |
#st-ms-preset label.selected,#st-ms-preset label:has(input:checked){background:rgba(126,240,208,.16)!important;box-shadow:0 0 22px -6px rgba(126,240,208,.55)!important}
|
| 441 |
.vm-station .st-preset-info{border:0!important;background:linear-gradient(90deg,rgba(166,224,74,.10),transparent 70%)!important}
|
| 442 |
.vm-station .icon-button-wrapper{box-shadow:none!important;background:transparent!important;border:0!important}
|
| 443 |
+
@media (max-width:767px){.st-orbit__canvas{border:0!important;background:none!important;border-radius:0!important;height:min(96vw,420px)!important}}
|
assets/stoms.js
CHANGED
|
@@ -300,7 +300,7 @@ class Orbit {
|
|
| 300 |
if (m) { try { this.am = new m.Antimatter(this.canvas, { mobile: MOBILE }); this.AM = m.Antimatter; this.mode = "gl"; ok = true; } catch (e) { console.info("STΩMs: WebGL2-Pfad nicht verfügbar → 2D", e.message); } }
|
| 301 |
if (!ok) { this.mode = "2d"; this.g2 = this.canvas.getContext("2d"); }
|
| 302 |
root.dataset.mode = this.mode;
|
| 303 |
-
this.resize(); this.ro = new ResizeObserver(() => this.resize()); this.ro.observe(this.root);
|
| 304 |
if (this.vizBg && this.mode === "gl") this.setBg(true);
|
| 305 |
this.loop();
|
| 306 |
});
|
|
@@ -458,7 +458,7 @@ class Orbit {
|
|
| 458 |
}
|
| 459 |
frame() {
|
| 460 |
const n = this.stems.length, anySolo = this.state.some(s => s.solo);
|
| 461 |
-
const W
|
| 462 |
const tot = this.state.reduce((a, s) => a + s.level, 0) / n;
|
| 463 |
const orbs = this.stems.map((s, i) => {
|
| 464 |
const st = this.state[i], base = 0.36 + Math.min(Math.max((s.rms + 60) / 60, 0), 1) * 0.24;
|
|
@@ -473,8 +473,12 @@ class Orbit {
|
|
| 473 |
return { t: this.t, orbs, tot: RM ? 0 : tot, bass: RM ? 0 : this.bass, on: RM ? 0 : this.on, hi: RM ? 0 : this.hi, cam: this.cam, calm: RM, W, H,
|
| 474 |
mode: this.viz, fold: this.fold, age: RM ? 99 : this.t - this.vizT0, m: this.m, bg: !!this.bgOn };
|
| 475 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 476 |
resize() {
|
| 477 |
-
const w
|
| 478 |
if (this.mode === "gl") this.am.resize(w, h, this.bgOn ? 1 : (MOBILE ? 1.25 : 1.5));
|
| 479 |
else if (this.g2) { this.canvas.width = w * devicePixelRatio; this.canvas.height = h * devicePixelRatio; }
|
| 480 |
this.dirty = true;
|
|
|
|
| 300 |
if (m) { try { this.am = new m.Antimatter(this.canvas, { mobile: MOBILE }); this.AM = m.Antimatter; this.mode = "gl"; ok = true; } catch (e) { console.info("STΩMs: WebGL2-Pfad nicht verfügbar → 2D", e.message); } }
|
| 301 |
if (!ok) { this.mode = "2d"; this.g2 = this.canvas.getContext("2d"); }
|
| 302 |
root.dataset.mode = this.mode;
|
| 303 |
+
this.resize(); this.ro = new ResizeObserver(() => this.resize()); this.ro.observe(this.root); this.ro.observe(this.canvas);
|
| 304 |
if (this.vizBg && this.mode === "gl") this.setBg(true);
|
| 305 |
this.loop();
|
| 306 |
});
|
|
|
|
| 458 |
}
|
| 459 |
frame() {
|
| 460 |
const n = this.stems.length, anySolo = this.state.some(s => s.solo);
|
| 461 |
+
const [W, H] = this.size();
|
| 462 |
const tot = this.state.reduce((a, s) => a + s.level, 0) / n;
|
| 463 |
const orbs = this.stems.map((s, i) => {
|
| 464 |
const st = this.state[i], base = 0.36 + Math.min(Math.max((s.rms + 60) / 60, 0), 1) * 0.24;
|
|
|
|
| 473 |
return { t: this.t, orbs, tot: RM ? 0 : tot, bass: RM ? 0 : this.bass, on: RM ? 0 : this.on, hi: RM ? 0 : this.hi, cam: this.cam, calm: RM, W, H,
|
| 474 |
mode: this.viz, fold: this.fold, age: RM ? 99 : this.t - this.vizT0, m: this.m, bg: !!this.bgOn };
|
| 475 |
}
|
| 476 |
+
size() { // echte Leinwandgröße (mobil liegt das HUD unter der Leinwand → nicht root nehmen)
|
| 477 |
+
if (this.bgOn) return [innerWidth, innerHeight];
|
| 478 |
+
const c = this.canvas; return [c.clientWidth || this.root.clientWidth, c.clientHeight || this.root.clientHeight];
|
| 479 |
+
}
|
| 480 |
resize() {
|
| 481 |
+
const [w, h] = this.size();
|
| 482 |
if (this.mode === "gl") this.am.resize(w, h, this.bgOn ? 1 : (MOBILE ? 1.25 : 1.5));
|
| 483 |
else if (this.g2) { this.canvas.width = w * devicePixelRatio; this.canvas.height = h * devicePixelRatio; }
|
| 484 |
this.dirty = true;
|