Files
site-portfolio/public/_lab/render.html
T
root a0dda98b83 i18n: build-time ru/en localization + EN homepage & cookie-policy
- build-pages.mjs: per-locale page/partial overrides (*.en.html), i18n token
  resolution with ru fallback, <html lang> + assetPrefix per locale
- UI dictionaries src/i18n/{ru,en}.json; lang-switch partial
- headers/footer/partials converted to {{i18n:…}} tokens
- root-absolute static asset refs so /en/ subpath loads css/js/vendor
- EN content: homepage (index.en.html + partials) and cookie-policy.en.html
  (cookie-policy body translated via apinex.bond /v1/tools/translator)
2026-09-15 22:27:51 +02:00

57 lines
1.9 KiB
HTML

<!DOCTYPE html>
<html>
<head><meta charset="utf-8" /><title>bake</title></head>
<body style="margin:0">
<div id="host" style="width:512px;height:512px"></div>
<script type="module">
import { ShaderMount, paperTextureFragmentShader, getShaderNoiseTexture } from "/_lab/paper-bundle.js";
try {
const host = document.getElementById("host");
const t0 = performance.now();
const noise = getShaderNoiseTexture();
await noise.decode();
const mount = new ShaderMount(
host,
paperTextureFragmentShader,
{
u_colorBack: [1, 1, 1, 1],
u_colorFront: [0, 0, 0, 1],
u_contrast: 0.3,
u_roughness: 0.4,
u_fiber: 0.3,
u_fiberSize: 0.2,
u_crumples: 0.3,
u_crumpleSize: 0.35,
u_folds: 0.65,
u_foldCount: 5,
u_drops: 0.2,
u_fade: 0,
u_seed: 5.8,
u_scale: 0.6,
u_noiseTexture: noise,
},
{ antialias: false },
0,
0,
1,
);
// ждём, пока текстура шума реально загрузится и кадр отрендерится
await new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(r)));
const canvas = host.querySelector("canvas");
// переливаем в свой canvas, чтобы toDataURL дал полный кадр
const out = document.createElement("canvas");
out.width = canvas.width;
out.height = canvas.height;
out.id = "out";
out.getContext("2d").drawImage(canvas, 0, 0);
document.body.appendChild(out);
window.__T = Math.round(performance.now() - t0);
window.__READY = true;
} catch (e) {
window.__ERR = e.message;
}
</script>
</body>
</html>