Skip to content

Turn one illustration into an animated 2D mesh avatar with a coding agent and a local editor

Describe features, workflow, live use and embedding on the landing page

shinshin865babf896820e
diff --git a/site/index.html b/site/index.html
index 21677bc..49319ff 100644
--- a/site/index.html
+++ b/site/index.html
@@ -5,6 +5,20 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="Turn one illustration into an animated 2D avatar. Create and adjust it in Mesh Avatar Studio, then embed it in your app with the mesh-avatar runtime." />
<title>Mesh Avatar Studio — Your illustration, in motion</title>
+ <link rel="canonical" href="https://shinshin86.github.io/mesh-avatar-studio/" />
+ <link rel="alternate" hreflang="en" href="https://shinshin86.github.io/mesh-avatar-studio/" />
+ <link rel="alternate" hreflang="x-default" href="https://shinshin86.github.io/mesh-avatar-studio/" />
+ <meta property="og:type" content="website" />
+ <meta property="og:site_name" content="Mesh Avatar Studio" />
+ <meta property="og:title" content="Mesh Avatar Studio — Your illustration, in motion" />
+ <meta property="og:description" content="Create an animated 2D avatar from one illustration, adjust it in a local editor, and embed it in your app with mesh-avatar." />
+ <meta property="og:url" content="https://shinshin86.github.io/mesh-avatar-studio/" />
+ <meta property="og:locale" content="en_US" />
+ <meta property="og:image" content="__SOCIAL_IMAGE__" />
+ <meta property="og:image:width" content="1440" />
+ <meta property="og:image:height" content="900" />
+ <meta property="og:image:alt" content="Mesh Avatar Studio showing the Miko sample, editing handles, and a live avatar preview." />
+ <meta name="twitter:card" content="summary_large_image" />
<link rel="icon" href="data:," />
<script type="module" src="/src/main.ts"></script>
</head>
@@ -17,7 +31,12 @@
</svg>
<span>Mesh Avatar Studio</span>
</a>
- <a class="header-link" href="https://github.com/shinshin86/mesh-avatar-studio">GitHub <span aria-hidden="true">↗</span></a>
+ <nav class="primary-nav" aria-label="Main navigation">
+ <a class="header-link" href="#make">Make an avatar</a>
+ <a class="header-link" href="#live">Use it live</a>
+ <a class="header-link" href="#embed">Embed</a>
+ <a class="header-link" href="https://github.com/shinshin86/mesh-avatar-studio">GitHub <span aria-hidden="true">↗</span></a>
+ </nav>
</header>
<main id="main" class="shell">
<section class="hero" aria-labelledby="hero-title">
@@ -57,10 +76,194 @@
<figcaption>Running here with <a href="https://www.npmjs.com/package/mesh-avatar">mesh-avatar</a>.</figcaption>
</figure>
</section>
+ <section id="features" class="content-section" aria-labelledby="features-title">
+ <div class="section-heading">
+ <p class="eyebrow">What it does</p>
+ <h2 id="features-title">Blink, speak, and follow a pose.</h2>
+ <p>Build the avatar in Studio. Use the same motion and expressions in your own app with the runtime.</p>
+ </div>
+ <div class="feature-grid">
+ <article class="feature-card">
+ <h3>Blink and breathe</h3>
+ <p>Automatic blinking, breathing, and idle motion keep the avatar moving between interactions.</p>
+ </article>
+ <article class="feature-card">
+ <h3>Lip sync</h3>
+ <p>Drive the mouth from voice levels, or preview vowel shapes and kana text in the editor.</p>
+ </article>
+ <article class="feature-card">
+ <h3>Head turns and tilts</h3>
+ <p>Control the head and gaze with pose parameters. Review the movement in the editor’s live preview.</p>
+ </article>
+ <article class="feature-card">
+ <h3>Hair and accessory sway</h3>
+ <p>Physics adds follow-through to hair strands and pendulum movement to accessories such as tassels.</p>
+ </article>
+ <article class="feature-card">
+ <h3>Expressions and drawings</h3>
+ <p>Switch smiles, surprise, and winks. Add drawn eyes and mouths for blinking and speech.</p>
+ </article>
+ <article class="feature-card">
+ <h3>Lighting presets</h3>
+ <p>Position a light over the avatar, adjust its shading, and save setups to switch between in the Live page.</p>
+ </article>
+ </div>
+ </section>
+ <section id="make" class="content-section" aria-labelledby="make-title">
+ <div class="section-heading">
+ <p class="eyebrow">Make it in Studio</p>
+ <h2 id="make-title">From your illustration to an avatar file.</h2>
+ <p>A coding agent prepares the rig and layers. You review the result and adjust the parts in a local editor.</p>
+ </div>
+ <ol class="steps">
+ <li class="step-card">
+ <div class="step-copy">
+ <span class="step-number" aria-hidden="true">01</span>
+ <h3>Give your agent an illustration</h3>
+ <p>Open Claude Code or Codex in the repository and ask it to follow the <a href="https://github.com/shinshin86/mesh-avatar-studio/blob/main/docs/agent-guide.md">agent guide</a>. A front-facing PNG with a transparent background works best.</p>
+ </div>
+ <figure class="screenshot">
+ <a class="screenshot-link" aria-label="View the editor overview screenshot at full size"><img data-screenshot="overview" width="1440" height="900" loading="lazy" decoding="async" alt="The Studio editor with the Miko illustration, rig handles, and an animated preview." /></a>
+ <figcaption>Open the project your agent prepares.</figcaption>
+ </figure>
+ </li>
+ <li class="step-card">
+ <div class="step-copy">
+ <span class="step-number" aria-hidden="true">02</span>
+ <h3>Review the motion</h3>
+ <p>Open the project in Studio. Use <strong>Pose test</strong> to turn the head and close the eyes, then <strong>Lip sync</strong> to check the mouth shapes.</p>
+ </div>
+ <figure class="screenshot">
+ <a class="screenshot-link" aria-label="View the lip sync screenshot at full size"><img data-screenshot="lipSync" width="1440" height="900" loading="lazy" decoding="async" alt="The editor’s Lip sync panel with vowel buttons and the avatar’s mouth open in the preview." /></a>
+ <figcaption>Check poses and speech before exporting.</figcaption>
+ </figure>
+ </li>
+ <li class="step-card">
+ <div class="step-copy">
+ <span class="step-number" aria-hidden="true">03</span>
+ <h3>Adjust by dragging handles</h3>
+ <p>Select a part and move its dots on the image. The preview follows your edits. If an outline changes the cut-out layers, choose <strong>Save and rebuild layers</strong>.</p>
+ </div>
+ <figure class="screenshot">
+ <a class="screenshot-link" aria-label="View the editing handles screenshot at full size"><img data-screenshot="handles" width="1440" height="900" loading="lazy" decoding="async" alt="A zoomed eye outline with editable points selected on the illustration." /></a>
+ <figcaption>Place the rig where it belongs on your drawing.</figcaption>
+ </figure>
+ </li>
+ <li class="step-card">
+ <div class="step-copy">
+ <span class="step-number" aria-hidden="true">04</span>
+ <h3>Add drawings and export</h3>
+ <p>Request drawn eyes and mouths from <strong>Drawn variants</strong>, then choose <strong>Export .mavatar</strong>. One file carries the rig, built layers, drawings, and metadata.</p>
+ </div>
+ <figure class="screenshot">
+ <a class="screenshot-link" aria-label="View the drawn variants screenshot at full size"><img data-screenshot="variants" width="1440" height="900" loading="lazy" decoding="async" alt="The Drawn variants panel with a request for mouth drawings ready to copy to a coding agent." /></a>
+ <figcaption>Add drawn variants before exporting the avatar.</figcaption>
+ </figure>
+ </li>
+ </ol>
+ <p class="section-note">Start locally with <code>npm install</code> and <code>npm run dev</code>. <a href="https://github.com/shinshin86/mesh-avatar-studio#try-the-sample">Follow the setup guide <span aria-hidden="true">↗</span></a></p>
+ </section>
+ <section id="live" class="content-section" aria-labelledby="live-title">
+ <div class="section-heading">
+ <p class="eyebrow">Use it live</p>
+ <h2 id="live-title">Move with your face. Bring it to your stream.</h2>
+ <p>Studio’s Live page sends your avatar’s motion to a separate stream view that you can add to OBS.</p>
+ </div>
+ <div class="live-grid">
+ <article class="live-card">
+ <div class="live-copy">
+ <h3>Track your face or use your voice</h3>
+ <p>Start the camera and calibrate, then adjust mirroring, sensitivity, and smoothing. The camera is optional: microphone lip sync can drive the mouth while idle motion continues.</p>
+ </div>
+ <figure class="screenshot">
+ <a class="screenshot-link" aria-label="View the Live controls screenshot at full size"><img data-screenshot="live" width="1440" height="900" loading="lazy" decoding="async" alt="The Live page with face tracking, microphone, expression, background, and lighting controls beside Miko." /></a>
+ <figcaption>Camera video and microphone audio stay on your machine.</figcaption>
+ </figure>
+ </article>
+ <article class="live-card">
+ <div class="live-copy">
+ <h3>Add an OBS Browser Source</h3>
+ <p>Choose a background, copy the OBS URL, and add it as a Browser Source. Use transparency in OBS or a green background for chroma key in other capture software.</p>
+ </div>
+ <figure class="screenshot">
+ <a class="screenshot-link" aria-label="View the stream screenshot at full size"><img data-screenshot="stream" width="1440" height="900" loading="lazy" decoding="async" alt="The stream view showing Miko against a solid green chroma key background without editor controls." /></a>
+ <figcaption>A separate view for capture, with only the avatar.</figcaption>
+ </figure>
+ </article>
+ </div>
+ <p class="section-note">Both views use the local development server. Keep the Live page open in its own window while streaming. <a href="https://github.com/shinshin86/mesh-avatar-studio/blob/main/docs/reference.md#live-and-streaming">Streaming guide <span aria-hidden="true">↗</span></a></p>
+ </section>
+ <section id="embed" class="content-section" aria-labelledby="embed-title">
+ <div class="section-heading">
+ <p class="eyebrow">Embed with mesh-avatar</p>
+ <h2 id="embed-title">An avatar in your app’s canvas.</h2>
+ <p>Load the file you exported from Studio. The runtime starts animating it, and your app controls its pose, expressions, and voice level.</p>
+ </div>
+ <div class="embed-grid">
+ <div class="embed-details">
+ <ul class="runtime-facts" aria-label="Runtime requirements and format">
+ <li>WebGL</li><li>ES modules</li><li>TypeScript types</li><li>No React dependency</li>
+ </ul>
+ <div class="code-card">
+ <div class="code-heading"><h3>Install the runtime</h3><button type="button" class="copy-button" data-copy="install-code" aria-describedby="install-feedback" disabled>Copy</button></div>
+ <pre tabindex="0" aria-label="Install command"><code id="install-code">npm install mesh-avatar</code></pre>
+ <p id="install-feedback" class="copy-feedback" role="status"></p>
+ </div>
+ <p>Place your <code>.mavatar</code> file in your app’s public assets. Add the canvas to your HTML and run the JavaScript from your app’s module entry.</p>
+ <p>Idle motion and blinking start automatically. For speech, your app plays the audio and sends its loudness to the runtime.</p>
+ <a class="text-link" href="https://github.com/shinshin86/mesh-avatar-studio/tree/main/packages/runtime#drive-the-avatar">Runtime API and examples <span aria-hidden="true">↗</span></a>
+ </div>
+ <div class="embed-code">
+ <div class="code-card">
+ <div class="code-heading"><h3>Add a canvas <span>HTML</span></h3><button type="button" class="copy-button" data-copy="canvas-code" aria-describedby="canvas-feedback" disabled>Copy</button></div>
+ <pre tabindex="0" aria-label="Canvas HTML"><code id="canvas-code">&lt;canvas id="avatar" width="720" height="960"&gt;&lt;/canvas&gt;</code></pre>
+ <p id="canvas-feedback" class="copy-feedback" role="status"></p>
+ </div>
+ <div class="code-card">
+ <div class="code-heading"><h3>Load and control it <span>JavaScript</span></h3><button type="button" class="copy-button" data-copy="avatar-code" aria-describedby="avatar-feedback" disabled>Copy</button></div>
+ <pre tabindex="0" aria-label="JavaScript runtime example"><code id="avatar-code">import { loadMeshAvatar } from 'mesh-avatar';
+
+const canvas = document.querySelector('#avatar');
+const avatar = await loadMeshAvatar(
+ canvas, '/avatars/character.mavatar'
+);
+
+// Pick an expression or set a pose.
+avatar.setExpression('smile');
+avatar.setParameters({ angleX: 10, gazeX: 0.25 });
+
+// While your app plays audio, send its loudness (0–1).
+avatar.setSpeaking(true);
+avatar.setVoiceLevel(0.6);
+
+// When the line finishes, return to idle.
+avatar.setVoiceLevel(0);
+avatar.setSpeaking(false);
+avatar.setExpression('neutral');
+avatar.setParameters({});
+
+// Call avatar.destroy() when removing the canvas.</code></pre>
+ <p id="avatar-feedback" class="copy-feedback" role="status"></p>
+ </div>
+ </div>
+ </div>
+ </section>
</main>
<footer class="site-footer shell">
- <p>Miko © Yuki Shindo (AITuber OnAir). Used under the <a href="https://miko.aituberonair.com/#terms">Miko Character Usage Guidelines</a>.</p>
- <p>This is not an official AITuber OnAir product.</p>
+ <div class="footer-top">
+ <div><p class="footer-brand">Mesh Avatar Studio</p><p>Create in Studio. Embed with mesh-avatar.</p></div>
+ <nav class="footer-links" aria-label="Project resources">
+ <a href="https://github.com/shinshin86/mesh-avatar-studio">GitHub</a>
+ <a href="https://www.npmjs.com/package/mesh-avatar">npm</a>
+ <a href="https://github.com/shinshin86/mesh-avatar-studio/blob/main/docs/format.md">Avatar format</a>
+ <a href="https://github.com/shinshin86/mesh-avatar-studio/blob/main/docs/agent-guide.md">Agent guide</a>
+ </nav>
+ </div>
+ <div class="license-notes">
+ <p>Code: <a href="https://github.com/shinshin86/mesh-avatar-studio/blob/main/LICENSE">MIT License</a>. Avatar artwork is licensed separately.</p>
+ <p>Miko © Yuki Shindo (AITuber OnAir). Used under the <a href="https://miko.aituberonair.com/#terms">Miko Character Usage Guidelines</a>.</p>
+ <p>This is not an official AITuber OnAir product.</p>
+ </div>
</footer>
</body>
</html>
diff --git a/site/src/main.ts b/site/src/main.ts
index 156b5fd..657df8a 100644
--- a/site/src/main.ts
+++ b/site/src/main.ts
@@ -1,6 +1,52 @@
import { LIVE_EXPRESSIONS, loadMeshAvatar, type LiveExpression, type MeshAvatar } from 'mesh-avatar';
+import { copy } from './messages';
+import overviewImage from '../../docs/images/en/01-overview.png';
+import handlesImage from '../../docs/images/en/02-edit-handles.png';
+import lipSyncImage from '../../docs/images/en/03-lip-sync.png';
+import variantsImage from '../../docs/images/en/05-variants.png';
+import liveImage from '../../docs/images/en/07-live.png';
+import streamImage from '../../docs/images/en/08-stream.png';
import './style.css';
+const screenshots: Record<string, string> = {
+ overview: overviewImage, handles: handlesImage, lipSync: lipSyncImage,
+ variants: variantsImage, live: liveImage, stream: streamImage,
+};
+for (const image of document.querySelectorAll<HTMLImageElement>('img[data-screenshot]')) {
+ image.src = screenshots[image.dataset.screenshot!];
+ const link = image.closest('a');
+ if (link) link.href = image.src;
+}
+
+for (const button of document.querySelectorAll<HTMLButtonElement>('button[data-copy]')) {
+ const code = document.getElementById(button.dataset.copy!)!;
+ const feedback = document.getElementById(button.getAttribute('aria-describedby')!)!;
+ let resetTimer = 0;
+ button.disabled = false;
+ button.textContent = copy.copy;
+ button.addEventListener('click', async () => {
+ window.clearTimeout(resetTimer);
+ button.disabled = true;
+ button.textContent = copy.copy;
+ feedback.textContent = '';
+ try {
+ await navigator.clipboard.writeText(code.textContent ?? '');
+ button.textContent = copy.copied;
+ feedback.textContent = copy.copySucceeded;
+ } catch {
+ const selection = window.getSelection();
+ const range = document.createRange();
+ range.selectNodeContents(code);
+ selection?.removeAllRanges();
+ selection?.addRange(range);
+ feedback.textContent = copy.copyFailed;
+ } finally {
+ button.disabled = false;
+ resetTimer = window.setTimeout(() => { button.textContent = copy.copy; }, 2500);
+ }
+ });
+}
+
const hero = document.querySelector<HTMLElement>('.hero')!;
const canvas = document.querySelector<HTMLCanvasElement>('#avatar')!;
const stage = document.querySelector<HTMLElement>('.avatar-stage')!;
@@ -26,7 +72,7 @@ const pointer = { active: false, x: 0, y: 0, smoothX: 0, smoothY: 0, weight: 0 }
for (const name of shownExpressions.filter(name => LIVE_EXPRESSIONS.includes(name))) {
const button = document.createElement('button');
button.type = 'button';
- button.textContent = name[0].toUpperCase() + name.slice(1);
+ button.textContent = copy.expressions[name];
button.dataset.expression = name;
button.setAttribute('aria-pressed', String(name === 'neutral'));
button.addEventListener('click', () => {
@@ -39,14 +85,15 @@ for (const name of shownExpressions.filter(name => LIVE_EXPRESSIONS.includes(nam
}
function updateMotionPreference() {
+ avatar?.setAutoIdle(!reducedMotion.matches);
avatar?.setAutoMotion(!reducedMotion.matches);
avatar?.setSwayGain(reducedMotion.matches ? 0.35 : 1);
pointer.active = false;
pointer.weight = 0;
avatar?.setParameters({});
hint.textContent = reducedMotion.matches || !finePointer.matches
- ? 'Pick an expression to try it.'
- : 'Move your pointer to catch her eye.';
+ ? copy.expressionHint
+ : copy.pointerHint;
}
reducedMotion.addEventListener('change', updateMotionPreference);
finePointer.addEventListener('change', updateMotionPreference);
@@ -130,10 +177,11 @@ window.addEventListener('pagehide', event => {
window.addEventListener('pageshow', () => { pageVisible = true; updateLoop(); });
async function start() {
- status.textContent = 'Loading the live preview…';
+ status.textContent = copy.loading;
canvas.dataset.state = 'loading';
try {
- const loaded = await loadMeshAvatar(canvas, `${import.meta.env.BASE_URL}miko.mavatar`, { manual: true });
+ // Hide the source image's cut top edge while leaving more of the hair visible.
+ const loaded = await loadMeshAvatar(canvas, `${import.meta.env.BASE_URL}miko.mavatar`, { manual: true, padTop: -0.04 });
if (disposed) { loaded.destroy(); return; }
avatar = loaded;
avatar.setAutoIdle(true);
@@ -147,7 +195,7 @@ async function start() {
} catch {
canvas.dataset.state = 'error';
stage.setAttribute('aria-busy', 'false');
- status.textContent = 'The live preview couldn’t load. Try reloading in a browser with WebGL enabled. You can still explore the project on GitHub or npm.';
+ status.textContent = copy.loadFailed;
}
}
diff --git a/site/src/messages.ts b/site/src/messages.ts
new file mode 100644
index 0000000..826d374
--- /dev/null
+++ b/site/src/messages.ts
@@ -0,0 +1,32 @@
+import type { LiveExpression } from 'mesh-avatar';
+
+interface Messages {
+ expressions: Record<LiveExpression, string>;
+ pointerHint: string;
+ expressionHint: string;
+ loading: string;
+ loadFailed: string;
+ copy: string;
+ copied: string;
+ copySucceeded: string;
+ copyFailed: string;
+}
+
+const messages: Record<string, Messages> = {
+ en: {
+ expressions: {
+ neutral: 'Neutral', smile: 'Smile', shy: 'Shy', surprise: 'Surprise',
+ halfLidded: 'Half-lidded', angry: 'Angry', sad: 'Sad', wink: 'Wink',
+ },
+ pointerHint: 'Move your pointer to catch her eye.',
+ expressionHint: 'Pick an expression to try it.',
+ loading: 'Loading the live preview…',
+ loadFailed: 'The live preview couldn’t load. Try reloading in a browser with WebGL enabled. You can still explore the project on GitHub or npm.',
+ copy: 'Copy',
+ copied: 'Copied',
+ copySucceeded: 'Copied to clipboard.',
+ copyFailed: 'Copy wasn’t available. The code is selected; use your browser’s copy command.',
+ },
+};
+
+export const copy = messages[document.documentElement.lang.split('-')[0]] ?? messages.en;
diff --git a/site/src/style.css b/site/src/style.css
index ffdb7fa..f6290b3 100644
--- a/site/src/style.css
+++ b/site/src/style.css
@@ -24,14 +24,15 @@ button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outlin
[hidden] { display: none !important; }
.shell { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
-.skip-link { position: fixed; top: 12px; left: 12px; z-index: 10; padding: 12px 16px; border-radius: 8px; background: var(--surface); transform: translateY(-160%); }
-.skip-link:focus { transform: translateY(0); }
+.skip-link { position: fixed; top: 12px; left: 12px; z-index: 10; padding: 12px 16px; border-radius: 8px; background: var(--surface); transform: translateY(-160%); opacity: 0; pointer-events: none; }
+.skip-link:focus { transform: translateY(0); opacity: 1; pointer-events: auto; }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 96px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 650; letter-spacing: -.4px; text-decoration: none; }
.brand-mark { width: 32px; height: 32px; color: var(--accent); flex-shrink: 0; }
.header-link { padding-block: 12px; font-size: 14px; text-decoration: none; }
.header-link:hover { color: var(--accent); }
.header-link span { margin-left: 4px; }
+.primary-nav { display: flex; align-items: center; gap: 24px; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 480px); gap: 64px; align-items: center; padding-block: 64px 48px; }
.hero-copy { padding-bottom: 28px; }
.eyebrow { margin: 0 0 20px; font-size: 13px; font-weight: 650; letter-spacing: 1.5px; text-transform: uppercase; color: var(--accent); }
@@ -72,19 +73,73 @@ figcaption { margin-top: 14px; color: var(--muted); text-align: center; font-siz
figcaption a:hover, .site-footer a:hover { color: var(--accent); }
.site-footer { border-top: 1px solid var(--line); padding-block: 24px 32px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.site-footer p { margin: 0; }
+.content-section { padding-block: 72px; border-top: 1px solid var(--line); scroll-margin-top: 24px; }
+.section-heading { max-width: 720px; margin-bottom: 32px; }
+.section-heading .eyebrow { margin-bottom: 12px; }
+h2 { margin: 0; font-size: clamp(28px, 3vw, 36px); font-weight: 650; line-height: 1.2; letter-spacing: -1.1px; }
+h3 { margin: 0; font-size: 18px; font-weight: 650; line-height: 1.4; letter-spacing: -.3px; }
+.section-heading > p:last-child { margin: 16px 0 0; color: var(--muted); font-size: 17px; line-height: 1.7; }
+.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
+.feature-card { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
+.feature-card p { margin: 10px 0 0; font-size: 14px; line-height: 1.7; color: var(--muted); }
+.steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; list-style: none; padding: 0; margin: 0; }
+.step-card, .live-card { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
+.step-copy { position: relative; padding: 24px 24px 24px 68px; }
+.step-number { position: absolute; top: 24px; left: 24px; display: grid; place-content: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 650; }
+.step-copy p, .live-copy p { margin: 12px 0 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
+.step-copy strong, .live-copy strong { color: var(--ink); font-weight: 550; }
+.screenshot { margin: auto 0 0; }
+.screenshot-link { display: block; border-top: 1px solid var(--line); background: var(--canvas); }
+.screenshot-link:focus-visible { outline-offset: -4px; }
+.screenshot img { display: block; width: 100%; height: auto; aspect-ratio: 8 / 5; }
+.screenshot figcaption { margin: 0; padding: 12px 20px; border-top: 1px solid var(--line); text-align: left; }
+.section-note { margin: 24px 0 0; color: var(--muted); font-size: 13px; line-height: 1.8; }
+.section-note a { color: var(--ink); }
+.section-note code, .embed-details > p code { padding: 2px 5px; border-radius: 4px; background: var(--surface); color: var(--ink); font-size: .9em; }
+.live-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
+.live-copy { padding: 24px; }
+.embed-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 40px; align-items: start; }
+.runtime-facts { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0 0 24px; }
+.runtime-facts li { padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; background: var(--surface); }
+.embed-details > p { margin: 24px 0; color: var(--muted); font-size: 15px; line-height: 1.8; }
+.text-link { font-size: 14px; color: var(--accent); text-decoration: none; }
+.text-link:hover { text-decoration: underline; }
+.embed-code { display: grid; gap: 16px; min-width: 0; }
+.code-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
+.code-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
+.code-heading h3 { font-size: 13px; letter-spacing: 0; }
+.code-heading h3 span { margin-left: 8px; font-size: 11px; font-weight: 400; color: var(--muted); }
+.copy-button { flex-shrink: 0; padding: 6px 10px; min-width: 64px; min-height: 32px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); font-size: 12px; cursor: pointer; }
+.copy-button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
+.copy-button:disabled { opacity: .5; cursor: default; }
+code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
+pre { margin: 0; padding: 20px 18px; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.8; tab-size: 2; }
+pre:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }
+.copy-feedback { min-height: 28px; margin: 0; padding: 0 18px 12px; color: var(--muted); font-size: 11px; line-height: 1.5; }
+.site-footer { padding-block: 40px; font-size: 12px; }
+.footer-top { display: flex; justify-content: space-between; align-items: start; gap: 24px; padding-bottom: 28px; }
+.footer-brand { color: var(--ink); font-size: 16px; font-weight: 650; }
+.footer-links { display: flex; flex-wrap: wrap; gap: 12px 24px; }
+.footer-links a { color: var(--ink); text-decoration: none; }
+.footer-links a:hover { text-decoration: underline; }
+.license-notes { border-top: 1px solid var(--line); padding-top: 24px; font-size: 11px; }
@media (max-width: 960px) {
.hero { gap: 32px; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); }
h1 { font-size: 48px; }
.hero-pitch { font-size: 22px; }
+ .primary-nav { gap: 16px; }
+ .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
+ .embed-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
}
@media (max-width: 760px) {
.shell { width: min(520px, calc(100% - 40px)); }
- .site-header { min-height: 72px; }
+ .site-header { min-height: 72px; flex-wrap: wrap; gap: 12px; padding-block: 20px 12px; }
.brand { font-size: 15px; gap: 8px; }
.brand-mark { width: 26px; height: 26px; }
.header-link { font-size: 12px; }
+ .primary-nav { width: 100%; justify-content: space-between; gap: 12px; }
.hero { grid-template-columns: minmax(0, 1fr); gap: 28px; padding-block: 36px 32px; }
.hero-copy { padding-bottom: 0; }
.eyebrow { margin-bottom: 16px; font-size: 11px; letter-spacing: 1.2px; }
@@ -94,10 +149,25 @@ figcaption a:hover, .site-footer a:hover { color: var(--accent); }
.hero-actions { gap: 8px; margin-top: 24px; }
.button { padding: 12px; font-size: 12px; gap: 8px; }
.hero-note { font-size: 12px; }
- .avatar-stage { height: 310px; }
+ .avatar-stage { height: clamp(270px, 80vw, 310px); }
.demo-heading { padding-inline: 16px; }
.demo-controls { padding: 14px 16px; }
.expression-chips button { flex: 1; padding-inline: 8px; }
+ .content-section { padding-block: 48px; }
+ .section-heading { margin-bottom: 24px; }
+ .section-heading > p:last-child { font-size: 15px; }
+ .feature-grid, .steps, .live-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
+ .feature-card, .live-copy { padding: 20px; }
+ .step-copy { padding: 20px 20px 20px 60px; }
+ .step-number { top: 20px; left: 20px; }
+ h3 { font-size: 17px; }
+ .screenshot figcaption { padding-inline: 16px; font-size: 11px; }
+ .code-heading { padding-inline: 14px; }
+ .code-heading h3 span { display: block; margin-left: 0; }
+ pre { padding: 16px 14px; font-size: 11px; }
+ .copy-feedback { padding-inline: 14px; }
+ .footer-top { flex-direction: column; }
+ .footer-links { gap: 12px 20px; }
}
@media (prefers-reduced-motion: reduce) {
diff --git a/site/vite.config.ts b/site/vite.config.ts
index 2c8adf0..78e6ff2 100644
--- a/site/vite.config.ts
+++ b/site/vite.config.ts
@@ -9,6 +9,25 @@ import { readAvatarFolder } from '../tools/avatar-files.mjs';
const fromHere = (path: string) => fileURLToPath(new URL(path, import.meta.url));
const base = '/mesh-avatar-studio/';
const avatarFile = 'miko.mavatar';
+const publishedUrl = `https://shinshin86.github.io${base}`;
+
+function socialImage(): Plugin {
+ return {
+ name: 'site-social-image',
+ transformIndexHtml: {
+ order: 'post',
+ handler(html, context) {
+ if (context.server) {
+ return html.replaceAll('__SOCIAL_IMAGE__', `${base}@fs/${fromHere('../docs/images/en/01-overview.png')}`);
+ }
+ const image = Object.values(context.bundle ?? {}).find(asset =>
+ asset.type === 'asset' && asset.names.includes('01-overview.png'));
+ if (!image) throw new Error('The overview screenshot is missing from the site build.');
+ return html.replaceAll('__SOCIAL_IMAGE__', new URL(image.fileName, publishedUrl).href);
+ },
+ },
+ };
+}
function sampleAvatar(): Plugin {
const pack = () => packProjectAvatar(
@@ -50,13 +69,13 @@ export default defineConfig({
root: fromHere('./'),
base,
publicDir: false,
- plugins: [sampleAvatar()],
+ plugins: [sampleAvatar(), socialImage()],
resolve: { alias: { 'mesh-avatar': fromHere('../packages/runtime/src/index.ts') } },
server: {
host: '127.0.0.1',
fs: {
// Only the packed avatar is served; raw sample and private project files stay local.
- deny: ['.env', '.env.*', '*.{crt,pem}', '**/.git/**', '**/samples/**', '**/projects/**', '**/work/**', '**/_plan/**', '**/reference/**'],
+ deny: ['.env', '.env.*', '*.{crt,pem}', '**/.git/**', '**/samples/**', '**/projects/**', '**/work/**', '**/reference/**'],
},
},
preview: { host: '127.0.0.1' },