Art and animation, written as code. Illustrations, loops, interactive web art, launch-videos and scored films in dozens of styles, identical on every render.
TypeScript agent-skillsanimationcanvasclaude-codeclaude-pluginclaude-skillscodex-plugincreative-codecreative-codingcreative-toolsdeterministicgenerative-arthand-drawnillustrationlaunch-videomotion-designmotion-graphicspluginprocedural-generationskill
a 32nd style, dream glaze: the hand-painted dream photograph, with its hero and its painting film; 0.7.0
Alex Greenshpun671503dac579
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.jsonindex 8a9b2c6..61c7d4c 100644--- a/.claude-plugin/marketplace.json+++ b/.claude-plugin/marketplace.json@@ -12,8 +12,8 @@{"name": "anidoodle","source": "./",- "description": "Code-drawn stills, drawing timelapses, films, explainers and interactive web animations in 31 styles, with scores composed in code.",- "version": "0.6.4",+ "description": "Code-drawn stills, drawing timelapses, films, explainers and interactive web animations in 32 styles, with scores composed in code.",+ "version": "0.7.0","author": {"name": "Alex Greenshpun","url": "https://linkedin.com/in/alexgreensh"diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.jsonindex a13ad44..575c0fe 100644--- a/.claude-plugin/plugin.json+++ b/.claude-plugin/plugin.json@@ -1,8 +1,8 @@{"name": "anidoodle","displayName": "anidoodle",- "description": "Code-drawn stills, drawing timelapses, films, explainers and interactive web animations in 31 styles, with scores composed in code.",- "version": "0.6.4",+ "description": "Code-drawn stills, drawing timelapses, films, explainers and interactive web animations in 32 styles, with scores composed in code.",+ "version": "0.7.0","icon": "./assets/icon.png","author": {"name": "Alex Greenshpun",diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.jsonindex 712800f..0c6e9ab 100644--- a/.codex-plugin/plugin.json+++ b/.codex-plugin/plugin.json@@ -1,12 +1,12 @@{"name": "anidoodle",- "version": "0.6.4",- "description": "Code-drawn stills, drawing timelapses, films, explainers and interactive web animations in 31 styles, with scores composed in code.",+ "version": "0.7.0",+ "description": "Code-drawn stills, drawing timelapses, films, explainers and interactive web animations in 32 styles, with scores composed in code.","skills": "./skills/","interface": {"displayName": "anidoodle","shortDescription": "Hand-drawn art, written as code.",- "longDescription": "Illustrations, drawing timelapses, films of any length, explainers, infographics and interactive web animations in 31 hand-made styles, with original scores composed as data and played by an engine written in code. Match a style from your image, recreate a photo in any style, keep a character consistent, or learn how a drawing is built. Every render is deterministic, with no generated assets.",+ "longDescription": "Illustrations, drawing timelapses, films of any length, explainers, infographics and interactive web animations in 32 hand-made styles, with original scores composed as data and played by an engine written in code. Match a style from your image, recreate a photo in any style, keep a character consistent, or learn how a drawing is built. Every render is deterministic, with no generated assets.","developerName": "Alex Greenshpun","category": "Creativity","capabilities": [diff --git a/.gitignore b/.gitignoreindex b283bf6..2052a15 100644--- a/.gitignore+++ b/.gitignore@@ -33,3 +33,4 @@ skills/anidoodle/engine/src/hosts/page-clawd*.tsskills/anidoodle/engine/src/canvas-core/butterfly/skills/anidoodle/engine/src/canvas-core/mechanicalLepidoptera.tsskills/anidoodle/engine/src/hosts/page-mechanicalLepidoptera.ts+.scratch*/diff --git a/.grok-plugin/marketplace.json b/.grok-plugin/marketplace.jsonindex d00348a..a6de9a3 100644--- a/.grok-plugin/marketplace.json+++ b/.grok-plugin/marketplace.json@@ -9,8 +9,8 @@{"name": "anidoodle","source": "./plugins/anidoodle",- "description": "Code-drawn stills, drawing timelapses, films, explainers and interactive web animations in 31 styles, with scores composed in code.",- "version": "0.6.4",+ "description": "Code-drawn stills, drawing timelapses, films, explainers and interactive web animations in 32 styles, with scores composed in code.",+ "version": "0.7.0","author": {"name": "Alex Greenshpun","url": "https://linkedin.com/in/alexgreensh"diff --git a/README.es-ES.md b/README.es-ES.mdindex 9e5e4cc..5fcbf73 100644--- a/README.es-ES.md+++ b/README.es-ES.md@@ -11,7 +11,7 @@ https://github.com/user-attachments/assets/1cf7f75c-b040-4c00-bf0c-cf1885f8b8da<p align="center"><strong>Arte dibujado a mano, escrito en código.</strong></p><p align="center">- Ilustraciones, timelapses de dibujo, películas, vídeos explicativos y arte web interactivo en 31 estilos.<br>+ Ilustraciones, timelapses de dibujo, películas, vídeos explicativos y arte web interactivo en 32 estilos.<br>Cada trazo es una función y cada nota es aritmética, así que la misma fuente<br>redibuja la misma imagen en cualquier máquina, a cualquier tamaño, para siempre.</p>@@ -28,7 +28,7 @@ https://github.com/user-attachments/assets/1cf7f75c-b040-4c00-bf0c-cf1885f8b8da<p align="center"><a href="README.md">English</a> · <a href="README.ja-JP.md">日本語</a> · <a href="README.zh-CN.md">简体中文</a> · <a href="README.ko-KR.md">한국어</a> · <a href="README.fr-FR.md">Français</a> · <b>Español</b></p><p align="center">- <a href="#31-estilos-entre-los-que-elegir">Estilos</a> ·+ <a href="#32-estilos-entre-los-que-elegir">Estilos</a> ·<a href="#cada-estilo-se-dibuja-solo">Películas del dibujo</a> ·<a href="#música-compuesta-con-código">Música</a> ·<a href="#qué-puedes-crear">Qué puedes crear</a> ·@@ -37,16 +37,16 @@ https://github.com/user-attachments/assets/1cf7f75c-b040-4c00-bf0c-cf1885f8b8da<a href="#empieza-aquí">Empieza aquí</a></p>-## 31 estilos entre los que elegir+## 32 estilos entre los que elegir<p align="center">- <img src="assets/styles.jpg" width="100%" alt="31 ilustraciones, cada una con su estilo, desde lápiz y acuarela, cómic con rotulador y risografía hasta pixel art, bloques de juguete, xilografía, sumi-e, esgrafiado, bordado, óleo y libros de cuentos populares">+ <img src="assets/styles.jpg" width="100%" alt="32 ilustraciones, cada una con su estilo, desde lápiz y acuarela, cómic con rotulador y risografía hasta pixel art, bloques de juguete, xilografía, sumi-e, esgrafiado, bordado, óleo y libros de cuentos populares"></p>-Cada estilo es su propia forma de dejar una marca: el afilado de una plumilla, el sangrado de una aguada, el rozado de la tiza sobre la pizarra, el borde rasgado del papel recortado, la trama de un tambor de risografía, una sola línea grabada que se enrosca hasta convertirse en luna. El motivo cambia de forma según la mano que lo dibuje, igual que le pasaría con treinta y un ilustradores distintos. Cada estilo incluye además una película en la que su imagen se dibuja trazo a trazo, siguiendo el orden de trabajo de un artista de ese medio. Elige uno para tu marca y cada imagen que venga después llegará de la misma mano. Cada lámina de arriba, y la propia hoja de contactos, está dibujada por código en este repositorio.+Cada estilo es su propia forma de dejar una marca: el afilado de una plumilla, el sangrado de una aguada, el rozado de la tiza sobre la pizarra, el borde rasgado del papel recortado, la trama de un tambor de risografía, una sola línea grabada que se enrosca hasta convertirse en luna. El motivo cambia de forma según la mano que lo dibuje, igual que le pasaría con 32 ilustradores distintos. Cada estilo incluye además una película en la que su imagen se dibuja trazo a trazo, siguiendo el orden de trabajo de un artista de ese medio. Elige uno para tu marca y cada imagen que venga después llegará de la misma mano. Cada lámina de arriba, y la propia hoja de contactos, está dibujada por código en este repositorio.<details>-<summary><b>Los 31 estilos</b> y cómo se hace cada uno</summary>+<summary><b>Los 32 estilos</b> y cómo se hace cada uno</summary>| Estilo | Cómo se hace ||---|---|@@ -58,6 +58,7 @@ Cada estilo es su propia forma de dejar una marca: el afilado de una plumilla, e| **Cera** | Garabatos cerosos que dejan libres los surcos del papel || **Collage de papel recortado** | Papel rasgado y cortado, sin líneas dibujadas || **Plano cianotipo** | Dibujo técnico a plumilla sobre una hoja de cianotipia |+| **Veladura de ensueño** | Finas veladuras de óleo, sin pincelada visible, todos los bordes duros || **Bordado** | Hilo cosido sobre lino tensado en un bastidor || **Vectorial plano** | Formas geométricas nítidas con grano y sombras largas || **Cuento popular ilustrado** | Un primer plano pintado se funde con líneas de lápiz sobre papel crema |@@ -160,7 +161,7 @@ Pregunta cómo dibujar algo, o trae un dibujo, y anidoodle lo reconstruye como l| **Redes y chat** | Loops sin fin, GIFs y stickers animados transparentes, con el tamaño justo para el feed. || **Presentaciones y documentos** | Una familia de ilustraciones de sección desde un solo programa. Una nueva semilla da una imagen hermana en el mismo estilo. || **Historias** | Storyboards y animatics que crecen hasta convertirse en una película terminada de cualquier duración, con banda sonora original. |-| **Tu propia imagen** | Trae un dibujo para aplicar su estilo a otro motivo, o una foto para recrearla en cualquiera de las 31 formas de dibujar, con cada trazo hecho en código. |+| **Tu propia imagen** | Trae un dibujo para aplicar su estilo a otro motivo, o una foto para recrearla en cualquiera de las 32 formas de dibujar, con cada trazo hecho en código. || **Páginas web** | Ilustraciones interactivas que siguen el cursor, reaccionan a clics y formularios, o se dibujan al desplazarte por la página. || **Aprendizaje** | Lecciones de dibujo con láminas paso a paso y timelapses que enseñan cómo se construye una imagen, qué observar y qué errores evitar. || **Personajes** | Un personaje creado una sola vez que se mantiene idéntico entre planos, poses y estilos. |diff --git a/README.fr-FR.md b/README.fr-FR.mdindex cb4fff9..6274c97 100644--- a/README.fr-FR.md+++ b/README.fr-FR.md@@ -11,7 +11,7 @@ https://github.com/user-attachments/assets/1cf7f75c-b040-4c00-bf0c-cf1885f8b8da<p align="center"><strong>De l'art dessiné à la main, écrit en code.</strong></p><p align="center">- Illustrations, accélérés de dessin, films, vidéos explicatives et art web interactif dans 31 styles.<br>+ Illustrations, accélérés de dessin, films, vidéos explicatives et art web interactif dans 32 styles.<br>Chaque trait est une fonction et chaque note un calcul, si bien que la même source<br>redessine la même image sur toute machine, à toute taille, pour de bon.</p>@@ -28,7 +28,7 @@ https://github.com/user-attachments/assets/1cf7f75c-b040-4c00-bf0c-cf1885f8b8da<p align="center"><a href="README.md">English</a> · <a href="README.ja-JP.md">日本語</a> · <a href="README.zh-CN.md">简体中文</a> · <a href="README.ko-KR.md">한국어</a> · <b>Français</b> · <a href="README.es-ES.md">Español</a></p><p align="center">- <a href="#31-styles-au-choix">Styles</a> ·+ <a href="#32-styles-au-choix">Styles</a> ·<a href="#chaque-style-se-dessine-sous-vos-yeux">Films de dessin</a> ·<a href="#de-la-musique-composée-en-code">Musique</a> ·<a href="#ce-que-vous-pouvez-créer">Ce que vous pouvez créer</a> ·@@ -37,16 +37,16 @@ https://github.com/user-attachments/assets/1cf7f75c-b040-4c00-bf0c-cf1885f8b8da<a href="#démarrer">Démarrer</a></p>-## 31 styles au choix+## 32 styles au choix<p align="center">- <img src="assets/styles.jpg" width="100%" alt="31 illustrations, chacune dans son style, du crayon et de l’aquarelle, de la BD au marqueur et de la risographie au pixel art, aux briques de jeu, à la gravure sur bois, au sumi-e, à la carte à gratter, à la broderie, à la peinture à l’huile et au livre de contes populaires">+ <img src="assets/styles.jpg" width="100%" alt="32 illustrations, chacune dans son style, du crayon et de l’aquarelle, de la BD au marqueur et de la risographie au pixel art, aux briques de jeu, à la gravure sur bois, au sumi-e, à la carte à gratter, à la broderie, à la peinture à l’huile et au livre de contes populaires"></p>-Chaque style est une façon bien à lui de poser une trace : l'effilement d'une plume, le débordement d'un lavis, le grain de la craie sur l'ardoise, le bord déchiré du papier découpé, la trame d'un tambour de risographie, un seul trait gravé qui s'enroule pour devenir une lune. Le sujet change de forme selon la main qui le dessine, comme il le ferait pour trente et un illustrateurs différents. Chaque style s’accompagne aussi d’un film où son image se dessine trait après trait, dans l’ordre de travail d’un artiste qui emploie ce médium. Choisissez-en un pour votre marque, et toutes les images suivantes arriveront de la même main. Chaque planche ci-dessus, et la planche-contact elle-même, est dessinée par du code dans ce dépôt.+Chaque style est une façon bien à lui de poser une trace : l'effilement d'une plume, le débordement d'un lavis, le grain de la craie sur l'ardoise, le bord déchiré du papier découpé, la trame d'un tambour de risographie, un seul trait gravé qui s'enroule pour devenir une lune. Le sujet change de forme selon la main qui le dessine, comme il le ferait pour 32 illustrateurs différents. Chaque style s’accompagne aussi d’un film où son image se dessine trait après trait, dans l’ordre de travail d’un artiste qui emploie ce médium. Choisissez-en un pour votre marque, et toutes les images suivantes arriveront de la même main. Chaque planche ci-dessus, et la planche-contact elle-même, est dessinée par du code dans ce dépôt.<details>-<summary><b>Les 31 styles</b> et leur façon de prendre forme</summary>+<summary><b>Les 32 styles</b> et leur façon de prendre forme</summary>| Style | Comment il est réalisé ||---|---|@@ -58,6 +58,7 @@ Chaque style est une façon bien à lui de poser une trace : l'effilement d'une| **Crayon de cire** | Des gribouillis cireux qui sautent les creux du papier || **Collage de papier découpé** | Du papier déchiré et découpé, sans traits dessinés || **Plan cyanotype** | Un dessin à la plume à tracer sur papier cyanotype |+| **Glacis onirique** | De fines couches de glacis à l'huile, sans touche visible, tous les contours durs || **Broderie** | Du fil piqué dans du lin tendu sur un tambour || **Vecteur à plat** | Des formes géométriques nettes, du grain et de longues ombres || **Conte populaire illustré** | Un premier plan peint qui se fond dans le crayon sur papier crème |@@ -160,7 +161,7 @@ Demandez comment dessiner quelque chose, ou apportez un de vos dessins, et anido| **Réseaux sociaux et messagerie** | Des boucles infinies, des GIF et des stickers animés transparents, aux bonnes dimensions pour le fil d'actualité. || **Présentations et documents** | Une famille d'illustrations de section issues d'un seul programme. Une nouvelle graine donne une image sœur dans le même style. || **Récits** | Des storyboards et des animatics qui grandissent jusqu’à devenir un film achevé, de n’importe quelle durée, avec une bande originale. |-| **Votre propre image** | Apportez un dessin et reprenez son style pour un nouveau sujet, ou apportez une photo et recréez-la dans l’une des 31 manières, chaque trait tracé par le code. |+| **Votre propre image** | Apportez un dessin et reprenez son style pour un nouveau sujet, ou apportez une photo et recréez-la dans l’une des 32 manières, chaque trait tracé par le code. || **Pages web** | Des illustrations interactives qui suivent le curseur, réagissent aux clics et aux formulaires, ou se dessinent au fil du défilement. || **Apprentissage** | Des leçons de dessin en étapes et en accéléré, pour comprendre la construction d’une image, les points à observer et les erreurs courantes. || **Personnages** | Un personnage créé une fois, qui reste identique d’un plan, d’une pose et d’un style à l’autre. |diff --git a/README.ja-JP.md b/README.ja-JP.mdindex bc75f5f..26b3d19 100644--- a/README.ja-JP.md+++ b/README.ja-JP.md@@ -11,7 +11,7 @@ https://github.com/user-attachments/assets/1cf7f75c-b040-4c00-bf0c-cf1885f8b8da<p align="center"><strong>手描きのアートを、コードで書く。</strong></p><p align="center">- イラスト、作画タイムラプス、映画、解説動画、インタラクティブなウェブアートを、31のスタイルで。<br>+ イラスト、作画タイムラプス、映画、解説動画、インタラクティブなウェブアートを、32のスタイルで。<br>一筆一筆が関数で、一音一音が計算式だから、同じソースコードは<br>どのマシンでも、どんなサイズでも、いつまでも同じ絵を描き直す。</p>@@ -28,7 +28,7 @@ https://github.com/user-attachments/assets/1cf7f75c-b040-4c00-bf0c-cf1885f8b8da<p align="center"><a href="README.md">English</a> · <b>日本語</b> · <a href="README.zh-CN.md">简体中文</a> · <a href="README.ko-KR.md">한국어</a> · <a href="README.fr-FR.md">Français</a> · <a href="README.es-ES.md">Español</a></p><p align="center">- <a href="#選べる31のスタイル">スタイル</a> ·+ <a href="#選べる32のスタイル">スタイル</a> ·<a href="#すべてのスタイルが自ら描かれる">作画映像</a> ·<a href="#コードで作曲する音楽">音楽</a> ·<a href="#つくれるもの">つくれるもの</a> ·@@ -37,16 +37,16 @@ https://github.com/user-attachments/assets/1cf7f75c-b040-4c00-bf0c-cf1885f8b8da<a href="#はじめる">はじめる</a></p>-## 選べる31のスタイル+## 選べる32のスタイル<p align="center">- <img src="assets/styles.jpg" width="100%" alt="それぞれ異なるスタイルで描かれた31枚のイラスト。鉛筆と水彩、マーカーのコミック、リソグラフから、ピクセルアート、おもちゃのブロック、木版画、墨絵、スクラッチボード、刺繍、油彩、民話の絵本まで">+ <img src="assets/styles.jpg" width="100%" alt="それぞれ異なるスタイルで描かれた32枚のイラスト。鉛筆と水彩、マーカーのコミック、リソグラフから、ピクセルアート、おもちゃのブロック、木版画、墨絵、スクラッチボード、刺繍、油彩、民話の絵本まで"></p>-どのスタイルも、線の生み出し方がまったく違う。ペン先のしなり、水彩のにじみ、黒板チョークの擦れ、切り絵の破れた縁、リソグラフのドラムが作る網点、一本の彫り線が渦を巻いて月になる瞬間。同じ題材でも、31人の描き手がそれぞれ描いたように、スタイルごとに姿を変える。各スタイルには、その画材を使う作家の手順どおりに、一筆ずつ絵ができあがる映像も付いている。ブランド用にひとつ選べば、その後のすべての絵が同じ手で描かれたように揃う。上の見本も、コンタクトシートそのものも、すべてこのリポジトリのコードで描かれている。+どのスタイルも、線の生み出し方がまったく違う。ペン先のしなり、水彩のにじみ、黒板チョークの擦れ、切り絵の破れた縁、リソグラフのドラムが作る網点、一本の彫り線が渦を巻いて月になる瞬間。同じ題材でも、32人の描き手がそれぞれ描いたように、スタイルごとに姿を変える。各スタイルには、その画材を使う作家の手順どおりに、一筆ずつ絵ができあがる映像も付いている。ブランド用にひとつ選べば、その後のすべての絵が同じ手で描かれたように揃う。上の見本も、コンタクトシートそのものも、すべてこのリポジトリのコードで描かれている。<details>-<summary><b>全31スタイル</b>と、それぞれの描き方</summary>+<summary><b>全32スタイル</b>と、それぞれの描き方</summary>| スタイル | 描き方 ||---|---|@@ -58,6 +58,7 @@ https://github.com/user-attachments/assets/1cf7f75c-b040-4c00-bf0c-cf1885f8b8da| **クレヨン** | 紙の凹みに色を残さない、蝋の走り描き || **切り紙コラージュ** | 破った紙と切った紙だけで構成し、線は描かない || **青写真** | サイアノタイプの紙に烏口で製図する |+| **夢の釉彩** | 樹脂で薄めた油彩の薄い重ね塗り。筆跡は見せず、輪郭はすべて硬く || **刺繍** | 刺繍枠に張ったリネンへ糸を縫い込む || **フラットベクター** | 粒子感と長い影を添えた、くっきりした幾何学形 || **民話の絵本** | 彩色した前景が、クリーム色の紙の鉛筆線へ溶けていく |@@ -160,7 +161,7 @@ https://github.com/user-attachments/assets/1cf7f75c-b040-4c00-bf0c-cf1885f8b8da| **SNSやチャット** | 終わりのないループ、GIF、透過背景のアニメーションスタンプを、フィードに合わせたサイズで。 || **資料やドキュメント** | ひとつのプログラムから生まれる、章ごとのイラストのファミリー。シード値を変えるだけで、同じスタイルの姉妹画像が手に入る。 || **物語** | 絵コンテやアニマティックから、オリジナルスコア付きの、長さを問わない完成映像へと育っていく。 |-| **手持ちの画像** | 絵を持ち込めば、そのスタイルで別の題材を描ける。写真を持ち込めば、31のどの画風でも、一筆ずつコードで描き直せる。 |+| **手持ちの画像** | 絵を持ち込めば、そのスタイルで別の題材を描ける。写真を持ち込めば、32のどの画風でも、一筆ずつコードで描き直せる。 || **ウェブページ** | カーソルを追い、クリックやフォームに反応し、スクロールに合わせて描き上がるインタラクティブなイラスト。 || **学習** | 絵の組み立て方を、注目すべき点やよくある間違いとともに教える作画手順シートとタイムラプス。 || **キャラクター** | 一度作ったキャラクターを、カットやポーズ、スタイルが変わっても同じ姿に保てる。 |@@ -174,7 +175,7 @@ https://github.com/user-attachments/assets/1cf7f75c-b040-4c00-bf0c-cf1885f8b8da- **物語**が、作品に意味を与える。一枚絵ならひとつのアイデアとひとつの主題。映画ならひとつの変化、ひとつの見せ場、そして繰り返し登場するモチーフがひとつ。→ [`storytelling.md`](skills/anidoodle/references/storytelling.md)- **リアリズム**は、名づけることから生まれる。解剖学的な構造、視点、そして開いた参考資料。それがあってはじめて、蝶は体と翅脈を持つ生き物として見えてくる。→ [`realism-and-craft.md`](skills/anidoodle/references/realism-and-craft.md)-- **スタイル**は、線そのものに宿る。31の完全なレシピ、案件ごとに選ぶためのガイド、そして自分だけのスタイルを生み出す手順。→ [`styles.md`](skills/anidoodle/references/styles.md)+- **スタイル**は、線そのものに宿る。32の完全なレシピ、案件ごとに選ぶためのガイド、そして自分だけのスタイルを生み出す手順。→ [`styles.md`](skills/anidoodle/references/styles.md)- **音楽**は、ジャンルの語彙から作品ごとに作曲し、コードで合成する。21のジャンル、バンドとオーケストラ一式、すべての長調と短調、セクションごとの情感、どんな長さにも合うテーマを備えている。→ [`music/README.md`](skills/anidoodle/references/music/README.md)- **決定性**が、その保証になる。純粋関数とシード付き乱数だから、ソースコードさえあれば誰でもまったく同じ作品を再構築できる。→ [`determinism-and-contract.md`](skills/anidoodle/references/determinism-and-contract.md)- **手法**が、スピードを保ってくれる。まず一枚の絵で見た目を確かめ、そのまま一気に作り上げ、間違えるとコストの高いところにだけ承認をかける。→ [`working-method.md`](skills/anidoodle/references/working-method.md)diff --git a/README.ko-KR.md b/README.ko-KR.mdindex 87ccbb9..9dfc556 100644--- a/README.ko-KR.md+++ b/README.ko-KR.md@@ -11,7 +11,7 @@ https://github.com/user-attachments/assets/1cf7f75c-b040-4c00-bf0c-cf1885f8b8da<p align="center"><strong>코드로 쓰는 손그림.</strong></p><p align="center">- 31가지 스타일로 만드는 일러스트, 그림 타임랩스, 영화, 설명 영상, 인터랙티브 웹 아트.<br>+ 32가지 스타일로 만드는 일러스트, 그림 타임랩스, 영화, 설명 영상, 인터랙티브 웹 아트.<br>모든 선은 함수이고 모든 음표는 연산이라, 같은 소스가<br>어떤 기기에서도, 어떤 크기로도, 언제까지나 같은 그림을 다시 그려내요.</p>@@ -28,7 +28,7 @@ https://github.com/user-attachments/assets/1cf7f75c-b040-4c00-bf0c-cf1885f8b8da<p align="center"><a href="README.md">English</a> · <a href="README.ja-JP.md">日本語</a> · <a href="README.zh-CN.md">简体中文</a> · <b>한국어</b> · <a href="README.fr-FR.md">Français</a> · <a href="README.es-ES.md">Español</a></p><p align="center">- <a href="#고를-수-있는-31가지-스타일">스타일</a> ·+ <a href="#고를-수-있는-32가지-스타일">스타일</a> ·<a href="#모든-스타일은-스스로-그려져요">그려지는 영상</a> ·<a href="#코드로-작곡한-음악">음악</a> ·<a href="#만들-수-있는-것">만들 수 있는 것</a> ·@@ -37,16 +37,16 @@ https://github.com/user-attachments/assets/1cf7f75c-b040-4c00-bf0c-cf1885f8b8da<a href="#시작하기">시작하기</a></p>-## 고를 수 있는 31가지 스타일+## 고를 수 있는 32가지 스타일<p align="center">- <img src="assets/styles.jpg" width="100%" alt="저마다 다른 스타일로 그린 31개 일러스트. 연필과 수채화, 마커 만화, 리소그래프부터 픽셀 아트, 장난감 블록, 목판화, 수묵화, 스크래치보드, 자수, 유화, 민담 그림책까지">+ <img src="assets/styles.jpg" width="100%" alt="저마다 다른 스타일로 그린 32개 일러스트. 연필과 수채화, 마커 만화, 리소그래프부터 픽셀 아트, 장난감 블록, 목판화, 수묵화, 스크래치보드, 자수, 유화, 민담 그림책까지"></p>-스타일마다 선을 긋는 방식이 달라요: 펜촉이 가늘어지는 모양, 물감이 번지는 자국, 분필이 슬레이트 위에서 스치는 질감, 색종이를 찢어낸 가장자리, 리소그래프 드럼의 망점, 그리고 한 줄의 새김선이 소용돌이치며 달이 되는 과정까지. 같은 소재도 손이 다르면 모양이 달라지는데, 마치 31명의 일러스트레이터가 각자 그린 것처럼요. 스타일마다 그 매체를 다루는 화가의 작업 순서대로, 그림이 한 획씩 완성되는 영상도 함께 들어 있어요. 브랜드에 맞는 스타일을 하나 고르면, 그 뒤로 나오는 모든 그림이 같은 손끝에서 나온 듯 일관돼요. 위의 모든 플레이트와 콘택트 시트 자체도 이 저장소 안의 코드로 그린 거예요.+스타일마다 선을 긋는 방식이 달라요: 펜촉이 가늘어지는 모양, 물감이 번지는 자국, 분필이 슬레이트 위에서 스치는 질감, 색종이를 찢어낸 가장자리, 리소그래프 드럼의 망점, 그리고 한 줄의 새김선이 소용돌이치며 달이 되는 과정까지. 같은 소재도 손이 다르면 모양이 달라지는데, 마치 32명의 일러스트레이터가 각자 그린 것처럼요. 스타일마다 그 매체를 다루는 화가의 작업 순서대로, 그림이 한 획씩 완성되는 영상도 함께 들어 있어요. 브랜드에 맞는 스타일을 하나 고르면, 그 뒤로 나오는 모든 그림이 같은 손끝에서 나온 듯 일관돼요. 위의 모든 플레이트와 콘택트 시트 자체도 이 저장소 안의 코드로 그린 거예요.<details>-<summary><b>31가지 스타일 모두</b>, 각각의 그리는 법</summary>+<summary><b>32가지 스타일 모두</b>, 각각의 그리는 법</summary>| 스타일 | 그리는 법 ||---|---|@@ -58,6 +58,7 @@ https://github.com/user-attachments/assets/1cf7f75c-b040-4c00-bf0c-cf1885f8b8da| **크레용** | 종이의 골짜기를 비워 두는 밀랍 낙서 || **오려 붙인 종이** | 찢고 자른 종이만 쓰고, 선은 그리지 않아요 || **시아노타입 청사진** | 청사진 종이에 제도펜으로 도면을 그려요 |+| **몽환 유약** | 수지로 묽게 한 유화를 얇게 겹쳐, 붓자국 없이 모든 윤곽을 또렷하게 || **자수** | 수틀에 끼운 리넨에 실을 한 땀씩 놓아요 || **플랫 벡터** | 입자감과 긴 그림자를 더한 또렷한 기하학적 모양 || **민담 그림책** | 채색한 전경이 크림색 종이의 연필 선으로 스며들어요 |@@ -160,7 +161,7 @@ https://github.com/user-attachments/assets/1cf7f75c-b040-4c00-bf0c-cf1885f8b8da| **소셜과 채팅** | 끊임없이 반복되는 루프, GIF, 투명 배경 애니메이션 스티커까지, 피드에 맞는 크기로. || **덱과 문서** | 하나의 프로그램에서 나온 한 세트의 섹션 일러스트. 시드값만 바꾸면 같은 스타일의 자매 이미지가 나와요. || **스토리** | 스토리보드와 애니매틱이 오리지널 스코어를 갖춘, 길이에 제한 없는 완성된 영화로 자라나요. |-| **내 이미지** | 그림을 가져오면 그 스타일로 새로운 소재를 그려요. 사진을 가져오면 31가지 화풍 중 하나로 다시 만들고, 모든 획을 코드로 그려요. |+| **내 이미지** | 그림을 가져오면 그 스타일로 새로운 소재를 그려요. 사진을 가져오면 32가지 화풍 중 하나로 다시 만들고, 모든 획을 코드로 그려요. || **웹페이지** | 커서를 따라 움직이고 클릭과 폼에 반응하며, 페이지를 스크롤하면 스스로 그려지는 인터랙티브 일러스트. || **학습** | 그림이 만들어지는 과정을 알려주는 단계별 시트와 타임랩스. 어디를 살펴봐야 하는지, 흔한 실수는 무엇인지도 배워요. || **캐릭터** | 한 번 만든 캐릭터를 장면과 포즈, 스타일이 달라져도 똑같이 유지해요. |@@ -174,7 +175,7 @@ https://github.com/user-attachments/assets/1cf7f75c-b040-4c00-bf0c-cf1885f8b8da- **스토리**는 모든 작품에 의미를 줘요. 스틸컷 하나에는 아이디어 하나와 초점이 되는 소재 하나, 영화에는 하나의 변화와 하나의 결말, 그리고 되돌아오는 상징 하나. → [`storytelling.md`](skills/anidoodle/references/storytelling.md)- **사실감**은 이름을 붙이는 데서 나와요. 해부 구조, 시점, 그리고 펼쳐본 레퍼런스까지 정확히 짚어야, 나비 한 마리도 몸과 날개맥을 가진 생명체로 읽혀요. → [`realism-and-craft.md`](skills/anidoodle/references/realism-and-craft.md)-- **스타일**은 선 하나하나에 깃들어요. 31가지 완전한 레시피, 작업에 맞게 하나를 고르는 가이드, 그리고 나만의 스타일을 만드는 방법까지. → [`styles.md`](skills/anidoodle/references/styles.md)+- **스타일**은 선 하나하나에 깃들어요. 32가지 완전한 레시피, 작업에 맞게 하나를 고르는 가이드, 그리고 나만의 스타일을 만드는 방법까지. → [`styles.md`](skills/anidoodle/references/styles.md)- **음악**은 장르의 어휘로 작품마다 작곡하고 코드로 합성해요. 21가지 장르, 밴드와 오케스트라 전체, 모든 장조와 단조, 구간별 분위기, 어떤 길이에도 맞는 테마까지 갖췄어요. → [`music/README.md`](skills/anidoodle/references/music/README.md)- **결정론**은 우리의 보증이에요. 순수 함수와 시드값 기반 난수를 쓰니까, 소스만 있으면 누구든 완전히 똑같은 작품을 다시 만들어낼 수 있어요. → [`determinism-and-contract.md`](skills/anidoodle/references/determinism-and-contract.md)- **작업 방식**이 속도를 지켜줘요. 스틸컷 하나로 룩을 먼저 검증하고, 그다음은 막힘없이 쭉 밀고 나가고, 틀렸을 때 비용이 큰 지점에서만 승인을 받는 식으로요. → [`working-method.md`](skills/anidoodle/references/working-method.md)diff --git a/README.md b/README.mdindex d047782..e98e0c8 100644--- a/README.md+++ b/README.md@@ -11,7 +11,7 @@ https://github.com/user-attachments/assets/1cf7f75c-b040-4c00-bf0c-cf1885f8b8da<p align="center"><strong>Hand-drawn art, written as code.</strong></p><p align="center">- Illustrations, drawing timelapses, films, explainers and interactive web art in 31 styles.<br>+ Illustrations, drawing timelapses, films, explainers and interactive web art in 32 styles.<br>Every mark is a function and every score is written, so the same source<br>redraws the same picture on every machine, at every size, for good.</p>@@ -28,7 +28,7 @@ https://github.com/user-attachments/assets/1cf7f75c-b040-4c00-bf0c-cf1885f8b8da<p align="center"><b>English</b> · <a href="README.ja-JP.md">日本語</a> · <a href="README.zh-CN.md">简体中文</a> · <a href="README.ko-KR.md">한국어</a> · <a href="README.fr-FR.md">Français</a> · <a href="README.es-ES.md">Español</a></p><p align="center">- <a href="#31-styles-to-choose-from">Styles</a> ·+ <a href="#32-styles-to-choose-from">Styles</a> ·<a href="#every-style-draws-itself">Drawing films</a> ·<a href="#music-composed-in-code">Music</a> ·<a href="#what-you-can-make">What you can make</a> ·@@ -37,16 +37,16 @@ https://github.com/user-attachments/assets/1cf7f75c-b040-4c00-bf0c-cf1885f8b8da<a href="#get-started">Get started</a></p>-## 31 styles to choose from+## 32 styles to choose from<p align="center">- <img src="assets/styles.jpg" width="100%" alt="31 illustrations, each in its own style, from pencil and watercolour, marker comic and risograph to pixel art, toy brick, woodcut, sumi-e, scratchboard, embroidery, painted oil and a folk-tale storybook">+ <img src="assets/styles.jpg" width="100%" alt="32 illustrations, each in its own style, from pencil and watercolour, marker comic and risograph to pixel art, toy brick, woodcut, sumi-e, scratchboard, embroidery, painted oil and a folk-tale storybook"></p>-Each style is its own way of making a mark: the taper of a nib, the bleed of a wash, the scumble of chalk on slate, the torn edge of cut paper, the halftone of a risograph drum, one engraved line spiralling out to become a moon. The subject changes shape in each hand, the way it would for thirty-one different illustrators. Every style also ships a film of its picture being drawn, mark by mark, in the order an artist in that medium works. Pick one for your brand and every picture after it arrives in the same hand. Every plate above, and the contact sheet itself, is drawn by code in this repo.+Each style is its own way of making a mark: the taper of a nib, the bleed of a wash, the scumble of chalk on slate, the torn edge of cut paper, the halftone of a risograph drum, one engraved line spiralling out to become a moon. The subject changes shape in each hand, the way it would for 32 different illustrators. Every style also ships a film of its picture being drawn, mark by mark, in the order an artist in that medium works. Pick one for your brand and every picture after it arrives in the same hand. Every plate above, and the contact sheet itself, is drawn by code in this repo.<details>-<summary><b>All 31 styles</b>, and how each one is made</summary>+<summary><b>All 32 styles</b>, and how each one is made</summary>| Style | How it's made ||---|---|@@ -58,6 +58,7 @@ Each style is its own way of making a mark: the taper of a nib, the bleed of a w| **Crayon** | Waxy scribble fills that skip the paper's valleys || **Cut-paper collage** | Torn and cut paper, no drawn lines || **Cyanotype blueprint** | Ruling-pen drafting on a cyanotype sheet |+| **Dream glaze** | Thin resin-oil glazes, no visible stroke, every edge hard || **Embroidery** | Thread stitched through linen in a hoop || **Flat vector** | Crisp geometric shapes with grain and long shadows || **Folk-tale storybook** | Painted foreground dissolving into pencil line on cream paper |@@ -167,7 +168,7 @@ Ask how to draw something, or bring a drawing, and anidoodle rebuilds it as a le| **Social and chat** | Endless loops, GIFs and transparent animated stickers, sized for the feed. || **Decks and docs** | A family of section illustrations from one program. A new seed gives a sister image in the same style. || **Stories** | Storyboards and animatics that grow into a finished film of any length, with an original score. |-| **Your own image** | Bring a picture and get its style on a new subject, or bring a photo and get it recreated in any of the 31 hands, every mark drawn in code. |+| **Your own image** | Bring a picture and get its style on a new subject, or bring a photo and get it recreated in any of the 32 hands, every mark drawn in code. || **Web pages** | Interactive illustrations that watch the cursor, react to clicks and forms, or draw themselves as the page scrolls. || **Learning** | Drawing lessons: step sheets and timelapses that teach how a picture is built, with what to look for and the common mistakes. || **Characters** | One character, built once and kept identical across shots, poses and styles. |diff --git a/README.zh-CN.md b/README.zh-CN.mdindex e903a45..1248d53 100644--- a/README.zh-CN.md+++ b/README.zh-CN.md@@ -11,7 +11,7 @@ https://github.com/user-attachments/assets/1cf7f75c-b040-4c00-bf0c-cf1885f8b8da<p align="center"><strong>手绘的艺术,用代码写成。</strong></p><p align="center">- 插画、绘画延时视频、影片、讲解视频和互动网页艺术,31 种风格任你挑选。<br>+ 插画、绘画延时视频、影片、讲解视频和互动网页艺术,32 种风格任你挑选。<br>每一笔都是一个函数,每一个音符都是一次算术运算,于是同一份源码<br>在任何机器、任何尺寸下,都会重新画出同一张画,永远如此。</p>@@ -28,7 +28,7 @@ https://github.com/user-attachments/assets/1cf7f75c-b040-4c00-bf0c-cf1885f8b8da<p align="center"><a href="README.md">English</a> · <a href="README.ja-JP.md">日本語</a> · <b>简体中文</b> · <a href="README.ko-KR.md">한국어</a> · <a href="README.fr-FR.md">Français</a> · <a href="README.es-ES.md">Español</a></p><p align="center">- <a href="#31-种风格随你挑选">风格</a> ·+ <a href="#32-种风格随你挑选">风格</a> ·<a href="#每种风格都会自己画出来">作画影片</a> ·<a href="#用代码谱写音乐">音乐</a> ·<a href="#你能做出什么">你能做出什么</a> ·@@ -37,16 +37,16 @@ https://github.com/user-attachments/assets/1cf7f75c-b040-4c00-bf0c-cf1885f8b8da<a href="#开始使用">开始使用</a></p>-## 31 种风格,随你挑选+## 32 种风格,随你挑选<p align="center">- <img src="assets/styles.jpg" width="100%" alt="31 幅各具风格的插画,从铅笔水彩、马克笔漫画和孔版印刷,到像素画、玩具积木、木刻、墨绘、刮画、刺绣、油画和民间故事绘本">+ <img src="assets/styles.jpg" width="100%" alt="32 幅各具风格的插画,从铅笔水彩、马克笔漫画和孔版印刷,到像素画、玩具积木、木刻、墨绘、刮画、刺绣、油画和民间故事绘本"></p>-每种风格都有自己独特的落笔方式:笔尖的收锋、水彩的晕染、粉笔在石板上的揉擦、剪纸边缘的撕裂感、孔版印刷滚筒的网点、一条雕刻线螺旋展开变成一轮月亮。同一个主题,在不同的风格里会呈现出完全不同的样子,就像出自 31 位不同插画师之手。每种风格还附有一段影片,按使用这种媒介的画家实际作画的顺序,逐笔展示画面如何诞生。为你的品牌选定一种风格,之后的每一张画都会出自同一双手。上面的每一幅样图,连同这张对照表本身,都是这个仓库里的代码画出来的。+每种风格都有自己独特的落笔方式:笔尖的收锋、水彩的晕染、粉笔在石板上的揉擦、剪纸边缘的撕裂感、孔版印刷滚筒的网点、一条雕刻线螺旋展开变成一轮月亮。同一个主题,在不同的风格里会呈现出完全不同的样子,就像出自 32 位不同插画师之手。每种风格还附有一段影片,按使用这种媒介的画家实际作画的顺序,逐笔展示画面如何诞生。为你的品牌选定一种风格,之后的每一张画都会出自同一双手。上面的每一幅样图,连同这张对照表本身,都是这个仓库里的代码画出来的。<details>-<summary><b>全部 31 种风格</b>,以及它们的画法</summary>+<summary><b>全部 32 种风格</b>,以及它们的画法</summary>| 风格 | 画法 ||---|---|@@ -58,6 +58,7 @@ https://github.com/user-attachments/assets/1cf7f75c-b040-4c00-bf0c-cf1885f8b8da| **蜡笔** | 蜡质涂鸦掠过纸面的凹处 || **剪纸拼贴** | 撕纸与剪纸拼成画面,不画线条 || **蓝晒蓝图** | 在蓝晒纸上用鸭嘴笔绘制技术图 |+| **梦境釉彩** | 用树脂稀释的油彩薄涂罩染,不见笔触,轮廓一律分明 || **刺绣** | 在绣绷里的亚麻布上穿针走线 || **扁平矢量** | 清晰的几何形状,带颗粒感和长投影 || **民间故事绘本** | 彩绘前景逐渐融入米色纸上的铅笔线 |@@ -160,7 +161,7 @@ https://github.com/user-attachments/assets/1cf7f75c-b040-4c00-bf0c-cf1885f8b8da| **社交和聊天** | 无限循环的动图、GIF,以及适配信息流尺寸的透明动态贴纸。 || **幻灯片和文档** | 一个程序生成一整套章节插画。换个种子,就能得到风格相同的姊妹图。 || **故事** | 分镜和动态预览,一步步长成一部任意时长、配有原创配乐的完整影片。 |-| **你自己的图片** | 带来一张画,就能用它的风格画新主题;带来一张照片,就能用 31 种画风中的任意一种重新创作,每一笔都由代码绘制。 |+| **你自己的图片** | 带来一张画,就能用它的风格画新主题;带来一张照片,就能用 32 种画风中的任意一种重新创作,每一笔都由代码绘制。 || **网页** | 会追随光标、响应点击和表单,或随着页面滚动自行绘制的互动插画。 || **学习** | 用分步图和延时视频教你一幅画如何完成,还会指出该看什么、常见错误有哪些。 || **角色** | 一个角色只需构建一次,在不同镜头、姿势和风格中始终保持一致。 |@@ -174,7 +175,7 @@ https://github.com/user-attachments/assets/1cf7f75c-b040-4c00-bf0c-cf1885f8b8da- **故事**,让每件作品都有一个重点。一张静态图只讲一个想法、聚焦一个主体;一部短片只有一次转变、一个高潮,和一个反复出现的意象。→ [`storytelling.md`](skills/anidoodle/references/storytelling.md)- **写实感**,来自把它说清楚。解剖结构、观察视角,以及你参考过的资料,都要交代明白,这样一只蝴蝶读起来才像是一个有身体、有翅脉的真实生物。→ [`realism-and-craft.md`](skills/anidoodle/references/realism-and-craft.md)-- **风格**,活在笔触里。31 套完整配方,外加一份按场合挑风格的指南,以及自创风格的步骤。→ [`styles.md`](skills/anidoodle/references/styles.md)+- **风格**,活在笔触里。32 套完整配方,外加一份按场合挑风格的指南,以及自创风格的步骤。→ [`styles.md`](skills/anidoodle/references/styles.md)- **音乐**,依照某种曲风的词汇为每件作品作曲,再由代码合成:21 种曲风、完整的乐队和管弦乐团、所有大小调、每个段落各自的情绪,以及能适配任意时长的主题旋律。→ [`music/README.md`](skills/anidoodle/references/music/README.md)- **确定性**,是这套系统的承诺。纯函数加上带种子的随机数,任何人拿到源码都能重建出一模一样的作品。→ [`determinism-and-contract.md`](skills/anidoodle/references/determinism-and-contract.md)- **方法**,让你保持速度。先用一张静态图验证效果,再一路做到底,把审批环节留给那些出错代价高的地方。→ [`working-method.md`](skills/anidoodle/references/working-method.md)diff --git a/assets/styles.jpg b/assets/styles.jpgindex d22375c..29ef0e4 100644Binary files a/assets/styles.jpg and b/assets/styles.jpg differdiff --git a/plugins/anidoodle/.claude-plugin/plugin.json b/plugins/anidoodle/.claude-plugin/plugin.jsonindex a13ad44..575c0fe 100644--- a/plugins/anidoodle/.claude-plugin/plugin.json+++ b/plugins/anidoodle/.claude-plugin/plugin.json@@ -1,8 +1,8 @@{"name": "anidoodle","displayName": "anidoodle",- "description": "Code-drawn stills, drawing timelapses, films, explainers and interactive web animations in 31 styles, with scores composed in code.",- "version": "0.6.4",+ "description": "Code-drawn stills, drawing timelapses, films, explainers and interactive web animations in 32 styles, with scores composed in code.",+ "version": "0.7.0","icon": "./assets/icon.png","author": {"name": "Alex Greenshpun",diff --git a/plugins/anidoodle/.codex-plugin/plugin.json b/plugins/anidoodle/.codex-plugin/plugin.jsonindex 712800f..0c6e9ab 100644--- a/plugins/anidoodle/.codex-plugin/plugin.json+++ b/plugins/anidoodle/.codex-plugin/plugin.json@@ -1,12 +1,12 @@{"name": "anidoodle",- "version": "0.6.4",- "description": "Code-drawn stills, drawing timelapses, films, explainers and interactive web animations in 31 styles, with scores composed in code.",+ "version": "0.7.0",+ "description": "Code-drawn stills, drawing timelapses, films, explainers and interactive web animations in 32 styles, with scores composed in code.","skills": "./skills/","interface": {"displayName": "anidoodle","shortDescription": "Hand-drawn art, written as code.",- "longDescription": "Illustrations, drawing timelapses, films of any length, explainers, infographics and interactive web animations in 31 hand-made styles, with original scores composed as data and played by an engine written in code. Match a style from your image, recreate a photo in any style, keep a character consistent, or learn how a drawing is built. Every render is deterministic, with no generated assets.",+ "longDescription": "Illustrations, drawing timelapses, films of any length, explainers, infographics and interactive web animations in 32 hand-made styles, with original scores composed as data and played by an engine written in code. Match a style from your image, recreate a photo in any style, keep a character consistent, or learn how a drawing is built. Every render is deterministic, with no generated assets.","developerName": "Alex Greenshpun","category": "Creativity","capabilities": [diff --git a/plugins/anidoodle/README.md b/plugins/anidoodle/README.mdindex 3658bae..76858a4 100644--- a/plugins/anidoodle/README.md+++ b/plugins/anidoodle/README.md@@ -2,7 +2,7 @@**Hand-drawn art, written as code.**-anidoodle makes illustrations, drawing timelapses, films of any length, explainers, infographics and interactive web animations in 31 hand-made styles, with original music composed as data and played by an engine written in code. Ask for a picture in plain words, match a style from your own image, recreate a photo in any style, keep a character consistent across scenes, or learn step by step how a drawing is built.+anidoodle makes illustrations, drawing timelapses, films of any length, explainers, infographics and interactive web animations in 32 hand-made styles, with original music composed as data and played by an engine written in code. Ask for a picture in plain words, match a style from your own image, recreate a photo in any style, keep a character consistent across scenes, or learn step by step how a drawing is built.Music is composed for each piece from 21 genre vocabularies, never presets, and played by a sound engine written in code: a piano modelled on a real Steinway, Rhodes and Wurlitzer, orchestral sections and choir, guitars, real drum kits, real lo-fi, a full mix with reverb. An optional sound pack adds recordings of eight real acoustic instruments and three recorded rooms; every score plays without it. `music.mjs check` clears a score (key, loudness, balance, novelty) before anyone listens. The launch kit turns your product's prompts, screens and install lines into a launch film in four shapes (16:9, 1:1, 4:5, 9:16), with sound cued from the picture, captions and a sync check; `launch.mjs new` starts one and `launch.mjs ship` delivers every shape.diff --git a/plugins/anidoodle/skills/anidoodle/SKILL.md b/plugins/anidoodle/skills/anidoodle/SKILL.mdindex 8a12dac..03f2a5b 100644--- a/plugins/anidoodle/skills/anidoodle/SKILL.md+++ b/plugins/anidoodle/skills/anidoodle/SKILL.md@@ -1,6 +1,6 @@---name: anidoodle-description: Code-drawn stills, drawing timelapses, films, explainers and interactive web animations in 31 styles, with composed scores. Matches a reference style, keeps characters consistent, teaches drawing. Deterministic, no generated assets.+description: Code-drawn stills, drawing timelapses, films, explainers and interactive web animations in 32 styles, with composed scores. Matches a reference style, keeps characters consistent, teaches drawing. Deterministic, no generated assets.metadata:created_by: Alex Greenshpun (10x Company)license: Apache-2.0diff --git a/plugins/anidoodle/skills/anidoodle/engine/package.json b/plugins/anidoodle/skills/anidoodle/engine/package.jsonindex a7ad999..46c992b 100644--- a/plugins/anidoodle/skills/anidoodle/engine/package.json+++ b/plugins/anidoodle/skills/anidoodle/engine/package.json@@ -1,6 +1,6 @@{"name": "anidoodle-engine",- "version": "0.6.4",+ "version": "0.7.0","private": true,"type": "module","description": "Portable art core + backend adapters for illustrations, animations and films drawn entirely in code.",diff --git a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/dreamGlaze.ts b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/dreamGlaze.tsnew file mode 100644index 0000000..9a01dbb--- /dev/null+++ b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/dreamGlaze.ts@@ -0,0 +1,371 @@+import { Gfx, PENCIL, rng, type Ctx, type Env } from "./core";+import { weave } from "./paintedOilKit";+import { Film } from "./film";++// SOFT SELF-PORTRAIT HELD UP BY ITS QUESTIONS · resin-oil glazes, a very small brush.+//+// MEDIUM, physically: oil thinned with resin, laid in thin glazes with a tiny soft brush on a+// smooth white ground. THE MARK: none that shows. A form is turned by value steps too fine to+// see, so the unit here is the single pixel, each one lit by the one sun; nothing is a stroke.+// THE EDGE: hard, near and far alike. Depth is haze and scale, never blur.+// ORDER: sky and plain as smooth grounds; forms modelled dark to light; cast shadows; last the+// small sharp accents (lashes, the mouth line, the handwriting, the stars in the window).+// PALETTE: ultramarine falling through turquoise to lemon at the horizon; an ochre and umber+// plain; waxy flesh; violet-umber shadows; one orange, kept for the spark.+// LIGHT: one low sun, front-left and a little above. Everything is lit from it; every shadow+// falls right and away toward the horizon.+// SUBJECT and STRUCTURE: a hollow mask of a calm face, eyes closed, frontal, leaning five degrees.+// Proportions are the face's thirds (brow, nose base, chin), eyes one eye-width apart, the nose as+// wide as an eye, the mouth a third of the way down the lowest third. The crown is cut open. A+// window is cut in the forehead with a night sky and one spark inside. The right cheek runs out+// into a soft scroll of handwriting. Two question marks hold it up; their stems stop short of+// their dots. The same mask repeats to the horizon.+// NOT: `paintedOil` shows its bristle and loses its edges; this hand hides the brush and keeps+// every edge. No composition, figure or prop from any existing painting is re-staged.++export const W = 1600, H = 2000;+export const cl = (v: number, a = 0, b = 1) => (v < a ? a : v > b ? b : v);+export const sm = (a: number, b: number, x: number) => { const t = cl((x - a) / (b - a)); return t * t * (3 - 2 * t); };+export const G = (du: number, dv: number, su: number, sv: number) => Math.exp(-(du * du) / (su * su) - (dv * dv) / (sv * sv));++// ---------------------------------------------------------------- noise (pure arithmetic)+export const hash2 = (ix: number, iy: number, seed: number) => { let h = Math.imul(ix, 374761393) ^ Math.imul(iy, 668265263) ^ Math.imul(seed + 1, 1442695041); h = Math.imul(h ^ (h >>> 13), 1274126177); return ((h ^ (h >>> 16)) >>> 0) / 4294967296; };+export const vnoise = (x: number, y: number, seed: number) => { const x0 = Math.floor(x), y0 = Math.floor(y), fx = x - x0, fy = y - y0, sx = fx * fx * (3 - 2 * fx), sy = fy * fy * (3 - 2 * fy); const a = hash2(x0, y0, seed), b = hash2(x0 + 1, y0, seed), c = hash2(x0, y0 + 1, seed), d = hash2(x0 + 1, y0 + 1, seed); return a + (b - a) * sx + (c - a + (a - b - c + d) * sx) * sy; };+export const fbm = (x: number, y: number, oct: number, seed: number) => { let s = 0, a = 0.5, n = 0; for (let o = 0; o < oct; o++) { s += vnoise(x, y, seed + o * 17) * a; n += a; a *= 0.5; x *= 2.03; y *= 2.03; } return s / n; };++// ---------------------------------------------------------------- colour+export type C3 = [number, number, number];+export const hex = (h: string): C3 => [parseInt(h.slice(1, 3), 16), parseInt(h.slice(3, 5), 16), parseInt(h.slice(5, 7), 16)];+export const lin = (h: string): C3 => hex(h).map((v) => Math.pow(v / 255, 2.2)) as C3;+export const ramp = (stops: [number, C3][], t: number, out: C3) => { if (t <= stops[0][0]) { out[0] = stops[0][1][0]; out[1] = stops[0][1][1]; out[2] = stops[0][1][2]; return; } for (let i = 1; i < stops.length; i++) if (t <= stops[i][0]) { const [t0, a] = stops[i - 1], [t1, b] = stops[i], f = (t - t0) / (t1 - t0); out[0] = a[0] + (b[0] - a[0]) * f; out[1] = a[1] + (b[1] - a[1]) * f; out[2] = a[2] + (b[2] - a[2]) * f; return; } const l = stops[stops.length - 1][1]; out[0] = l[0]; out[1] = l[1]; out[2] = l[2]; };+const SKY: [number, C3][] = [[0, hex("#0d2450")], [0.26, hex("#1f4f8c")], [0.5, hex("#4a8dba")], [0.7, hex("#8fc2bd")], [0.86, hex("#dcd9a4")], [0.95, hex("#f1d491")], [1, hex("#f4c486")]];+export const GROUND: [number, C3][] = [[0, hex("#8f5f2c")], [0.3, hex("#b98646")], [0.62, hex("#d6b170")], [1, hex("#ecd7a4")]];++// ---------------------------------------------------------------- the space+// A pinhole camera 1.6 units above an endless plain. The horizon sits at 65 % of the height.+export const YH = 1300, F = 1800, CAMH = 1.6, CX = 800;+const n3 = (v: number[]) => { const l = Math.hypot(v[0], v[1], v[2]); return [v[0] / l, v[1] / l, v[2] / l]; };+export const LW = n3([-0.6, 0.42, -0.68]); // to the sun, world: x right, y up, z into the picture+export const LS = [LW[0], -LW[1], -LW[2]]; // the same, screen: x right, y down, z toward the eye+const LXY = Math.hypot(LS[0], LS[1]), LDX = LS[0] / LXY, LDY = LS[1] / LXY, RISE = LS[2] / LXY;+const HV = n3([LS[0], LS[1], LS[2] + 1]); // half vector, for the wet highlight+const SUN = [1.3, 1.1, 0.8], SKYL = [0.3, 0.44, 0.8], BNC = [0.85, 0.46, 0.18];+// the main group stands where its dots touch the plain+export const AX0 = 678, AY0 = 1570, Z0 = (F * CAMH) / (AY0 - YH);+// the same mask, further and further off: [depth, screen x of the dot]+export const COPIES: [number, number][] = [[430, 506], [215, 446], [104, 336], [50, 118]];++// ---------------------------------------------------------------- the face, a height field+// u across (half width 0.5 at the cheekbones), v down (brow -0.235, nose base 0.235, chin 0.70).+export const MX = 640, MY = 730, S = 600, TILT = (-5 * Math.PI) / 180, CT = Math.cos(TILT), ST = Math.sin(TILT);+const MBASE = 60;+export const halfW = (v: number) => { if (v < -0.05) { const t = (-v - 0.05) / 0.5; return 0.5 - 0.045 * t * t; } const t = cl((v + 0.05) / 0.75); return 0.5 * Math.pow(Math.max(0, 1 - Math.pow(t, 2.2)), 0.55); };+export const WIN = { u0: -0.1, u1: 0.1, v0: -0.485, v1: -0.345, wall: 0.017 };+export const mouthLine = (u: number) => 0.405 - 0.019 * (u / 0.16) * (u / 0.16) + 0.006 * Math.exp(-(u * u) / 0.0009);+export const lashLine = (au: number) => { const x = (au - 0.218) / 0.095; return -0.094 - 0.026 * x * x; };+const faceH = (u: number, v: number) => {+ const au = Math.abs(u), a = halfW(v);+ let q = a > 0.001 ? 1 - (u / a) * (u / a) : 0; if (q < 0) q = 0;+ const da = (halfW(v + 0.004) - a) / 0.004, dA = (a - Math.sqrt(u * u + 0.0049)) / Math.sqrt(1 + da * da), dB = (0.7 - v) * 0.9, hm = cl(0.5 + (0.5 * (dB - dA)) / 0.12), de = cl((dB + (dA - dB) * hm - 0.12 * hm * (1 - hm)) / 0.34), bev = Math.sqrt(1 - (1 - de) * (1 - de));+ let hb = 0.2 * bev + 0.17 * Math.pow(q, 0.5) * (1 - sm(0.22, 0.62, v)); // a shell rounded in from its edge, fuller across the cheekbones+ const tf = cl((-0.25 - v) / 0.45); hb *= 1 - 0.22 * tf * tf; // the forehead rolls back+ let f = 0;+ const bv = -0.255 + 0.55 * (au - 0.2) * (au - 0.2);+ f += 0.048 * G(au - 0.21, v - bv, 0.17, 0.048); // brow ridge, arched+ f -= 0.082 * G(au - 0.215, v + 0.135, 0.115, 0.072); // the orbit+ f -= 0.035 * G(au - 0.105, v + 0.125, 0.05, 0.065); // deeper by the nose+ f += 0.062 * G(au - 0.218, v + 0.118, 0.088, 0.048); // the closed lid over the eyeball+ const lx = (au - 0.218) / 0.095;+ if (lx > -1.3 && lx < 1.3) { const fade = 1 - sm(0.95, 1.25, Math.abs(lx)); f -= 0.011 * Math.exp(-Math.pow((v - lashLine(au)) / 0.008, 2)) * fade; f -= 0.006 * Math.exp(-Math.pow((v - (-0.152 + 0.03 * lx * lx)) / 0.009, 2)) * fade; }+ const tn = (v + 0.22) / 0.44; // 0 at the root, 1 at the tip+ if (tn > -0.3 && tn < 1.2) { const t = cl(tn), nh = 0.03 + 0.15 * Math.pow(t, 1.4), sg = 0.029 + 0.027 * t; f += nh * Math.exp(-(u * u) / (sg * sg)) * sm(-0.3, 0.1, tn) * (1 - sm(0.97, 1.13, tn)); }+ f += 0.05 * G(u, v - 0.188, 0.05, 0.046); // the ball of the tip+ f += 0.058 * G(au - 0.084, v - 0.203, 0.034, 0.034); f -= 0.014 * G(au - 0.125, v - 0.19, 0.02, 0.035); // the wings+ f += 0.045 * G(au - 0.33, v - 0.02, 0.15, 0.13); // cheekbones+ f += 0.035 * G(u, v - 0.41, 0.21, 0.13); // the muzzle the mouth sits on+ f -= 0.01 * G(u, v - 0.305, 0.02, 0.045); // philtrum+ f += 0.04 * G(u, v - 0.372, 0.125, 0.026) * (1 - 0.35 * Math.exp(-(u * u) / 0.0005)); // upper lip and its bow+ f += 0.052 * G(u, v - 0.438, 0.1, 0.034); // lower lip+ f -= 0.035 * Math.exp(-Math.pow((v - mouthLine(u)) / 0.01, 2)) * (1 - sm(0.14, 0.175, au)); // the mouth line+ f -= 0.02 * G(au - 0.165, v - 0.395, 0.025, 0.025); // its corners+ f -= 0.028 * G(u, v - 0.5, 0.11, 0.03); // the fold above the chin+ f += 0.066 * G(u, v - 0.59, 0.14, 0.085); // chin+ return hb + f * sm(0, 0.22, q);+};+export const RIMW = 0.4455;+export const crown = (u: number) => -0.6 + (0.03 * Math.sin(u * 9 + 1) + 0.018 * Math.sin(u * 23 + 2) + 0.01 * Math.sin(u * 51)) * Math.max(0, 1 - Math.pow(u / RIMW, 6));++// ---------------------------------------------------------------- curves: question marks and the scroll+export type Curve = { x: Float32Array; y: Float32Array; r: Float32Array; s: Float32Array; k: Float32Array; n: number };+const curve = (cp: number[][], per = 14): Curve => {+ const xs: number[] = [], ys: number[] = [], rs: number[] = [], g = (i: number) => cp[Math.max(0, Math.min(cp.length - 1, i))];+ for (let i = 0; i < cp.length - 1; i++) for (let j = 0; j < per; j++) { const t = j / per, p0 = g(i - 1), p1 = g(i), p2 = g(i + 1), p3 = g(i + 2), cr = (k: number) => 0.5 * (2 * p1[k] + (-p0[k] + p2[k]) * t + (2 * p0[k] - 5 * p1[k] + 4 * p2[k] - p3[k]) * t * t + (-p0[k] + 3 * p1[k] - 3 * p2[k] + p3[k]) * t * t * t); xs.push(cr(0)); ys.push(cr(1)); rs.push(cr(2)); }+ const e = cp[cp.length - 1]; xs.push(e[0]); ys.push(e[1]); rs.push(e[2]);+ const n = xs.length, s = new Float32Array(n), k = new Float32Array(n);+ for (let i = 1; i < n; i++) s[i] = s[i - 1] + Math.hypot(xs[i] - xs[i - 1], ys[i] - ys[i - 1]);+ for (let i = 1; i < n - 1; i++) { const a1 = Math.atan2(ys[i] - ys[i - 1], xs[i] - xs[i - 1]), a2 = Math.atan2(ys[i + 1] - ys[i], xs[i + 1] - xs[i]); let d = a2 - a1; while (d > Math.PI) d -= 2 * Math.PI; while (d < -Math.PI) d += 2 * Math.PI; k[i] = d / Math.max(1e-3, (s[i + 1] - s[i - 1]) / 2); }+ return { x: Float32Array.from(xs), y: Float32Array.from(ys), r: Float32Array.from(rs), s, k, n };+};+// nearest point on a curve: distance, arc length, radius there, side (+ is right of travel), curvature+const NR = { d: 0, s: 0, r: 0, side: 0, k: 0 };+const near = (c: Curve, px: number, py: number) => {+ let best = 1e18, bi = 0, bt = 0;+ for (let i = 0; i < c.n - 1; i++) { const ax = c.x[i], ay = c.y[i], dx = c.x[i + 1] - ax, dy = c.y[i + 1] - ay, l2 = dx * dx + dy * dy; let t = l2 > 0 ? ((px - ax) * dx + (py - ay) * dy) / l2 : 0; t = t < 0 ? 0 : t > 1 ? 1 : t; const ex = px - ax - dx * t, ey = py - ay - dy * t, d2 = ex * ex + ey * ey; if (d2 < best) { best = d2; bi = i; bt = t; } }+ const dx = c.x[bi + 1] - c.x[bi], dy = c.y[bi + 1] - c.y[bi];+ NR.d = Math.sqrt(best); NR.s = c.s[bi] + (c.s[bi + 1] - c.s[bi]) * bt; NR.r = c.r[bi] + (c.r[bi + 1] - c.r[bi]) * bt; NR.k = c.k[bi] + (c.k[bi + 1] - c.k[bi]) * bt;+ NR.side = dx * (py - c.y[bi]) - dy * (px - c.x[bi]) >= 0 ? 1 : -1;+};+// [x, y, radius]: a hook that cradles, a stem that stops short, a dot on the ground+export const Q1 = curve([[578, 1226, 8], [588, 1184, 13], [634, 1154, 19], [698, 1150, 22], [750, 1184, 22], [760, 1244, 20], [724, 1300, 17], [688, 1346, 14], [678, 1400, 12], [678, 1456, 9]]);+export const Q2 = curve([[1128, 1082, 7], [1138, 1036, 12], [1184, 1002, 17], [1240, 1002, 19], [1272, 1042, 19], [1268, 1102, 17], [1236, 1152, 15], [1212, 1204, 13], [1208, 1300, 11], [1208, 1446, 8]]);+export const DOT1 = [678, 1540, 30], DOT2 = [1208, 1538, 25];+// the scroll: [x, y, half width]. It leaves the cheek, lies along the second hook, and hangs.+export const SCROLL = curve([[800, 705, 118], [900, 742, 104], [1000, 806, 88], [1100, 868, 76], [1196, 908, 70], [1280, 926, 66], [1340, 976, 60], [1366, 1060, 54], [1366, 1160, 48], [1350, 1260, 42], [1352, 1350, 34], [1368, 1420, 26]], 16);+const SLEN = SCROLL.s[SCROLL.n - 1];++// ---------------------------------------------------------------- objects, back to front+// Each returns: edge distance in px (+ inside), height toward the eye in px, two coordinates the+// painter needs, and which material it is.+export type Obj = { box: [number, number, number, number]; at: (x: number, y: number, o: Float32Array) => void };+export const M_FLESH = 1, M_NIGHT = 2, M_WALL = 3, M_WOOD = 4, M_SCROLL = 5;+const tube = (c: Curve, pad: number): Obj => { let x0 = 1e9, y0 = 1e9, x1 = -1e9, y1 = -1e9; for (let i = 0; i < c.n; i++) { x0 = Math.min(x0, c.x[i] - c.r[i]); x1 = Math.max(x1, c.x[i] + c.r[i]); y0 = Math.min(y0, c.y[i] - c.r[i]); y1 = Math.max(y1, c.y[i] + c.r[i]); } return { box: [x0 - pad, y0 - pad, x1 + pad, y1 + pad], at: (x, y, o) => { near(c, x, y); const r = NR.r, d = NR.d; o[0] = r - d; o[1] = d < r ? Math.sqrt(r * r - d * d) : 0; o[2] = NR.s; o[3] = d * NR.side; o[4] = M_WOOD; } }; };+const ball = (b: number[]): Obj => ({ box: [b[0] - b[2] - 3, b[1] - b[2] - 3, b[0] + b[2] + 3, b[1] + b[2] + 3], at: (x, y, o) => { const d = Math.hypot(x - b[0], y - b[1]), r = b[2]; o[0] = r - d; o[1] = d < r ? Math.sqrt(r * r - d * d) : 0; o[2] = x * 0.6; o[3] = y - b[1]; o[4] = M_WOOD; } });+export const scrollW = (s: number, r: number) => { const e = SLEN - s; return e < 40 ? r * Math.sqrt(Math.max(0, 1 - Math.pow(1 - e / 40, 2))) : r; };+const scroll: Obj = { box: [680, 560, 1440, 1460], at: (x, y, o) => {+ near(SCROLL, x, y); const w = scrollW(NR.s, NR.r), d = NR.d, q = Math.max(0, 1 - (d / Math.max(1, w)) * (d / Math.max(1, w)));+ // where it bends it wrinkles on the inside of the bend, as soft matter does+ const bend = cl(Math.abs(NR.k) * 90), inner = 0.5 + 0.5 * cl((NR.side * Math.sign(NR.k) * d) / Math.max(1, w), -1, 1);+ o[0] = NR.s <= 0.5 || NR.s >= SLEN - 0.01 ? Math.min(w - d, -1) + (NR.s >= SLEN - 0.01 && d < 1 ? 1 : 0) : w - d;+ o[1] = 22 + 15 * Math.pow(q, 0.5) + 3.2 * Math.sin(NR.s * 0.19) * bend * inner + 2 * Math.sin(NR.s * 0.021 + 1) * q;+ o[2] = NR.s; o[3] = d * NR.side; o[4] = M_SCROLL;+} };+const mask: Obj = { box: [MX - 0.56 * S, MY - 0.76 * S, MX + 0.56 * S, MY + 0.76 * S], at: (x, y, o) => {+ const X = (x - MX) / S, Y = (y - MY) / S, u = X * CT + Y * ST, v = -X * ST + Y * CT, a = halfW(v), da = (halfW(v + 0.004) - a) / 0.004;+ let e = ((a - Math.abs(u)) * S) / Math.sqrt(1 + da * da);+ const front = (v - crown(u)) * S * 0.92;+ e = Math.min(e, front, (0.699 - v) * S);+ const h = MBASE + faceH(u, v) * S;+ o[1] = h; o[2] = u; o[3] = v; o[4] = M_FLESH;+ if (u > WIN.u0 && u < WIN.u1 && v > WIN.v0 && v < WIN.v1) { // the window in the forehead+ const open = u > WIN.u0 + WIN.wall && v > WIN.v0 + WIN.wall; // we look up into it from the right: left and top walls show+ o[4] = open ? M_NIGHT : M_WALL; o[1] = h - (open ? 26 : 12);+ }+ o[0] = e;+} };+export const M_INSIDE = 6;+export const backRim = (u: number) => -0.6 - 0.085 * Math.sqrt(Math.max(0, 1 - (u / RIMW) * (u / RIMW)));+// above the cut we look down into the shell and see its far wall from inside+const inside: Obj = { box: [MX - 0.56 * S, MY - 0.76 * S, MX + 0.56 * S, MY - 0.5 * S], at: (x, y, o) => {+ const X = (x - MX) / S, Y = (y - MY) / S, u = X * CT + Y * ST, v = -X * ST + Y * CT, cu = Math.sqrt(Math.max(0, 1 - (u / RIMW) * (u / RIMW)));+ o[0] = Math.min((v - backRim(u)) * S, (RIMW - Math.abs(u)) * S, (crown(u) + 0.02 - v) * S); o[1] = MBASE - 30 - 60 * cu; o[2] = u; o[3] = v; o[4] = M_INSIDE;+} };+export const OBJS: Obj[] = [tube(Q2, 3), tube(Q1, 3), ball(DOT2), ball(DOT1), scroll, inside, mask];++// ---------------------------------------------------------------- the painter+const FLESH = lin("#ecd0ac"), LIP = lin("#c9836c"), PAPERC = lin("#efe2c4"), INK = lin("#3a2414"), WOOD = lin("#6b3c1c"), WOODD = lin("#3a1e0e");+// faux handwriting: arches for the small letters, the odd ascender and descender, gaps for words+export const script = (s: number, d: number, w: number) => {+ let ink = 0;+ for (let j = -5; j <= 5; j++) { const base = j * 19 + 5; if (Math.abs(base) > w - 11) continue; const cw = 7.6, cell = Math.floor(s / cw), word = hash2(Math.floor(s / 47 + j * 3.7), j, 5); if (hash2(cell, j, 9) < 0.12 || word < 0.1) continue;+ const lx = s / cw - cell, hh = hash2(cell, j, 3), yy = d - base, X = (lx - 0.5) * cw, amp = 3.6 + 2 * hash2(cell, j, 4);+ let dist = Math.abs(yy) + (lx > 0.8 || lx < 0.2 ? 0 : 3); // the thread that joins letter to letter+ if (hh < 0.12) dist = Math.min(dist, Math.max(Math.abs(X + 1), yy < 0 ? -yy : yy - 8.5)); // a descender+ else if (hh < 0.34) dist = Math.min(dist, Math.abs(Math.hypot(X, (yy + 2.8) * 1.15) - 2.6)); // a round letter+ else if (hh < 0.52) dist = Math.min(dist, Math.abs(yy + amp * (1 - Math.sin(Math.PI * lx)))); // a cup+ else if (hh < 0.82) dist = Math.min(dist, Math.abs(yy + amp * Math.sin(Math.PI * lx))); // an arch+ else dist = Math.min(dist, Math.max(Math.abs(X - 0.6 + (yy + 7) * 0.12), yy > 0 ? yy : -yy - 14.5), Math.abs(yy + amp * Math.sin(Math.PI * lx))); // an ascender, leaning+ const k = 1 - sm(0.5, 1.35, dist); if (k > ink) ink = k; }+ return ink;+};+// the spark in the window: a many-rayed burst, each ray a blunt petal+const RAYS = (() => { const r = rng(41), n = 12, out: number[][] = []; for (let i = 0; i < n; i++) { const a = (i / n) * Math.PI * 2 + (r() - 0.5) * 0.22, l = 0.62 + r() * 0.38; out.push([Math.cos(a), Math.sin(a), l]); } return out; })();+export const spark = (x: number, y: number) => { let best = 1e9; const rr = Math.hypot(x, y); for (const [cx, sy, l] of RAYS) { const t = cl(x * cx + y * sy, 0.1, l), d = Math.hypot(x - cx * t, y - sy * t) - (0.05 + 0.055 * (t / l)); if (d < best) best = d; } return Math.min(best, rr - 0.16); };++export type Bufs = { DW: number; DH: number; s: number; Hg: Float32Array; Ag: Float32Array; Hb: Float32Array };+export const hAt = (b: Bufs, x: number, y: number) => { const ix = (x * b.s) | 0, iy = (y * b.s) | 0; return ix < 0 || iy < 0 || ix >= b.DW || iy >= b.DH ? -1e9 : b.Hg[iy * b.DW + ix]; };+// is the sun hidden from this point by anything nearer the eye? walk toward it across the heights+export const sunAt = (b: Bufs, x: number, y: number, h: number) => { let occ = 0; for (let k = 1; k <= 70; k++) { const d = k * 2.6, hs = hAt(b, x + LDX * d, y + LDY * d); if (hs > -1e8) { const o = (hs - (h + RISE * d + 2)) / (d * 0.5 + 7); if (o > occ) { occ = o; if (occ >= 1) break; } } } return 1 - cl(occ); };+export const OUT: C3 = [0, 0, 0];+let NOINK = false;+export const light = (al: C3, nx: number, ny: number, nz: number, sh: number, ao: number, spec: number, gloss: number) => {+ const dif = Math.max(0, nx * LS[0] + ny * LS[1] + nz * LS[2]) * sh, skyk = (0.5 - 0.5 * ny) * ao, bnc = (0.5 + 0.5 * ny) * ao;+ const sp = spec * Math.pow(Math.max(0, nx * HV[0] + ny * HV[1] + nz * HV[2]), gloss) * sh;+ for (let i = 0; i < 3; i++) OUT[i] = al[i] * (SUN[i] * dif + SKYL[i] * 0.36 * skyk + BNC[i] * 0.34 * bnc) + sp * SUN[i];+};+export const paint = (b: Bufs, mat: number, x: number, y: number, h: number, nx: number, ny: number, nz: number, a1: number, a2: number, e: number) => {+ if (mat === M_NIGHT) {+ const wu = (a1 - (WIN.u0 + WIN.u1) / 2) / ((WIN.u1 - WIN.u0) / 2), wv = (a2 - (WIN.v0 + WIN.v1) / 2) / ((WIN.v1 - WIN.v0) / 2), X = wu * 1.42, Y = wv;+ const d = spark(X / 0.62, Y / 0.62) * 0.62, glow = Math.exp(-(X * X + Y * Y) / 0.5), k = 1 - sm(-0.012, 0.012, d);+ const star = hash2(Math.floor(a1 * 520), Math.floor(a2 * 520), 77) > 0.985 ? 0.5 : 0;+ const dusk = 0.5 + 0.5 * wv;+ OUT[0] = 0.006 + 0.02 * dusk + 0.5 * glow * glow + star; OUT[1] = 0.012 + 0.035 * dusk + 0.14 * glow * glow + star; OUT[2] = 0.06 + 0.1 * dusk + 0.03 * glow + star;+ const body = 0.75 + 0.35 * (0.5 - 0.5 * (X * 0.6 + Y * 0.6)); // the spark is a lit, solid thing+ OUT[0] = OUT[0] * (1 - k) + 0.86 * body * k; OUT[1] = OUT[1] * (1 - k) + 0.3 * body * k; OUT[2] = OUT[2] * (1 - k) + 0.13 * body * k;+ const recess = 0.45 + 0.55 * sm(0, 0.22, Math.min(wu + 1 - 0.17, wv + 1 - 0.24)); // the lintel's shadow inside+ OUT[0] *= recess; OUT[1] *= recess; OUT[2] *= recess; return;+ }+ const sh = sunAt(b, x, y, h), ix = (x * b.s) | 0, iy = (y * b.s) | 0, ao = 1 - 0.6 * cl((b.Hb[iy * b.DW + ix] - h) / 26);+ if (mat === M_INSIDE) { // concave: the sun comes over the left rim and lands on the right of the far wall+ const t = sm(-0.3, 0.42, a1), depth = cl((a2 - backRim(a1)) / 0.085), k = (0.1 + 0.7 * t * sh) * (0.55 + 0.45 * depth) ;+ OUT[0] = FLESH[0] * (0.1 + 1.0 * k) ; OUT[1] = FLESH[1] * (0.085 + 0.92 * k); OUT[2] = FLESH[2] * (0.12 + 0.8 * k); return; }+ if (mat === M_WALL) { light(FLESH, 0.75, 0.55, 0.36, 0, 1, 0, 1); OUT[0] = OUT[0] * 0.55 + 0.05; OUT[1] = OUT[1] * 0.5 + 0.018; OUT[2] *= 0.5; return; }+ if (mat === M_WOOD) { const grain = fbm(a1 * 0.03, a2 * 0.5, 3, 21), g = 0.35 + 0.65 * grain; light([WOODD[0] + (WOOD[0] - WOODD[0]) * g, WOODD[1] + (WOOD[1] - WOODD[1]) * g, WOODD[2] + (WOOD[2] - WOODD[2]) * g], nx, ny, nz, sh, 1, 0.5, 46); return; }+ if (mat === M_SCROLL) {+ const w = scrollW(a1, 200) < 200 ? 60 : 200; near(SCROLL, x, y); const ww = scrollW(NR.s, NR.r);+ const toPaper = sm(40, 330, a1), al: C3 = [FLESH[0] + (PAPERC[0] - FLESH[0]) * toPaper, FLESH[1] + (PAPERC[1] - FLESH[1]) * toPaper, FLESH[2] + (PAPERC[2] - FLESH[2]) * toPaper];+ const foxing = 1 - 0.1 * fbm(x * 0.012, y * 0.012, 3, 31); al[0] *= foxing; al[1] *= foxing * foxing; al[2] *= foxing * foxing * foxing;+ const ink = NOINK ? 0 : script(a1, a2, ww) * sm(150, 340, a1) * 0.8 * (w > 0 ? 1 : 1);+ al[0] += (INK[0] - al[0]) * ink; al[1] += (INK[1] - al[1]) * ink; al[2] += (INK[2] - al[2]) * ink;+ light(al, nx, ny, nz, sh, ao, 0.05, 18); return;+ }+ // flesh: wax-pale, a rose at the lips and lids, the few dark lines a face cannot do without+ const u = a1, v = a2, au = Math.abs(u), al: C3 = [FLESH[0], FLESH[1], FLESH[2]];+ const rose = 0.85 * G(u, v - 0.405, 0.13, 0.04) * (1 - sm(0.13, 0.17, au)) + 0.16 * G(au - 0.3, v - 0.08, 0.13, 0.1) + 0.12 * G(au - 0.218, v + 0.12, 0.09, 0.04);+ for (let i = 0; i < 3; i++) al[i] += (LIP[i] - al[i]) * cl(rose);+ let dark = 0;+ dark = Math.max(dark, 0.78 * Math.exp(-Math.pow((v - mouthLine(u)) / 0.0048, 2)) * (1 - sm(0.135, 0.172, au))); // the mouth line+ const lx = (au - 0.218) / 0.095;+ if (lx > -1.4 && lx < 1.4) { const fade = 1 - sm(0.92, 1.18, Math.abs(lx)), lv = lashLine(au); dark = Math.max(dark, 0.9 * Math.exp(-Math.pow((v - lv) / 0.0068, 2)) * fade);+ const lash = v - lv; if (lash > 0 && lash < 0.03) { const comb = Math.pow(0.5 + 0.5 * Math.sin((u + lash * 0.9 * Math.sign(u)) * 520), 6); dark = Math.max(dark, 0.66 * comb * (1 - lash / 0.03) * fade); } } // lashes, combed outward+ dark = Math.max(dark, 0.7 * G(au - 0.052, v - 0.228, 0.026, 0.012)); // nostrils+ const bx = (au - 0.215) / 0.15; if (bx > -1.1 && bx < 1.15) { const bv = -0.262 + 0.06 * bx * bx - 0.012 * bx, th = 0.02 * (1 - 0.55 * sm(-0.2, 1.1, bx)), hairs = 0.55 + 0.45 * Math.pow(0.5 + 0.5 * Math.sin((u * Math.sign(u) * 1.0 + (v - bv) * 1.6) * 700), 2); dark = Math.max(dark, 0.78 * Math.exp(-Math.pow((v - bv) / th, 2)) * (1 - sm(0.85, 1.12, Math.abs(bx))) * hairs); } // brows+ al[0] *= 1 - dark * 0.82; al[1] *= 1 - dark * 0.9; al[2] *= 1 - dark * 0.93;+ // the cut crown shows the thickness of the shell+ const rim = (v - crown(u)) * S; if (rim < 7) { al[0] = al[0] * 0.8 + 0.2; al[1] = al[1] * 0.8 + 0.17; al[2] = al[2] * 0.8 + 0.12; }+ const mottle = fbm(u * 5, v * 5, 3, 51) - 0.5; al[0] *= 1 + 0.05 * mottle; al[1] *= 1 - 0.03 * mottle; al[2] *= 1 - 0.09 * mottle; // thin glazes never lie quite even+ light(al, nx, ny, nz, sh * (0.8 + 0.2 * ao), ao, 0.16, 36);+ const dif = Math.max(0, nx * LS[0] + ny * LS[1] + nz * LS[2]) * sh, sss = 0.07 * Math.exp(-Math.pow((dif - 0.14) / 0.13, 2)); // blood-warm where light turns to shadow+ OUT[0] += sss; OUT[1] += sss * 0.3; OUT[2] += sss * 0.14;+ const wd = Math.hypot((u - 0) * S, (v + 0.415) * S), spill = 0.07 * Math.exp(-(wd * wd) / (95 * 95)); // the spark warms the brow round its window+ OUT[0] += spill; OUT[1] += spill * 0.42; OUT[2] += spill * 0.12;+ void e;+};++export const ridge = (x: number) => { const t1 = (x - 1340) / 430, m1 = t1 > -1 && t1 < 1 ? Math.pow(1 - t1 * t1, 1.2) * 92 * (0.62 + 0.76 * fbm(x * 0.011, 0.3, 4, 7)) : 0, t2 = (x - 170) / 190, m2 = t2 > -1 && t2 < 1 ? Math.pow(1 - t2 * t2, 1.4) * 26 * (0.6 + 0.8 * fbm(x * 0.02, 0.7, 3, 8)) : 0; return Math.max(m1, m2); };+const STONES = [[236, 1694, 26], [1016, 1772, 30], [1338, 1672, 17], [524, 1626, 14], [140, 1536, 10], [1470, 1600, 10], [770, 1700, 11], [330, 1454, 6], [1096, 1616, 6], [566, 1404, 4], [1268, 1838, 22], [404, 1848, 18]];++// ---------------------------------------------------------------- the picture+export const build = (env: Env) => {+ const s = env.scale, DW = Math.round(W * s), DH = Math.round(H * s);+ const b: Bufs = { DW, DH, s, Hg: new Float32Array(DW * DH).fill(-1e9), Ag: new Float32Array(DW * DH), Hb: new Float32Array(DW * DH) };+ const o = new Float32Array(5), GAM = new Uint8ClampedArray(4097); for (let i = 0; i <= 4096; i++) GAM[i] = Math.round(255 * Math.pow(i / 4096, 1 / 2.2));+ const tone = (v: number) => GAM[Math.round(4096 * (1 - Math.exp(-1.35 * Math.max(0, v))))];++ // 1. every object's height and edge, kept per object, and the highest height at every pixel+ const local = OBJS.map((ob) => { const x0 = Math.max(0, Math.floor(ob.box[0] * s)), y0 = Math.max(0, Math.floor(ob.box[1] * s)), x1 = Math.min(DW, Math.ceil(ob.box[2] * s)), y1 = Math.min(DH, Math.ceil(ob.box[3] * s)), w = x1 - x0, h = y1 - y0; const E = new Float32Array(w * h), Hh = new Float32Array(w * h), A1 = new Float32Array(w * h), A2 = new Float32Array(w * h), Mt = new Uint8Array(w * h);+ for (let j = 0; j < h; j++) for (let i = 0; i < w; i++) { ob.at((x0 + i + 0.5) / s, (y0 + j + 0.5) / s, o); const k = j * w + i; E[k] = o[0]; Hh[k] = o[1]; A1[k] = o[2]; A2[k] = o[3]; Mt[k] = o[4]; if (o[0] > 0) { const g = (y0 + j) * DW + x0 + i; if (o[1] > b.Hg[g]) b.Hg[g] = o[1]; const a = cl(o[0] * s + 0.5); if (a > b.Ag[g]) b.Ag[g] = a; } }+ return { x0, y0, w, h, E, Hh, A1, A2, Mt }; });++ // the hollows: where a point sits below the average height round it, less sky reaches it+ { const R = Math.round(11 * s), tmp = new Float32Array(DW * DH), n = 2 * R + 1;+ for (let j = 0; j < DH; j++) { let acc = 0; const row = j * DW; for (let i = -R; i < DW; i++) { const a = i + R < DW ? Math.max(0, b.Hg[row + i + R]) : 0, d = i - R - 1 >= 0 ? Math.max(0, b.Hg[row + i - R - 1]) : 0; acc += a - d; if (i >= 0) tmp[row + i] = acc / n; } }+ for (let i = 0; i < DW; i++) { let acc = 0; for (let j = -R; j < DH; j++) { const a = j + R < DH ? tmp[(j + R) * DW + i] : 0, d = j - R - 1 >= 0 ? tmp[(j - R - 1) * DW + i] : 0; acc += a - d; if (j >= 0) b.Hb[j * DW + i] = acc / n; } } }+ // 2. paint each object, back to front, into one layer+ const objL = env.canvas(DW, DH), img = objL.ctx.createImageData(DW, DH), px = img.data, oid = new Uint8Array(DW * DH), SL = local[4], bare = new Uint8ClampedArray(SL.w * SL.h * 3);+ for (let li = 0; li < local.length; li++) { const L = local[li]; for (let j = 1; j < L.h - 1; j++) for (let i = 1; i < L.w - 1; i++) { const k = j * L.w + i, e = L.E[k]; if (e * s < -0.5) continue; const a = cl(e * s + 0.5), h = L.Hh[k];+ const m = L.Mt[k], ml = L.Mt[k - 1] === m, mr = L.Mt[k + 1] === m, mu = L.Mt[k - L.w] === m, md = L.Mt[k + L.w] === m;+ let nx = -s * (ml && mr ? (L.Hh[k + 1] - L.Hh[k - 1]) / 2 : mr ? L.Hh[k + 1] - h : ml ? h - L.Hh[k - 1] : 0), ny = -s * (mu && md ? (L.Hh[k + L.w] - L.Hh[k - L.w]) / 2 : md ? L.Hh[k + L.w] - h : mu ? h - L.Hh[k - L.w] : 0), nz = 1; const nl = Math.hypot(nx, ny, nz); nx /= nl; ny /= nl; nz /= nl;+ paint(b, L.Mt[k], (L.x0 + i + 0.5) / s, (L.y0 + j + 0.5) / s, h, nx, ny, nz, L.A1[k], L.A2[k], e);+ const g = ((L.y0 + j) * DW + L.x0 + i) * 4, r = tone(OUT[0]), gg = tone(OUT[1]), bb = tone(OUT[2]), a0 = px[g + 3] / 255, ao = a + a0 * (1 - a);+ if (a > 0.02) oid[g >> 2] = L.Mt[k] === M_NIGHT ? 8 : li + 1;+ if (L.Mt[k] === M_SCROLL) { NOINK = true; paint(b, L.Mt[k], (L.x0 + i + 0.5) / s, (L.y0 + j + 0.5) / s, h, nx, ny, nz, L.A1[k], L.A2[k], e); NOINK = false; bare[k * 3] = tone(OUT[0]); bare[k * 3 + 1] = tone(OUT[1]); bare[k * 3 + 2] = tone(OUT[2]); }+ px[g] = (r * a + px[g] * a0 * (1 - a)) / ao; px[g + 1] = (gg * a + px[g + 1] * a0 * (1 - a)) / ao; px[g + 2] = (bb * a + px[g + 2] * a0 * (1 - a)) / ao; px[g + 3] = ao * 255; } }+ objL.ctx.putImageData(img, 0, 0);++ // 3. sky, far rocks and the plain, with every cast shadow+ const bgL = env.canvas(DW, DH), bimg = bgL.ctx.createImageData(DW, DH), bp = bimg.data, c: C3 = [0, 0, 0], hz: C3 = [0, 0, 0];+ const bgN = env.canvas(DW, DH), nimg = bgN.ctx.createImageData(DW, DH), np = nimg.data; let n0 = 0, n1 = 0, n2 = 0;+ const boards: number[][] = [[Z0, AX0, 1], ...COPIES.map(([z, ax]) => [z, ax, Z0 / z])];+ const alphaAt = (mx: number, my: number) => { const ix = (mx * s) | 0, iy = (my * s) | 0; return ix < 0 || iy < 0 || ix >= DW || iy >= DH ? 0 : b.Ag[iy * DW + ix]; };+ const TAPS = [[0, 0], [0.7, 0.2], [-0.7, -0.2], [0.2, -0.7], [-0.2, 0.7], [0.5, 0.6], [-0.5, -0.6], [0.6, -0.5], [-0.6, 0.5]];+ for (let j = 0; j < DH; j++) { const y = (j + 0.5) / s;+ for (let i = 0; i < DW; i++) { const x = (i + 0.5) / s, g = (j * DW + i) * 4;+ if (y < YH) {+ const t = y / YH; ramp(SKY, t, c);+ const sunward = 1 - x / W; c[0] += 14 * sunward * t * t; c[1] += 8 * sunward * t * t; c[2] -= 10 * sunward * t * t;+ const cloud = sm(0.52, 0.74, fbm(x * 0.0016 + 2, y * 0.013, 4, 5)) * sm(380, 760, y) * (1 - sm(1010, 1190, y)) * 0.5;+ c[0] += (246 - c[0]) * cloud; c[1] += (226 - c[1]) * cloud; c[2] += (190 - c[2]) * cloud;+ const rh = ridge(x), top = YH - rh;+ if (rh > 1 && y > top - 1) { const cov = cl((y - top + 0.5) * s), slope = ridge(x + 3) - ridge(x - 3), facet = fbm(x * 0.07, y * 0.028, 4, 9), lit = sm(0.4, 0.6, 0.5 + slope * 0.06 + (facet - 0.5) * 1.5), depth = (y - top) / Math.max(1, rh); const rr = 126 + (228 - 126) * lit, rg = 118 + (196 - 118) * lit, rb = 146 + (150 - 146) * lit; ramp(SKY, 1, hz); const haze = 0.3 + 0.3 * depth; c[0] += (rr + (hz[0] - rr) * haze - c[0]) * cov; c[1] += (rg + (hz[1] - rg) * haze - c[1]) * cov; c[2] += (rb + (hz[2] - rb) * haze - c[2]) * cov; }+ } else {+ const z = (F * CAMH) / Math.max(0.5, y - YH), wx = ((x - CX) * z) / F, fog = 1 - Math.exp(-z / 55);+ ramp(GROUND, Math.pow(fog, 0.8), c);+ const tn = (fbm(wx * 0.22, z * 0.22, 4, 11) - 0.5) * 0.2 * (1 - fog) + (fbm(wx * 7, z * 7, 2, 12) - 0.5) * 0.12 * cl(1 - z / 22) + (fbm(wx * 0.9, z * 0.05, 3, 13) - 0.5) * 0.07, k = (1 + tn) * (1 + 0.1 * (1 - x / W));+ c[0] *= k; c[1] *= k; c[2] *= k;+ // shadows: from this point of the plain, walk toward the sun and see which standing thing is in the way+ let shd = 0;+ for (const [zb, ax, kb] of boards) { const far = kb < 0.6, ay = YH + (F * CAMH) / zb; if (y > ay + 0.5 || y < YH + (F * CAMH) / (zb + 17) - 1) continue;+ // far off, one pixel row of plain spans many paces, so a far shadow is the average of four depths inside the pixel+ let acc = 0; const sub = far ? 4 : 1;+ for (let q = 0; q < sub; q++) { const yq = far ? y + ((q + 0.5) / sub - 0.5) / s : y, zq = (F * CAMH) / Math.max(0.05, yq - YH); if (zq <= zb) continue; const wq = ((x - CX) * zq) / F, t = (zb - zq) / LW[2], Yb = t * LW[1]; if (Yb > 9.5) continue; const Xb = wq + t * LW[0], sx = CX + (F * Xb) / zb, sy = YH + (F * (CAMH - Yb)) / zb, mx = AX0 + (sx - ax) / kb, my = AY0 + (sy - ay) / kb; if (mx < 300 || mx > 1460 || my < 300) continue; const rad = 0.7 + 0.9 * t; let a = 0; for (const [tx, ty] of TAPS) a += alphaAt(mx + tx * rad, my + ty * rad); acc += a / TAPS.length; }+ acc /= sub; if (acc > shd) shd = acc; }+ // a dot rests on the plain: the dark where it touches+ for (const [zb, ax, kb] of boards) for (const d of [DOT1, DOT2]) { const dx = (x - (ax + (d[0] - AX0) * kb)) / (d[2] * kb * 1.25), dy = (y - (YH + (F * CAMH) / zb - 4 * kb)) / (d[2] * kb * 0.3), q = dx * dx + dy * dy; if (q < 4) shd = Math.max(shd, 0.9 * Math.exp(-q * 1.2)); }+ n0 = c[0]; n1 = c[1]; n2 = c[2];+ const sk = shd * 0.8; c[0] *= 1 - sk * 0.74; c[1] *= 1 - sk * 0.7; c[2] *= 1 - sk * 0.5;+ const fore = sm(1790, 1985, y + 70 * (fbm(x * 0.004, 0.5, 3, 14) - 0.5)) * 0.72; c[0] *= 1 - fore * 0.8; c[1] *= 1 - fore * 0.8; c[2] *= 1 - fore * 0.66; n0 *= 1 - fore * 0.8; n1 *= 1 - fore * 0.8; n2 *= 1 - fore * 0.66; // something out of frame throws its shadow across the foot of the picture+ }+ const dn = (hash2(i, j, 3) - 0.5) * 1.6; bp[g] = c[0] + dn; bp[g + 1] = c[1] + dn; bp[g + 2] = c[2] + dn; bp[g + 3] = 255;+ if (y < YH) { n0 = c[0]; n1 = c[1]; n2 = c[2]; } np[g] = n0 + dn; np[g + 1] = n1 + dn; np[g + 2] = n2 + dn; np[g + 3] = 255; } }+ bgL.ctx.putImageData(bimg, 0, 0); bgN.ctx.putImageData(nimg, 0, 0);+ return { objL, bgL, bgN, DW, DH, px, oid, bare, SL };+};++export type Built = ReturnType<typeof build>;+export const built = (env: Env): Built => { const key = `dreamGlaze@${env.scale}`; let B = env.cache.get(key) as Built | undefined; if (!B) { B = build(env); env.cache.set(key, B); } return B; };+// one of the further masks, a little more lost in the evening air the further off it stands+export const copyLayer = (B: Built, env: Env, z: number, ax: number) => { const s = env.scale, k = Z0 / z, ay = YH + (F * CAMH) / z, T = env.canvas(B.DW, B.DH), t = T.ctx; t.setTransform(1, 0, 0, 1, 0, 0); t.clearRect(0, 0, B.DW, B.DH); t.imageSmoothingEnabled = true; t.imageSmoothingQuality = "high"; t.drawImage(B.objL.canvas, (ax - AX0 * k) * s, (ay - AY0 * k) * s, B.DW * k, B.DH * k); t.globalCompositeOperation = "source-atop"; t.globalAlpha = cl(0.1 + 0.5 * (1 - Math.exp(-z / 160))); t.fillStyle = "#ecd9ae"; t.fillRect(0, 0, B.DW, B.DH); t.globalAlpha = 1; t.globalCompositeOperation = "source-over"; return T; };+// small things standing on the plain: stones, and the one who asks. Each throws the same shadow.+export const smallThings = (ctx: Ctx, env: Env, nStones = 99, figure = 1) => {+ const s = env.scale; ctx.setTransform(s, 0, 0, s, 0, 0);+ const poly = (pts: number[][], fill: string | CanvasGradient) => { ctx.beginPath(); pts.forEach(([x, y], i) => (i ? ctx.lineTo(x, y) : ctx.moveTo(x, y))); ctx.closePath(); ctx.fillStyle = fill; ctx.fill(); };+ const SX = -LW[0] / LW[1], SZ = -LW[2] / LW[1];+ const cast = (pts: number[][], gy: number) => { const z = (F * CAMH) / (gy - YH), ky = (CAMH / z) * SZ; return pts.map(([x, y]) => [x + (gy - y) * SX, gy - (gy - y) * ky]); };+ STONES.slice(0, nStones).forEach(([cx, cy, r], n) => { const rr = rng(700 + n), m = 9, pts: number[][] = []; for (let i = 0; i < m; i++) { const a = (i / m) * Math.PI * 2 + (rr() - 0.5) * 0.4, k = 0.72 + rr() * 0.42; pts.push([cx + Math.cos(a) * r * k, cy - r * 0.5 + Math.sin(a) * r * 0.5 * k]); }+ poly(cast(pts, cy), "rgba(46,30,48,0.6)");+ const g = ctx.createLinearGradient(cx - r, cy - r, cx + r * 0.8, cy + r * 0.2); g.addColorStop(0, "#f0d9a8"); g.addColorStop(0.42, "#b98e58"); g.addColorStop(0.62, "#6e4c30"); g.addColorStop(1, "#3c2a22"); poly(pts, g); });+ if (figure > 0) { if (figure < 1) { ctx.save(); ctx.beginPath(); ctx.rect(1380, 1366 - 74 * figure, 220, 74 * figure + 4); ctx.clip(); }+ { const fx = 1478, fy = 1366, k = 0.7, T = (pts: number[][]) => pts.map(([x, y]) => [fx + (x - 50) * k, fy + (y - 100) * k]);+ const LEGB = [[51, 74], [57, 74], [57.5, 96], [59.5, 100], [51, 100], [53, 96]], LEGF = [[44, 74], [50.5, 74], [50, 96], [51.5, 100], [42.5, 100], [45.5, 96]];+ const COAT = [[43, 17], [50, 15], [57, 18], [59.5, 30], [60, 52], [62.5, 79], [41, 79], [42.5, 52], [42, 30]], COATL = [[43, 17], [45.5, 17.5], [44.6, 30], [45, 52], [44, 79], [41, 79], [42.5, 52], [42, 30]];+ const HEAD = [[44.6, 6], [46, 2.2], [50, 0.4], [54.4, 1.6], [56.4, 5.6], [55.8, 10.6], [53, 14.6], [49, 15.2], [46.2, 13.2], [44.4, 11], [45.2, 9]], HAIR = [[49.4, 0.4], [54.4, 1.6], [56.4, 5.6], [55.8, 10.6], [53.6, 13.4], [52.2, 8], [50, 4.4]];+ const ARM = [[46, 20.5], [38, 31], [31.5, 21.5]], PAGE = [[23.5, 11.5], [31.4, 9.8], [33, 20.2], [25, 22]];+ const armPoly = [[44.5, 19], [47.6, 21.6], [39, 33.4], [36.4, 32.6], [30, 22.4], [32.6, 20.4], [38, 28]];+ for (const p of [LEGB, LEGF, COAT, HEAD, armPoly, PAGE]) poly(cast(T(p), fy), "rgba(46,30,48,0.62)");+ poly(T(LEGB), "#17141f"); poly(T(LEGF), "#221d2c"); poly(T(COAT), "#2c2a4a"); poly(T(COATL), "#a98660");+ poly(T(HEAD), "#c79a72"); poly(T(HAIR), "#241815");+ ctx.lineCap = "round"; ctx.lineJoin = "round"; ctx.strokeStyle = "#35335a"; ctx.lineWidth = 3.4 * k; ctx.beginPath(); T(ARM).forEach(([x, y], i) => (i ? ctx.lineTo(x, y) : ctx.moveTo(x, y))); ctx.stroke();+ poly(T(PAGE), "#f4ead0"); poly(T([[31.4, 9.8], [33, 20.2], [31.6, 20.5], [30, 10.1]]), "#cdbd98"); }+ if (figure < 1) ctx.restore(); }+ ctx.setTransform(1, 0, 0, 1, 0, 0);+};+// signed by the sitter, small, in the shadow at the foot of the picture+const SIG = (() => { const raw = [[[10, -16], [6, -19], [1, -15], [0, -8], [2, -2], [7, 0], [11, -3]], [[14, -6], [18, -14], [18, -20], [16, -20], [15.5, -10], [16, -2], [18, 0], [20, -3]], [[27, -8], [24, -10], [21, -7], [21, -2], [24, 0], [27, -3], [27.5, -9], [27.5, -2], [29, 0], [31, -3], [32, -9], [32, -3], [34, 0], [37, -3], [38, -9], [38, -2], [40, 0], [42, -3]], [[48, -8], [45, -10], [42, -7], [42, -2], [45, 0], [48, -3], [48.5, -20], [48.5, -2], [50, 0], [52, -3], [55, -5], [57, -8], [55, -10], [52.5, -7], [53, -2], [56, 0], [61, -4]]];+ // each stroke flattened to a fine polyline, so the pen can stop anywhere along it+ return raw.map((st) => { const q = st.map(([x, y]) => [1404 + x * 1.7 + y * -0.25, 1950 + y * 1.7]), out: number[][] = [q[0]]; let cur = q[0]; for (let i = 1; i < q.length - 1; i++) { const c = q[i], e = [(q[i][0] + q[i + 1][0]) / 2, (q[i][1] + q[i + 1][1]) / 2]; for (let k = 1; k <= 8; k++) { const u = k / 8; out.push([(1 - u) * (1 - u) * cur[0] + 2 * (1 - u) * u * c[0] + u * u * e[0], (1 - u) * (1 - u) * cur[1] + 2 * (1 - u) * u * c[1] + u * u * e[1]]); } cur = e; } out.push(q[q.length - 1]); return out; }); })();+export const signature = (ctx: Ctx, env: Env, prog = 1, dx = 0, dy = 0) => { const s = env.scale, total = SIG.reduce((a, st) => a + st.length - 1, 0); let left = prog >= 1 ? total : prog * total;+ ctx.setTransform(s, 0, 0, s, dx * s, dy * s); ctx.strokeStyle = "rgba(214,160,74,0.9)"; ctx.lineWidth = 1.5; ctx.lineCap = "round"; ctx.lineJoin = "round";+ for (const st of SIG) { if (left <= 0) break; const n = Math.min(st.length - 1, left), whole = Math.floor(n), fr = n - whole; ctx.beginPath(); ctx.moveTo(st[0][0], st[0][1]); for (let i = 1; i <= whole; i++) ctx.lineTo(st[i][0], st[i][1]); if (fr > 0) ctx.lineTo(st[whole][0] + (st[whole + 1][0] - st[whole][0]) * fr, st[whole][1] + (st[whole + 1][1] - st[whole][1]) * fr); ctx.stroke(); left -= st.length - 1; }+ ctx.setTransform(1, 0, 0, 1, 0, 0); };+// the surface: a fine linen under thin paint, and the corners a little sunk, as old varnish does+export const surface = (ctx: Ctx, env: Env, W = 1600, H = 2000) => { const s = env.scale, g = new Gfx(ctx, env, 0, PENCIL); weave(g, 0.04); g.paper("paper", 0.05);+ ctx.setTransform(s, 0, 0, s, 0, 0); ctx.globalCompositeOperation = "multiply"; const vg = ctx.createRadialGradient(W * 0.46, H * 0.44, H * 0.34, W * 0.5, H * 0.5, H * 0.76); vg.addColorStop(0, "rgba(255,255,255,1)"); vg.addColorStop(1, "rgba(150,128,112,1)"); ctx.fillStyle = vg; ctx.fillRect(0, 0, W, H); ctx.globalCompositeOperation = "source-over"; ctx.setTransform(1, 0, 0, 1, 0, 0); };++export const drawDreamGlaze = (ctx: Ctx, _frame: number, env: Env) => {+ const B = built(env);+ ctx.setTransform(1, 0, 0, 1, 0, 0); ctx.globalAlpha = 1; ctx.globalCompositeOperation = "source-over";+ ctx.drawImage(B.bgL.canvas, 0, 0);+ ctx.imageSmoothingEnabled = true; ctx.imageSmoothingQuality = "high";+ for (const [z, ax] of COPIES) ctx.drawImage(copyLayer(B, env, z, ax).canvas, 0, 0); // furthest first+ smallThings(ctx, env);+ signature(ctx, env);+ ctx.drawImage(B.objL.canvas, 0, 0);+ surface(ctx, env);+};++export const dreamGlaze: Film = {+ meta: { title: "dreamGlaze", W, H, fps: 30, bpm: 60, durationFrames: 1, raster: "cpu" },+ assets: { images: {} },+ shots: [{ id: "dreamGlaze", start: 0, end: 1, draw: drawDreamGlaze }],+};+export const STYLE = { id: "dreamGlaze", name: "Dream glaze", family: "paint", medium: "resin-thinned oil glazes laid with a very small soft brush on a smooth white ground: no visible stroke, every form turned pixel by pixel under one low sun, every edge hard", nearest: "paintedOil", hero: "a hollow mask of a calm face held up by question marks in an empty desert, its cheek running out into a scroll of handwriting" };diff --git a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/dreamGlazeDraw.ts b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/dreamGlazeDraw.tsnew file mode 100644index 0000000..5f9aa34--- /dev/null+++ b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/dreamGlazeDraw.ts@@ -0,0 +1,126 @@+import { type Ctx, type Env, type Layer } from "./core";+import { Film } from "./film";+import { AX0, AY0, CAMH, COPIES, CT, DOT1, DOT2, F, H, MX, MY, OBJS, Q1, Q2, RIMW, S, SCROLL, ST, W, WIN, YH, Z0, backRim, built, cl, copyLayer, crown, drawDreamGlaze, halfW, hash2, lashLine, mouthLine, ridge, scrollW, signature, sm, smallThings, surface, type Built, type Curve } from "./dreamGlaze";++// THE SOFT SELF-PORTRAIT, PAINTED · the same picture, in the order its hand works.+//+// ORDER (resin-oil glazes, a very small brush): a white primed panel; the drawing, in thin umber;+// the sky laid twice, a thin glaze and then the full one, in rows from the top; the plain the same+// way; then each form, furthest first, laid in its shadow tone; the cast shadows; the handwriting+// written along the scroll; the small things on the plain; the face worked up dark to light, last+// and slowest; the spark lit; the signature. The last second is the still, pixel for pixel.++const FPS = 30, N = 810, HOLD = 780;+// every frame number in the film lives here+const CUE = {+ draw: [6, 104], drawFar: [104, 122],+ sky1: [122, 188], sky2: [188, 252], plain1: [252, 300], plain2: [300, 346],+ far: [346, 392],+ // [underpaint from, to, worked up from, to], by owner: Q2, Q1, dot 2, dot 1, scroll, inside, mask, night+ form: [[392, 416, 410, 444], [402, 426, 420, 454], [426, 434, 434, 452], [430, 438, 438, 456], [440, 486, 474, 534], [486, 506, 500, 534], [520, 600, 640, 752], [752, 758, 756, 780]],+ shadows: [560, 650], write: [610, 710], stones: [660, 700], figure: [690, 716], sign: [750, 778],+};+// what the drawing's lines belong to, and the frame by which paint has covered them+const GONE: Record<string, number> = { rock: 252, horizon: 346, far: 392, q: 456, scroll: 486, mask: 600 };+for (const v of Object.values(CUE).flat(2) as number[]) if (!(v >= 0 && v <= HOLD)) throw new Error(`dreamGlazeDraw: cue ${v} is outside the film`);++// ---------------------------------------------------------------- the drawing under the paint+type Line = { pts: number[][]; len: number; grp: string; t0: number; t1: number };+const uv = (u: number, v: number) => { const X = u * CT - v * ST, Y = u * ST + v * CT; return [MX + X * S, MY + Y * S]; };+const hull = (c: Curve, wOf: (s: number, r: number) => number) => { const a: number[][] = [], b: number[][] = []; for (let i = 0; i < c.n; i++) { const j = Math.min(c.n - 1, i + 1), k = Math.max(0, i - 1), dx = c.x[j] - c.x[k], dy = c.y[j] - c.y[k], l = Math.hypot(dx, dy) || 1, w = wOf(c.s[i], c.r[i]); a.push([c.x[i] - (dy / l) * w, c.y[i] + (dx / l) * w]); b.push([c.x[i] + (dy / l) * w, c.y[i] - (dx / l) * w]); } return [...a, ...b.reverse(), a[0]]; };+const ring = (d: number[]) => Array.from({ length: 25 }, (_, i) => [d[0] + Math.cos((i / 24) * Math.PI * 2) * d[2], d[1] + Math.sin((i / 24) * Math.PI * 2) * d[2]]);+const span = (n: number, f: (t: number) => number[]) => Array.from({ length: n + 1 }, (_, i) => f(i / n));+const GROUP: [string, number[][]][] = (() => {+ const out: [string, number[][]][] = [];+ out.push(["mask", [...span(40, (t) => uv(-halfW(-0.6 + 1.299 * t), -0.6 + 1.299 * t)), ...span(40, (t) => uv(halfW(0.699 - 1.299 * t), 0.699 - 1.299 * t))]]);+ out.push(["mask", span(48, (t) => uv(RIMW - 2 * RIMW * t, crown(RIMW - 2 * RIMW * t)))]);+ out.push(["mask", span(32, (t) => uv(-RIMW + 2 * RIMW * t, backRim(-RIMW + 2 * RIMW * t)))]);+ out.push(["mask", [uv(WIN.u0, WIN.v0), uv(WIN.u1, WIN.v0), uv(WIN.u1, WIN.v1), uv(WIN.u0, WIN.v1), uv(WIN.u0, WIN.v0)]]);+ for (const sg of [-1, 1]) { out.push(["mask", span(14, (t) => { const bx = -1.05 + 2.15 * t; return uv(sg * (0.215 + 0.15 * bx), -0.262 + 0.06 * bx * bx - 0.012 * bx); })]); out.push(["mask", span(14, (t) => { const au = 0.218 + 0.095 * (-1.1 + 2.2 * t); return uv(sg * au, lashLine(au)); })]); }+ out.push(["mask", [uv(0.03, -0.2), uv(0.04, 0), uv(0.06, 0.14), uv(0.11, 0.2), uv(0.08, 0.235), uv(0, 0.245), uv(-0.08, 0.235), uv(-0.11, 0.2), uv(-0.085, 0.16)]]);+ out.push(["mask", span(16, (t) => { const u = -0.165 + 0.33 * t; return uv(u, mouthLine(u)); })]);+ out.push(["mask", span(10, (t) => { const u = -0.1 + 0.2 * t; return uv(u, 0.476 - 2 * u * u); })]);+ out.push(["q", hull(Q1, (_s, r) => r)], ["q", ring(DOT1)], ["scroll", hull(SCROLL, scrollW)], ["q", hull(Q2, (_s, r) => r)], ["q", ring(DOT2)]);+ return out;+})();+const LINES: Line[] = (() => {+ const near: [string, number[][]][] = [["horizon", [[0, YH], [W, YH]]], ["rock", span(70, (t) => { const x = 905 + 695 * t; return [x, YH - ridge(x)]; })], ["rock", span(24, (t) => { const x = 0 + 345 * t; return [x, YH - ridge(x)]; })], ...GROUP];+ const far: [string, number[][]][] = []; for (const [z, ax] of [...COPIES].reverse()) { const k = Z0 / z, ay = YH + (F * CAMH) / z; for (const [, p] of GROUP) far.push(["far", p.map(([x, y]) => [ax + (x - AX0) * k, ay + (y - AY0) * k])]); }+ const lay = (set: [string, number[][]][], a: number, b: number) => { const L = set.map(([grp, pts]) => { let len = 0; for (let i = 1; i < pts.length; i++) len += Math.hypot(pts[i][0] - pts[i - 1][0], pts[i][1] - pts[i - 1][1]); return { pts, len, grp, t0: 0, t1: 0 }; }), cost = L.map((l) => 1.5 + Math.pow(l.len, 0.55)), sum = cost.reduce((p, c) => p + c, 0); let t = a; L.forEach((l, i) => { l.t0 = t; t += ((b - a) * cost[i]) / sum; l.t1 = t; }); return L; }; // a long line is drawn fast, a short one slowly+ return [...lay(near, CUE.draw[0], CUE.draw[1]), ...lay(far, CUE.drawFar[0], CUE.drawFar[1])];+})();+const drawing = (ctx: Ctx, s: number, f: number) => {+ ctx.setTransform(s, 0, 0, s, 0, 0); ctx.strokeStyle = "rgba(104,64,36,0.88)"; ctx.lineCap = "round"; ctx.lineJoin = "round";+ for (const l of LINES) { if (f <= l.t0 || f >= GONE[l.grp]) continue; const p = f >= l.t1 ? 1 : (f - l.t0) / (l.t1 - l.t0); let left = p * l.len; ctx.lineWidth = l.grp === "far" ? 0.9 : 1.7; ctx.beginPath(); ctx.moveTo(l.pts[0][0], l.pts[0][1]);+ for (let i = 1; i < l.pts.length && left > 0; i++) { const a = l.pts[i - 1], b = l.pts[i], d = Math.hypot(b[0] - a[0], b[1] - a[1]), k = d <= left ? 1 : left / d; ctx.lineTo(a[0] + (b[0] - a[0]) * k, a[1] + (b[1] - a[1]) * k); left -= d; } ctx.stroke(); }+ ctx.setTransform(1, 0, 0, 1, 0, 0);+};++// ---------------------------------------------------------------- a brush laying a ground in rows+// The region painted so far: whole rows above, and the row in hand as far as the brush has got.+// Rows run left to right, then right to left; their lower edge wavers as a hand's does.+const wav = (x: number, row: number) => 6 * Math.sin(x * 0.011 + row * 1.7) + 3 * Math.sin(x * 0.037 + row);+const rows = (ctx: Ctx, x0: number, y0: number, x1: number, y1: number, band: number, p: number) => {+ const n = Math.ceil((y1 - y0) / band), q = cl(p) * n, k = Math.min(n, Math.floor(q)), fr = q - k;+ ctx.beginPath(); ctx.rect(x0, y0, x1 - x0, y1 - y0); ctx.clip(); ctx.beginPath();+ if (k > 0) { const yb = y0 + k * band; ctx.moveTo(x0, y0 - 20); ctx.lineTo(x1, y0 - 20); for (let x = x1; x >= x0 - 40; x -= 40) ctx.lineTo(x, k >= n ? y1 + 20 : yb + wav(x, k)); ctx.closePath(); }+ if (k < n && fr > 0) { const yt = y0 + k * band - 12, yb = y0 + (k + 1) * band, ltr = k % 2 === 0, xf = ltr ? x0 + fr * (x1 - x0 + 60) : x1 - fr * (x1 - x0 + 60), xs = ltr ? x0 - 10 : x1 + 10, dir = ltr ? 1 : -1;+ ctx.moveTo(xs, yt); ctx.lineTo(xf, yt); ctx.quadraticCurveTo(xf + dir * 26, (yt + yb) / 2, xf - dir * 6, yb + wav(xf, k + 1)); for (let x = xf - dir * 6; dir * (x - xs) > 0; x -= dir * 40) ctx.lineTo(x, yb + wav(x, k + 1)); ctx.lineTo(xs, yb + wav(xs, k + 1)); ctx.closePath(); }+ ctx.clip();+};+const laid = (ctx: Ctx, s: number, src: Layer, f: number, cue: number[], region: number[], band: number, alpha: number) => { if (f <= cue[0]) return; ctx.save(); ctx.setTransform(s, 0, 0, s, 0, 0); rows(ctx, region[0], region[1], region[2], region[3], band, (f - cue[0]) / (cue[1] - cue[0])); ctx.setTransform(1, 0, 0, 1, 0, 0); ctx.globalAlpha = alpha; ctx.drawImage(src.canvas, 0, 0); ctx.restore(); };++// ---------------------------------------------------------------- the forms, dark to light+// For every pixel a form owns: when the small brush reaches it (its place in the rows), and how+// light it is. A form is first laid in its shadow tone; then the lights are worked up across it.+type Plan = { idx: Uint32Array; ord: Float32Array; lum: Float32Array; who: Uint8Array; sIdx: Int32Array; img: ImageData; L: Layer };+const BAND = [9, 9, 5, 5, 15, 12, 19, 100];+const plan = (B: Built, env: Env): Plan => {+ const key = `dreamGlazeDraw:plan@${env.scale}`; let P = env.cache.get(key) as Plan | undefined; if (P) return P;+ const s = env.scale, { DW, DH, px, oid, SL } = B; let n = 0; for (let i = 0; i < DW * DH; i++) if (px[i * 4 + 3] > 0 && oid[i]) n++;+ const idx = new Uint32Array(n), ord = new Float32Array(n), lum = new Float32Array(n), who = new Uint8Array(n), sIdx = new Int32Array(n); let m = 0;+ for (let j = 0; j < DH; j++) for (let i = 0; i < DW; i++) { const g = j * DW + i, id = oid[g]; if (!(px[g * 4 + 3] > 0 && id)) continue; const x = (i + 0.5) / s, y = (j + 0.5) / s;+ const box = id === 8 ? [0, 0, W, H] : OBJS[id - 1].box, band = BAND[id - 1], nr = Math.max(1, Math.ceil((box[3] - box[1]) / band)), yy = y - box[1] + 0.45 * wav(x * 3, id), row = cl(Math.floor(yy / band), 0, nr - 1), fx = cl((x - box[0]) / (box[2] - box[0]));+ idx[m] = g; who[m] = id; ord[m] = id === 8 ? 0 : (row + (row % 2 ? 1 - fx : fx)) / nr; lum[m] = Math.max(px[g * 4], px[g * 4 + 1], px[g * 4 + 2]) / 255;+ sIdx[m] = id === 5 && i >= SL.x0 && i < SL.x0 + SL.w && j >= SL.y0 && j < SL.y0 + SL.h ? (j - SL.y0) * SL.w + (i - SL.x0) : -1; m++; }+ const L = env.canvas(DW, DH); P = { idx, ord, lum, who, sIdx, img: L.ctx.createImageData(DW, DH), L }; env.cache.set(key, P); return P;+};+const SHADE = 0.4; // the shadow tone a form is laid in with, as a ceiling on its lightness+const forms = (ctx: Ctx, B: Built, env: Env, f: number) => {+ if (f <= CUE.form[0][0]) return; const P = plan(B, env), d = P.img.data, { px, bare, SL } = B;+ const pu = CUE.form.map((c) => cl((f - c[0]) / (c[1] - c[0]))), pm = CUE.form.map((c) => cl((f - c[2]) / (c[3] - c[2])));+ // the writing: line after line down the scroll, each one running out along its length+ const SLEN = SCROLL.s[SCROLL.n - 1], penAt = (j: number) => cl((f - (CUE.write[0] + (j + 5) * 7.4)) / 26) * (SLEN + 20);+ for (let m = 0; m < P.idx.length; m++) { const g = P.idx[m] * 4, id = P.who[m] - 1, o = P.ord[m];+ if (pu[id] < 1 && pu[id] * 1.0001 <= o) { d[g + 3] = 0; continue; }+ let r = px[g], gg = px[g + 1], b = px[g + 2];+ const k = P.sIdx[m]; if (k >= 0) { const line = cl(Math.round((SL.A2[k] - 5) / 19), -5, 5); if (SL.A1[k] > penAt(line)) { r = bare[k * 3]; gg = bare[k * 3 + 1]; b = bare[k * 3 + 2]; } }+ if (pm[id] < 1) { const t = cl((pm[id] * 1.4 - o) / 0.4), cap = SHADE + (1 - SHADE) * t * t * (3 - 2 * t), l = Math.max(r, gg, b) / 255, q = l > cap ? cap / l : 1; r *= q; gg *= q; b *= q; }+ d[g] = r; d[g + 1] = gg; d[g + 2] = b; d[g + 3] = px[g + 3]; }+ P.L.ctx.putImageData(P.img, 0, 0); ctx.drawImage(P.L.canvas, 0, 0);+};++export const drawDreamGlazeDraw = (ctx: Ctx, f: number, env: Env) => {+ if (f >= HOLD) { drawDreamGlaze(ctx, 0, env); return; }+ const B = built(env), s = env.scale, sky = [0, 0, W, YH], plain = [0, YH, W, H];+ ctx.setTransform(1, 0, 0, 1, 0, 0); ctx.globalAlpha = 1; ctx.globalCompositeOperation = "source-over"; ctx.imageSmoothingEnabled = true; ctx.imageSmoothingQuality = "high";+ ctx.fillStyle = "#f7f2e7"; ctx.fillRect(0, 0, B.DW, B.DH); // the primed panel+ if (f < CUE.sky1[1]) drawing(ctx, s, f); // under the first thin glaze the drawing still shows+ laid(ctx, s, B.bgN, f, CUE.sky1, sky, 84, 0.6); laid(ctx, s, B.bgN, f, CUE.sky2, sky, 84, 1);+ laid(ctx, s, B.bgN, f, CUE.plain1, plain, 62, 0.6); laid(ctx, s, B.bgN, f, CUE.plain2, plain, 62, 1);+ // cast shadows: painted outward from the things that throw them, the way the light runs+ if (f > CUE.shadows[0]) { const p = (f - CUE.shadows[0]) / (CUE.shadows[1] - CUE.shadows[0]), xf = -200 + p * (W + 260); ctx.save(); ctx.setTransform(s, 0, 0, s, 0, 0); ctx.beginPath(); ctx.moveTo(-10, YH); ctx.lineTo(xf + 200, YH); ctx.quadraticCurveTo(xf + 40, (YH + H) / 2, xf - 60, H + 10); ctx.lineTo(-10, H + 10); ctx.closePath(); ctx.clip(); ctx.setTransform(1, 0, 0, 1, 0, 0); ctx.drawImage(B.bgL.canvas, 0, 0); ctx.restore(); }+ if (f >= CUE.sky1[1]) drawing(ctx, s, f);+ // the further masks, furthest first, each laid in rows+ if (f > CUE.far[0]) { const each = (CUE.far[1] - CUE.far[0]) / COPIES.length; COPIES.forEach(([z, ax], i) => { const a = CUE.far[0] + i * each; if (f <= a) return; const k = Z0 / z, ay = YH + (F * CAMH) / z, T = copyLayer(B, env, z, ax); ctx.save(); ctx.setTransform(s, 0, 0, s, 0, 0); rows(ctx, ax + (330 - AX0) * k, ay + (300 - AY0) * k, ax + (1460 - AX0) * k, ay + 4, Math.max(5, 46 * k), (f - a) / each); ctx.setTransform(1, 0, 0, 1, 0, 0); ctx.drawImage(T.canvas, 0, 0); ctx.restore(); }); }+ if (f > CUE.stones[0]) smallThings(ctx, env, Math.ceil(((f - CUE.stones[0]) / (CUE.stones[1] - CUE.stones[0])) * 12), cl((f - CUE.figure[0]) / (CUE.figure[1] - CUE.figure[0])));+ if (f > CUE.sign[0]) signature(ctx, env, (f - CUE.sign[0]) / (CUE.sign[1] - CUE.sign[0]));+ forms(ctx, B, env, f);+ surface(ctx, env);+};++export const dreamGlazeDraw: Film = {+ meta: { title: "dreamGlazeDraw", W, H, fps: FPS, bpm: 60, durationFrames: N, raster: "cpu", kind: "drawing", holds: [[CUE.form[7][2], N, "only the spark and the signature are still being finished, both too small to measure; then the painting rests"]] },+ assets: { images: {} },+ shots: [{ id: "dreamGlazeDraw", start: 0, end: N, draw: drawDreamGlazeDraw }],+};diff --git a/plugins/anidoodle/skills/anidoodle/engine/src/hosts/page-dreamGlaze.ts b/plugins/anidoodle/skills/anidoodle/engine/src/hosts/page-dreamGlaze.tsnew file mode 100644index 0000000..c60244e--- /dev/null+++ b/plugins/anidoodle/skills/anidoodle/engine/src/hosts/page-dreamGlaze.ts@@ -0,0 +1,4 @@+import { dreamGlaze } from "../canvas-core/dreamGlaze";+import { mountFilm } from "./page";++mountFilm(dreamGlaze);diff --git a/plugins/anidoodle/skills/anidoodle/engine/src/hosts/page-dreamGlazeDraw.ts b/plugins/anidoodle/skills/anidoodle/engine/src/hosts/page-dreamGlazeDraw.tsnew file mode 100644index 0000000..f37b418--- /dev/null+++ b/plugins/anidoodle/skills/anidoodle/engine/src/hosts/page-dreamGlazeDraw.ts@@ -0,0 +1,4 @@+import { dreamGlazeDraw } from "../canvas-core/dreamGlazeDraw";+import { mountFilm } from "./page";++mountFilm(dreamGlazeDraw);diff --git a/plugins/anidoodle/skills/anidoodle/engine/styles.gen.json b/plugins/anidoodle/skills/anidoodle/engine/styles.gen.jsonindex 84f057e..462c689 100644--- a/plugins/anidoodle/skills/anidoodle/engine/styles.gen.json+++ b/plugins/anidoodle/skills/anidoodle/engine/styles.gen.json@@ -54,6 +54,17 @@"drawFilm": "colouredPencil","source": "scanned"},+ {+ "id": "dreamGlaze",+ "name": "Dream glaze",+ "family": "paint",+ "medium": "resin-thinned oil glazes laid with a very small soft brush on a smooth white ground: no visible stroke, every form turned pixel by pixel under one low sun, every edge hard",+ "nearest": "paintedOil",+ "hero": "a hollow mask of a calm face held up by question marks in an empty desert, its cheek running out into a scroll of handwriting",+ "module": "engine/src/canvas-core/dreamGlaze.ts",+ "drawFilm": "dreamGlazeDraw",+ "source": "scanned"+ },{"id": "embroidery","name": "Hand embroidery",diff --git a/plugins/anidoodle/skills/anidoodle/references/styles/INDEX.md b/plugins/anidoodle/skills/anidoodle/references/styles/INDEX.mdindex 33bf965..06ccbbc 100644--- a/plugins/anidoodle/skills/anidoodle/references/styles/INDEX.md+++ b/plugins/anidoodle/skills/anidoodle/references/styles/INDEX.md@@ -10,31 +10,32 @@ blocks in `engine/src/canvas-core/` plus `engine/styles.legacy.json`. Do not edi| 3 | Broken colour (`brokenColour`) | opaque oil dabs from a loaded flat hog brush on primed linen, unmixed colours side by side for the eye to mix | `engine/src/canvas-core/brokenColour.ts` | `engine/src/canvas-core/brokenColour.ts` || 4 | Charcoal, erased and redrawn (`charcoalErasure`) | vine and compressed charcoal on heavy rag paper, stumped, lifted with a kneaded eraser, redrawn over its own residue | `engine/src/canvas-core/charcoalErasure.ts` | `engine/src/canvas-core/charcoalErasure.ts` || 5 | Coloured pencil (`colouredPencil`) | wax coloured pencils hatched in one diagonal on toothy cream cartridge paper, hues layered, darks cross-hatched | `engine/src/canvas-core/colouredPencil.ts` | `engine/src/canvas-core/colouredPencil.ts` |-| 6 | Hand embroidery (`embroidery`) | stranded cotton floss stitched through natural plain-weave linen in a beech hoop | `engine/src/canvas-core/embroidery.ts` | `engine/src/canvas-core/embroidery.ts` |-| 7 | Flat vector (`flatVector`) | pen-tool paths in a vector app, flat fills that land when a path closes, long-shadow shapes with a transparency ramp, a raster grain brush over the shade sides | `engine/src/canvas-core/flatVector.ts` | `engine/src/canvas-core/flatVector.ts` |-| 8 | Folk-tale storybook (`folkTale`) | gouache and watercolour over an HB pencil drawing on cream cartridge: opaque, dry-brushed paint in the foreground thinning to a pale wash and then to bare pencil in the distance | `engine/src/canvas-core/folkTale.ts` | `engine/src/canvas-core/folkTale.ts` |-| 9 | Cut-paper collage (`fox`) | zero drawn lines: torn pieces with a white fibrous edge, scissor pieces crisp, each lifting a soft shadow off the piece below | `engine/src/canvas-core/fox.ts` | `engine/src/canvas-core/foxDraw.ts` |-| 10 | Newsprint halftone (`halftone`) | web-offset newspaper print: black on a 45 degree AM screen plus one orange spot at 15 degrees, oil ink gaining into unbleached groundwood newsprint | `engine/src/canvas-core/halftone.ts` | `engine/src/canvas-core/halftone.ts` |-| 11 | Isometric cutaway (`isometric`) | flat vector planes on a true 2:1 isometric grid, three tones per material, crisp edges, pen-tool order | `engine/src/canvas-core/isometric.ts` | `engine/src/canvas-core/isometric.ts` |-| 12 | Marker comic (`koi`) | alcohol-marker cel fills with a hard shadow edge under one heavy contour that thickens away from the light | `engine/src/canvas-core/koi.ts` | `engine/src/canvas-core/koiDraw.ts` |-| 13 | Risograph (`lighthouse`) | soy ink, one layer per drum multiplied through its own registration offset; every other colour an overprint, tone a halftone screen per ink angle, white is bare paper | `engine/src/canvas-core/lighthouse.ts` | `engine/src/canvas-core/lighthouseDraw.ts` |-| 14 | Low-poly (`lowPoly`) | triangle meshes projected by hand through a pinhole camera, each facet flat-shaded by its normal against one low sun, painter-sorted far to near; no 3D engine | `engine/src/canvas-core/lowPoly.ts` | `engine/src/canvas-core/lowPoly.ts` |-| 15 | Single-line engraving (`mellan`) | one unbroken engraved line whose width follows a procedural tone field: the whole picture is a single stroke | `engine/src/canvas-core/mellan.ts` | `engine/src/canvas-core/mellanUnspool.ts` |-| 16 | Mid-century gouache (`midCentury`) | opaque matte designer's gouache on warm illustration board, a dry brush dragged over the flats, a loose brush-and-ink line printed off register | `engine/src/canvas-core/midCentury.ts` | `engine/src/canvas-core/midCentury.ts` |-| 17 | Chalkboard (`moonPhases`) | side-of-the-chalk scumble on a slate board, lit limbs worked twice, every stroke broken by the board's tooth with dust either side, ghosts of old lessons | `engine/src/canvas-core/moonPhases.ts` | `engine/src/canvas-core/moonPhasesDraw.ts` |-| 18 | Oil on canvas (`paintedOil`) | opaque oil paint with hog-bristle brushes on a toned linen canvas, lean block-in to fat impasto | `engine/src/canvas-core/paintedOil.ts` | `engine/src/canvas-core/paintedOil.ts` |-| 19 | Toy-theatre paper collage (`paperCraft`) | a cardboard toy theatre: patterned and sugar papers cut and torn, gouache-painted cut-outs with a white sticker margin, every piece with a card edge and a gap to the flat behind | `engine/src/canvas-core/paperCraft.ts` | `engine/src/canvas-core/paperCraft.ts` |-| 20 | Pixel art (`pixelArt`) | a 120x120 grid of cells, each one of 16 declared palette colours, laid one cell at a time and blown up by a whole number, no smoothing | `engine/src/canvas-core/pixelArt.ts` | `engine/src/canvas-core/pixelArt.ts` |-| 21 | Ballpoint sketch (`pocketWatch`) | one blue ballpoint on cream cartridge, near-constant weight; tone only from where the hatching sits, plus the blob where a firm stroke stops | `engine/src/canvas-core/pocketWatch.ts` | `engine/src/canvas-core/pocketWatchDraw.ts` |-| 22 | Pencil & watercolour (`ranunculus`) | graphite and pan watercolour on cold-press: washes that never quite fill their outline, form shaded toward one light, graphite over the paint | `engine/src/canvas-core/ranunculus.ts` | `engine/src/canvas-core/ranunculusDraw.ts` |-| 23 | Rubber hose (`rubberHose`) | India ink at one pressure on a clear cel over a blue-pencil rough, flat grey paint on the back, photographed and printed on black-and-white film | `engine/src/canvas-core/rubberHose.ts` | `engine/src/canvas-core/rubberHose.ts` |-| 24 | Archival scrapbook (`scrapbook`) | foxed rag-paper album page; torn cards, cellulose tape, a clothespin on twine; copperplate engravings hand-tinted; typewriter, ransom-note cut letters, red pen, rubber stamp | `engine/src/canvas-core/scrapbook.ts` | `engine/src/canvas-core/scrapbook.ts` |-| 25 | Scratchboard (`scratchboard`) | white china clay under black India ink; every mark is ink scraped away with a knife or scratch nib | `engine/src/canvas-core/scratchboard.ts` | `engine/src/canvas-core/scratchboard.ts` |-| 26 | Pen-and-ink stipple (`stipple`) | one 0.25 mm technical pen dotted straight down onto hot-press bristol; tone is dot density only | `engine/src/canvas-core/stipple.ts` | `engine/src/canvas-core/stipple.ts` |-| 27 | Storybook pencil + watercolour (`storybook`) | storybook graphite and gentle pan watercolour, drawn for a recurring character | `engine/src/canvas-core/storybook.ts` | `engine/src/canvas-core/storybookDraw.ts` |-| 28 | Sumi-e ink painting (`sumiE`) | one loaded soft brush of sumi ink, five dilutions, on unsized absorbent xuan paper, with a cinnabar seal | `engine/src/canvas-core/sumiE.ts` | `engine/src/canvas-core/sumiE.ts` |-| 29 | Toy brick (`toyBrick`) | moulded ABS toy bricks, rendered flat-plastic in orthographic view: face tones by the cube rule, bevel highlights, seam hairlines, real studs, a soft ground shadow | `engine/src/canvas-core/toyBrick.ts` | `engine/src/canvas-core/toyBrick.ts` |-| 30 | Ukiyo-e colour woodblock (`woodcut`) | water-based pigment printed by baren from hand-carved cherry blocks onto damp kozo washi: a sumi keyblock, flat colour blocks, bokashi wipes | `engine/src/canvas-core/woodcut.ts` | `engine/src/canvas-core/woodcut.ts` |-| 31 | Ink & line-wash (`wren`) | wet washes first that flood past the line and settle along each shape's bottom edge, backruns, then a flexible nib thick on the press and hair-thin on the lift | `engine/src/canvas-core/wren.ts` | `engine/src/canvas-core/wrenDraw.ts` |+| 6 | Dream glaze (`dreamGlaze`) | resin-thinned oil glazes laid with a very small soft brush on a smooth white ground: no visible stroke, every form turned pixel by pixel under one low sun, every edge hard | `engine/src/canvas-core/dreamGlaze.ts` | `engine/src/canvas-core/dreamGlazeDraw.ts` |+| 7 | Hand embroidery (`embroidery`) | stranded cotton floss stitched through natural plain-weave linen in a beech hoop | `engine/src/canvas-core/embroidery.ts` | `engine/src/canvas-core/embroidery.ts` |+| 8 | Flat vector (`flatVector`) | pen-tool paths in a vector app, flat fills that land when a path closes, long-shadow shapes with a transparency ramp, a raster grain brush over the shade sides | `engine/src/canvas-core/flatVector.ts` | `engine/src/canvas-core/flatVector.ts` |+| 9 | Folk-tale storybook (`folkTale`) | gouache and watercolour over an HB pencil drawing on cream cartridge: opaque, dry-brushed paint in the foreground thinning to a pale wash and then to bare pencil in the distance | `engine/src/canvas-core/folkTale.ts` | `engine/src/canvas-core/folkTale.ts` |+| 10 | Cut-paper collage (`fox`) | zero drawn lines: torn pieces with a white fibrous edge, scissor pieces crisp, each lifting a soft shadow off the piece below | `engine/src/canvas-core/fox.ts` | `engine/src/canvas-core/foxDraw.ts` |+| 11 | Newsprint halftone (`halftone`) | web-offset newspaper print: black on a 45 degree AM screen plus one orange spot at 15 degrees, oil ink gaining into unbleached groundwood newsprint | `engine/src/canvas-core/halftone.ts` | `engine/src/canvas-core/halftone.ts` |+| 12 | Isometric cutaway (`isometric`) | flat vector planes on a true 2:1 isometric grid, three tones per material, crisp edges, pen-tool order | `engine/src/canvas-core/isometric.ts` | `engine/src/canvas-core/isometric.ts` |+| 13 | Marker comic (`koi`) | alcohol-marker cel fills with a hard shadow edge under one heavy contour that thickens away from the light | `engine/src/canvas-core/koi.ts` | `engine/src/canvas-core/koiDraw.ts` |+| 14 | Risograph (`lighthouse`) | soy ink, one layer per drum multiplied through its own registration offset; every other colour an overprint, tone a halftone screen per ink angle, white is bare paper | `engine/src/canvas-core/lighthouse.ts` | `engine/src/canvas-core/lighthouseDraw.ts` |+| 15 | Low-poly (`lowPoly`) | triangle meshes projected by hand through a pinhole camera, each facet flat-shaded by its normal against one low sun, painter-sorted far to near; no 3D engine | `engine/src/canvas-core/lowPoly.ts` | `engine/src/canvas-core/lowPoly.ts` |+| 16 | Single-line engraving (`mellan`) | one unbroken engraved line whose width follows a procedural tone field: the whole picture is a single stroke | `engine/src/canvas-core/mellan.ts` | `engine/src/canvas-core/mellanUnspool.ts` |+| 17 | Mid-century gouache (`midCentury`) | opaque matte designer's gouache on warm illustration board, a dry brush dragged over the flats, a loose brush-and-ink line printed off register | `engine/src/canvas-core/midCentury.ts` | `engine/src/canvas-core/midCentury.ts` |+| 18 | Chalkboard (`moonPhases`) | side-of-the-chalk scumble on a slate board, lit limbs worked twice, every stroke broken by the board's tooth with dust either side, ghosts of old lessons | `engine/src/canvas-core/moonPhases.ts` | `engine/src/canvas-core/moonPhasesDraw.ts` |+| 19 | Oil on canvas (`paintedOil`) | opaque oil paint with hog-bristle brushes on a toned linen canvas, lean block-in to fat impasto | `engine/src/canvas-core/paintedOil.ts` | `engine/src/canvas-core/paintedOil.ts` |+| 20 | Toy-theatre paper collage (`paperCraft`) | a cardboard toy theatre: patterned and sugar papers cut and torn, gouache-painted cut-outs with a white sticker margin, every piece with a card edge and a gap to the flat behind | `engine/src/canvas-core/paperCraft.ts` | `engine/src/canvas-core/paperCraft.ts` |+| 21 | Pixel art (`pixelArt`) | a 120x120 grid of cells, each one of 16 declared palette colours, laid one cell at a time and blown up by a whole number, no smoothing | `engine/src/canvas-core/pixelArt.ts` | `engine/src/canvas-core/pixelArt.ts` |+| 22 | Ballpoint sketch (`pocketWatch`) | one blue ballpoint on cream cartridge, near-constant weight; tone only from where the hatching sits, plus the blob where a firm stroke stops | `engine/src/canvas-core/pocketWatch.ts` | `engine/src/canvas-core/pocketWatchDraw.ts` |+| 23 | Pencil & watercolour (`ranunculus`) | graphite and pan watercolour on cold-press: washes that never quite fill their outline, form shaded toward one light, graphite over the paint | `engine/src/canvas-core/ranunculus.ts` | `engine/src/canvas-core/ranunculusDraw.ts` |+| 24 | Rubber hose (`rubberHose`) | India ink at one pressure on a clear cel over a blue-pencil rough, flat grey paint on the back, photographed and printed on black-and-white film | `engine/src/canvas-core/rubberHose.ts` | `engine/src/canvas-core/rubberHose.ts` |+| 25 | Archival scrapbook (`scrapbook`) | foxed rag-paper album page; torn cards, cellulose tape, a clothespin on twine; copperplate engravings hand-tinted; typewriter, ransom-note cut letters, red pen, rubber stamp | `engine/src/canvas-core/scrapbook.ts` | `engine/src/canvas-core/scrapbook.ts` |+| 26 | Scratchboard (`scratchboard`) | white china clay under black India ink; every mark is ink scraped away with a knife or scratch nib | `engine/src/canvas-core/scratchboard.ts` | `engine/src/canvas-core/scratchboard.ts` |+| 27 | Pen-and-ink stipple (`stipple`) | one 0.25 mm technical pen dotted straight down onto hot-press bristol; tone is dot density only | `engine/src/canvas-core/stipple.ts` | `engine/src/canvas-core/stipple.ts` |+| 28 | Storybook pencil + watercolour (`storybook`) | storybook graphite and gentle pan watercolour, drawn for a recurring character | `engine/src/canvas-core/storybook.ts` | `engine/src/canvas-core/storybookDraw.ts` |+| 29 | Sumi-e ink painting (`sumiE`) | one loaded soft brush of sumi ink, five dilutions, on unsized absorbent xuan paper, with a cinnabar seal | `engine/src/canvas-core/sumiE.ts` | `engine/src/canvas-core/sumiE.ts` |+| 30 | Toy brick (`toyBrick`) | moulded ABS toy bricks, rendered flat-plastic in orthographic view: face tones by the cube rule, bevel highlights, seam hairlines, real studs, a soft ground shadow | `engine/src/canvas-core/toyBrick.ts` | `engine/src/canvas-core/toyBrick.ts` |+| 31 | Ukiyo-e colour woodblock (`woodcut`) | water-based pigment printed by baren from hand-carved cherry blocks onto damp kozo washi: a sumi keyblock, flat colour blocks, bokashi wipes | `engine/src/canvas-core/woodcut.ts` | `engine/src/canvas-core/woodcut.ts` |+| 32 | Ink & line-wash (`wren`) | wet washes first that flood past the line and settle along each shape's bottom edge, backruns, then a flexible nib thick on the press and hair-thin on the lift | `engine/src/canvas-core/wren.ts` | `engine/src/canvas-core/wrenDraw.ts` |-31 styles.+32 styles.diff --git a/plugins/anidoodle/skills/anidoodle/references/styles/dreamGlaze.md b/plugins/anidoodle/skills/anidoodle/references/styles/dreamGlaze.mdnew file mode 100644index 0000000..b89165f--- /dev/null+++ b/plugins/anidoodle/skills/anidoodle/references/styles/dreamGlaze.md@@ -0,0 +1,19 @@+# Dream glaze (hand-painted dream) · `dreamGlaze.ts`++**Medium, physically.** Oil thinned with resin, laid in thin glazes with a very small soft brush on a smooth white ground. The surface is enamel-flat: no bristle, no ridge, no visible stroke. This is the hand of the "hand-painted dream photograph": an impossible scene painted as carefully as a still life.++**The mark.** None that shows. A form is turned by value steps too fine to see, so the unit is the single pixel, each one lit by the same sun. Every standing thing is a height field (`Obj.at` returns its edge distance, its height toward the eye, two surface coordinates and a material); the painter takes the normal from the heights, walks toward the sun across them for cast shadows (`sunAt`), and mixes a warm sun, a cool sky and a warm bounce from the ground (`light`). Nothing is a stroke, a gradient fill or a blur.++**The edge.** Hard, near and far alike. Depth is haze and scale, never softness. A thing a mile off is as sharp as a thing at arm's length, only smaller and paler.++**Order.** A white primed panel; the drawing in thin umber; the sky laid twice (a thin glaze, then the full one) in rows from the top; the plain the same way; each form, furthest first, laid in its shadow tone; the cast shadows; the small accents (handwriting, lashes, stars); the main form worked up dark to light, last and slowest; the signature.++**Space and light.** A pinhole camera over an endless plain, the horizon low. One low sun, front-left: every form is lit from it and every shadow rakes right and away, computed on the ground from the same alpha that draws the object. Small figures and repeated objects give the scale.++**Palette & ground.** Ultramarine falling through turquoise to lemon at the horizon; an ochre and umber plain; waxy flesh; violet-umber shadows; one saturated orange, kept for a single accent. A fine linen weave at 4% and the core `paper` tile at 5%; the corners a little sunk, as old varnish does.++**Not its neighbour.** `paintedOil` shows its bristle, loses its edges into shadow and works wet into wet. Dream glaze hides the brush and keeps every edge; its drama is in the idea and the light, never in the paint.++**Subject rule.** The hand is only half of it. The picture needs soft things that should be hard, things held up that should fall, one object repeated to the horizon, and one image hiding a second meaning. Invent your own props for your own subject; never re-stage a known painting.++**Motion grammar.** Marks arrive; nothing fades. Grounds are laid in boustrophedon rows whose lower edge wavers (`rows`). Forms are laid in a shadow tone and then worked up: a ceiling on lightness rises across the form, so shadows finish first and highlights last (`forms`). Handwriting runs out along its line. The last frames are the still, pixel for pixel.diff --git a/plugins/anidoodle/skills/anidoodle/references/workflows/launch-video.md b/plugins/anidoodle/skills/anidoodle/references/workflows/launch-video.mdindex 7510821..51b23df 100644--- a/plugins/anidoodle/skills/anidoodle/references/workflows/launch-video.md+++ b/plugins/anidoodle/skills/anidoodle/references/workflows/launch-video.md@@ -64,7 +64,7 @@ pieces are examples of the craft, never material for someone else's film.product's UI, the detail the shot is about, or busy texture. Check it in a review still atthe smallest delivery size. In doubt, the word gets its own frame.- **3-7 words a frame, few frames.** Collapse word cards into one claim then proof ("JUST CODE."- then "31 STYLES"); fewer cards leave more time for the proof.+ then "32 STYLES"); fewer cards leave more time for the proof.- **Hold each settled word 0.5 s or more**, longer for the claim.- **Judge DESIGN in review stills, not only collisions**: hierarchy, spacing, whether the framewould pass as a poster. A frame with nothing overlapping can still be ugly.diff --git a/plugins/anidoodle/skills/anidoodle/references/working-method.md b/plugins/anidoodle/skills/anidoodle/references/working-method.mdindex e9f0de4..3cc3e8f 100644--- a/plugins/anidoodle/skills/anidoodle/references/working-method.md+++ b/plugins/anidoodle/skills/anidoodle/references/working-method.md@@ -68,7 +68,7 @@ None of that was drawing. These habits cut it by an order of magnitude:is every 50th frame from 0 to 300. Add `--sheet out/sheet.jpg` for a contact sheet of them at`--sheet-scale` (default 0.4). `--out out/dir/` or `--out out/x-{frame}.png` names the PNGs.- **Plate cache.** Finished plate frames are kept in `engine/.cache/bakes/<browser version>-<binary>/`,- keyed by a hash of the plate's whole import closure, so a wall of 31 live plates stops+ keyed by a hash of the plate's whole import closure, so a wall of 32 live plates stopsre-baking (about 60 s) on every still, and an edited plate simply misses and is drawn again.It is never needed: delete `.cache/` any time. `--no-bake-cache` (or `ANIDOODLE_BAKE_CACHE=0`)draws every plate cold, which is what to do when you suspect the cache.diff --git a/scripts/plugin-README.md b/scripts/plugin-README.mdindex 3658bae..76858a4 100644--- a/scripts/plugin-README.md+++ b/scripts/plugin-README.md@@ -2,7 +2,7 @@**Hand-drawn art, written as code.**-anidoodle makes illustrations, drawing timelapses, films of any length, explainers, infographics and interactive web animations in 31 hand-made styles, with original music composed as data and played by an engine written in code. Ask for a picture in plain words, match a style from your own image, recreate a photo in any style, keep a character consistent across scenes, or learn step by step how a drawing is built.+anidoodle makes illustrations, drawing timelapses, films of any length, explainers, infographics and interactive web animations in 32 hand-made styles, with original music composed as data and played by an engine written in code. Ask for a picture in plain words, match a style from your own image, recreate a photo in any style, keep a character consistent across scenes, or learn step by step how a drawing is built.Music is composed for each piece from 21 genre vocabularies, never presets, and played by a sound engine written in code: a piano modelled on a real Steinway, Rhodes and Wurlitzer, orchestral sections and choir, guitars, real drum kits, real lo-fi, a full mix with reverb. An optional sound pack adds recordings of eight real acoustic instruments and three recorded rooms; every score plays without it. `music.mjs check` clears a score (key, loudness, balance, novelty) before anyone listens. The launch kit turns your product's prompts, screens and install lines into a launch film in four shapes (16:9, 1:1, 4:5, 9:16), with sound cued from the picture, captions and a sync check; `launch.mjs new` starts one and `launch.mjs ship` delivers every shape.diff --git a/skills/anidoodle/SKILL.md b/skills/anidoodle/SKILL.mdindex 8a12dac..03f2a5b 100644--- a/skills/anidoodle/SKILL.md+++ b/skills/anidoodle/SKILL.md@@ -1,6 +1,6 @@---name: anidoodle-description: Code-drawn stills, drawing timelapses, films, explainers and interactive web animations in 31 styles, with composed scores. Matches a reference style, keeps characters consistent, teaches drawing. Deterministic, no generated assets.+description: Code-drawn stills, drawing timelapses, films, explainers and interactive web animations in 32 styles, with composed scores. Matches a reference style, keeps characters consistent, teaches drawing. Deterministic, no generated assets.metadata:created_by: Alex Greenshpun (10x Company)license: Apache-2.0diff --git a/skills/anidoodle/assets/styles.jpg b/skills/anidoodle/assets/styles.jpgindex d22375c..29ef0e4 100644Binary files a/skills/anidoodle/assets/styles.jpg and b/skills/anidoodle/assets/styles.jpg differdiff --git a/skills/anidoodle/engine/package-lock.json b/skills/anidoodle/engine/package-lock.jsonindex da20b4c..243d7cf 100644--- a/skills/anidoodle/engine/package-lock.json+++ b/skills/anidoodle/engine/package-lock.json@@ -1,12 +1,12 @@{"name": "anidoodle-engine",- "version": "0.6.4",+ "version": "0.7.0","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "anidoodle-engine",- "version": "0.6.4",+ "version": "0.7.0","dependencies": {"esbuild": "0.25.12"},diff --git a/skills/anidoodle/engine/package.json b/skills/anidoodle/engine/package.jsonindex a7ad999..46c992b 100644--- a/skills/anidoodle/engine/package.json+++ b/skills/anidoodle/engine/package.json@@ -1,6 +1,6 @@{"name": "anidoodle-engine",- "version": "0.6.4",+ "version": "0.7.0","private": true,"type": "module","description": "Portable art core + backend adapters for illustrations, animations and films drawn entirely in code.",diff --git a/skills/anidoodle/engine/src/canvas-core/dreamGlaze.ts b/skills/anidoodle/engine/src/canvas-core/dreamGlaze.tsnew file mode 100644index 0000000..9a01dbb--- /dev/null+++ b/skills/anidoodle/engine/src/canvas-core/dreamGlaze.ts@@ -0,0 +1,371 @@+import { Gfx, PENCIL, rng, type Ctx, type Env } from "./core";+import { weave } from "./paintedOilKit";+import { Film } from "./film";++// SOFT SELF-PORTRAIT HELD UP BY ITS QUESTIONS · resin-oil glazes, a very small brush.+//+// MEDIUM, physically: oil thinned with resin, laid in thin glazes with a tiny soft brush on a+// smooth white ground. THE MARK: none that shows. A form is turned by value steps too fine to+// see, so the unit here is the single pixel, each one lit by the one sun; nothing is a stroke.+// THE EDGE: hard, near and far alike. Depth is haze and scale, never blur.+// ORDER: sky and plain as smooth grounds; forms modelled dark to light; cast shadows; last the+// small sharp accents (lashes, the mouth line, the handwriting, the stars in the window).+// PALETTE: ultramarine falling through turquoise to lemon at the horizon; an ochre and umber+// plain; waxy flesh; violet-umber shadows; one orange, kept for the spark.+// LIGHT: one low sun, front-left and a little above. Everything is lit from it; every shadow+// falls right and away toward the horizon.+// SUBJECT and STRUCTURE: a hollow mask of a calm face, eyes closed, frontal, leaning five degrees.+// Proportions are the face's thirds (brow, nose base, chin), eyes one eye-width apart, the nose as+// wide as an eye, the mouth a third of the way down the lowest third. The crown is cut open. A+// window is cut in the forehead with a night sky and one spark inside. The right cheek runs out+// into a soft scroll of handwriting. Two question marks hold it up; their stems stop short of+// their dots. The same mask repeats to the horizon.+// NOT: `paintedOil` shows its bristle and loses its edges; this hand hides the brush and keeps+// every edge. No composition, figure or prop from any existing painting is re-staged.++export const W = 1600, H = 2000;+export const cl = (v: number, a = 0, b = 1) => (v < a ? a : v > b ? b : v);+export const sm = (a: number, b: number, x: number) => { const t = cl((x - a) / (b - a)); return t * t * (3 - 2 * t); };+export const G = (du: number, dv: number, su: number, sv: number) => Math.exp(-(du * du) / (su * su) - (dv * dv) / (sv * sv));++// ---------------------------------------------------------------- noise (pure arithmetic)+export const hash2 = (ix: number, iy: number, seed: number) => { let h = Math.imul(ix, 374761393) ^ Math.imul(iy, 668265263) ^ Math.imul(seed + 1, 1442695041); h = Math.imul(h ^ (h >>> 13), 1274126177); return ((h ^ (h >>> 16)) >>> 0) / 4294967296; };+export const vnoise = (x: number, y: number, seed: number) => { const x0 = Math.floor(x), y0 = Math.floor(y), fx = x - x0, fy = y - y0, sx = fx * fx * (3 - 2 * fx), sy = fy * fy * (3 - 2 * fy); const a = hash2(x0, y0, seed), b = hash2(x0 + 1, y0, seed), c = hash2(x0, y0 + 1, seed), d = hash2(x0 + 1, y0 + 1, seed); return a + (b - a) * sx + (c - a + (a - b - c + d) * sx) * sy; };+export const fbm = (x: number, y: number, oct: number, seed: number) => { let s = 0, a = 0.5, n = 0; for (let o = 0; o < oct; o++) { s += vnoise(x, y, seed + o * 17) * a; n += a; a *= 0.5; x *= 2.03; y *= 2.03; } return s / n; };++// ---------------------------------------------------------------- colour+export type C3 = [number, number, number];+export const hex = (h: string): C3 => [parseInt(h.slice(1, 3), 16), parseInt(h.slice(3, 5), 16), parseInt(h.slice(5, 7), 16)];+export const lin = (h: string): C3 => hex(h).map((v) => Math.pow(v / 255, 2.2)) as C3;+export const ramp = (stops: [number, C3][], t: number, out: C3) => { if (t <= stops[0][0]) { out[0] = stops[0][1][0]; out[1] = stops[0][1][1]; out[2] = stops[0][1][2]; return; } for (let i = 1; i < stops.length; i++) if (t <= stops[i][0]) { const [t0, a] = stops[i - 1], [t1, b] = stops[i], f = (t - t0) / (t1 - t0); out[0] = a[0] + (b[0] - a[0]) * f; out[1] = a[1] + (b[1] - a[1]) * f; out[2] = a[2] + (b[2] - a[2]) * f; return; } const l = stops[stops.length - 1][1]; out[0] = l[0]; out[1] = l[1]; out[2] = l[2]; };+const SKY: [number, C3][] = [[0, hex("#0d2450")], [0.26, hex("#1f4f8c")], [0.5, hex("#4a8dba")], [0.7, hex("#8fc2bd")], [0.86, hex("#dcd9a4")], [0.95, hex("#f1d491")], [1, hex("#f4c486")]];+export const GROUND: [number, C3][] = [[0, hex("#8f5f2c")], [0.3, hex("#b98646")], [0.62, hex("#d6b170")], [1, hex("#ecd7a4")]];++// ---------------------------------------------------------------- the space+// A pinhole camera 1.6 units above an endless plain. The horizon sits at 65 % of the height.+export const YH = 1300, F = 1800, CAMH = 1.6, CX = 800;+const n3 = (v: number[]) => { const l = Math.hypot(v[0], v[1], v[2]); return [v[0] / l, v[1] / l, v[2] / l]; };+export const LW = n3([-0.6, 0.42, -0.68]); // to the sun, world: x right, y up, z into the picture+export const LS = [LW[0], -LW[1], -LW[2]]; // the same, screen: x right, y down, z toward the eye+const LXY = Math.hypot(LS[0], LS[1]), LDX = LS[0] / LXY, LDY = LS[1] / LXY, RISE = LS[2] / LXY;+const HV = n3([LS[0], LS[1], LS[2] + 1]); // half vector, for the wet highlight+const SUN = [1.3, 1.1, 0.8], SKYL = [0.3, 0.44, 0.8], BNC = [0.85, 0.46, 0.18];+// the main group stands where its dots touch the plain+export const AX0 = 678, AY0 = 1570, Z0 = (F * CAMH) / (AY0 - YH);+// the same mask, further and further off: [depth, screen x of the dot]+export const COPIES: [number, number][] = [[430, 506], [215, 446], [104, 336], [50, 118]];++// ---------------------------------------------------------------- the face, a height field+// u across (half width 0.5 at the cheekbones), v down (brow -0.235, nose base 0.235, chin 0.70).+export const MX = 640, MY = 730, S = 600, TILT = (-5 * Math.PI) / 180, CT = Math.cos(TILT), ST = Math.sin(TILT);+const MBASE = 60;+export const halfW = (v: number) => { if (v < -0.05) { const t = (-v - 0.05) / 0.5; return 0.5 - 0.045 * t * t; } const t = cl((v + 0.05) / 0.75); return 0.5 * Math.pow(Math.max(0, 1 - Math.pow(t, 2.2)), 0.55); };+export const WIN = { u0: -0.1, u1: 0.1, v0: -0.485, v1: -0.345, wall: 0.017 };+export const mouthLine = (u: number) => 0.405 - 0.019 * (u / 0.16) * (u / 0.16) + 0.006 * Math.exp(-(u * u) / 0.0009);+export const lashLine = (au: number) => { const x = (au - 0.218) / 0.095; return -0.094 - 0.026 * x * x; };+const faceH = (u: number, v: number) => {+ const au = Math.abs(u), a = halfW(v);+ let q = a > 0.001 ? 1 - (u / a) * (u / a) : 0; if (q < 0) q = 0;+ const da = (halfW(v + 0.004) - a) / 0.004, dA = (a - Math.sqrt(u * u + 0.0049)) / Math.sqrt(1 + da * da), dB = (0.7 - v) * 0.9, hm = cl(0.5 + (0.5 * (dB - dA)) / 0.12), de = cl((dB + (dA - dB) * hm - 0.12 * hm * (1 - hm)) / 0.34), bev = Math.sqrt(1 - (1 - de) * (1 - de));+ let hb = 0.2 * bev + 0.17 * Math.pow(q, 0.5) * (1 - sm(0.22, 0.62, v)); // a shell rounded in from its edge, fuller across the cheekbones+ const tf = cl((-0.25 - v) / 0.45); hb *= 1 - 0.22 * tf * tf; // the forehead rolls back+ let f = 0;+ const bv = -0.255 + 0.55 * (au - 0.2) * (au - 0.2);+ f += 0.048 * G(au - 0.21, v - bv, 0.17, 0.048); // brow ridge, arched+ f -= 0.082 * G(au - 0.215, v + 0.135, 0.115, 0.072); // the orbit+ f -= 0.035 * G(au - 0.105, v + 0.125, 0.05, 0.065); // deeper by the nose+ f += 0.062 * G(au - 0.218, v + 0.118, 0.088, 0.048); // the closed lid over the eyeball+ const lx = (au - 0.218) / 0.095;+ if (lx > -1.3 && lx < 1.3) { const fade = 1 - sm(0.95, 1.25, Math.abs(lx)); f -= 0.011 * Math.exp(-Math.pow((v - lashLine(au)) / 0.008, 2)) * fade; f -= 0.006 * Math.exp(-Math.pow((v - (-0.152 + 0.03 * lx * lx)) / 0.009, 2)) * fade; }+ const tn = (v + 0.22) / 0.44; // 0 at the root, 1 at the tip+ if (tn > -0.3 && tn < 1.2) { const t = cl(tn), nh = 0.03 + 0.15 * Math.pow(t, 1.4), sg = 0.029 + 0.027 * t; f += nh * Math.exp(-(u * u) / (sg * sg)) * sm(-0.3, 0.1, tn) * (1 - sm(0.97, 1.13, tn)); }+ f += 0.05 * G(u, v - 0.188, 0.05, 0.046); // the ball of the tip+ f += 0.058 * G(au - 0.084, v - 0.203, 0.034, 0.034); f -= 0.014 * G(au - 0.125, v - 0.19, 0.02, 0.035); // the wings+ f += 0.045 * G(au - 0.33, v - 0.02, 0.15, 0.13); // cheekbones+ f += 0.035 * G(u, v - 0.41, 0.21, 0.13); // the muzzle the mouth sits on+ f -= 0.01 * G(u, v - 0.305, 0.02, 0.045); // philtrum+ f += 0.04 * G(u, v - 0.372, 0.125, 0.026) * (1 - 0.35 * Math.exp(-(u * u) / 0.0005)); // upper lip and its bow+ f += 0.052 * G(u, v - 0.438, 0.1, 0.034); // lower lip+ f -= 0.035 * Math.exp(-Math.pow((v - mouthLine(u)) / 0.01, 2)) * (1 - sm(0.14, 0.175, au)); // the mouth line+ f -= 0.02 * G(au - 0.165, v - 0.395, 0.025, 0.025); // its corners+ f -= 0.028 * G(u, v - 0.5, 0.11, 0.03); // the fold above the chin+ f += 0.066 * G(u, v - 0.59, 0.14, 0.085); // chin+ return hb + f * sm(0, 0.22, q);+};+export const RIMW = 0.4455;+export const crown = (u: number) => -0.6 + (0.03 * Math.sin(u * 9 + 1) + 0.018 * Math.sin(u * 23 + 2) + 0.01 * Math.sin(u * 51)) * Math.max(0, 1 - Math.pow(u / RIMW, 6));++// ---------------------------------------------------------------- curves: question marks and the scroll+export type Curve = { x: Float32Array; y: Float32Array; r: Float32Array; s: Float32Array; k: Float32Array; n: number };+const curve = (cp: number[][], per = 14): Curve => {+ const xs: number[] = [], ys: number[] = [], rs: number[] = [], g = (i: number) => cp[Math.max(0, Math.min(cp.length - 1, i))];+ for (let i = 0; i < cp.length - 1; i++) for (let j = 0; j < per; j++) { const t = j / per, p0 = g(i - 1), p1 = g(i), p2 = g(i + 1), p3 = g(i + 2), cr = (k: number) => 0.5 * (2 * p1[k] + (-p0[k] + p2[k]) * t + (2 * p0[k] - 5 * p1[k] + 4 * p2[k] - p3[k]) * t * t + (-p0[k] + 3 * p1[k] - 3 * p2[k] + p3[k]) * t * t * t); xs.push(cr(0)); ys.push(cr(1)); rs.push(cr(2)); }+ const e = cp[cp.length - 1]; xs.push(e[0]); ys.push(e[1]); rs.push(e[2]);+ const n = xs.length, s = new Float32Array(n), k = new Float32Array(n);+ for (let i = 1; i < n; i++) s[i] = s[i - 1] + Math.hypot(xs[i] - xs[i - 1], ys[i] - ys[i - 1]);+ for (let i = 1; i < n - 1; i++) { const a1 = Math.atan2(ys[i] - ys[i - 1], xs[i] - xs[i - 1]), a2 = Math.atan2(ys[i + 1] - ys[i], xs[i + 1] - xs[i]); let d = a2 - a1; while (d > Math.PI) d -= 2 * Math.PI; while (d < -Math.PI) d += 2 * Math.PI; k[i] = d / Math.max(1e-3, (s[i + 1] - s[i - 1]) / 2); }+ return { x: Float32Array.from(xs), y: Float32Array.from(ys), r: Float32Array.from(rs), s, k, n };+};+// nearest point on a curve: distance, arc length, radius there, side (+ is right of travel), curvature+const NR = { d: 0, s: 0, r: 0, side: 0, k: 0 };+const near = (c: Curve, px: number, py: number) => {+ let best = 1e18, bi = 0, bt = 0;+ for (let i = 0; i < c.n - 1; i++) { const ax = c.x[i], ay = c.y[i], dx = c.x[i + 1] - ax, dy = c.y[i + 1] - ay, l2 = dx * dx + dy * dy; let t = l2 > 0 ? ((px - ax) * dx + (py - ay) * dy) / l2 : 0; t = t < 0 ? 0 : t > 1 ? 1 : t; const ex = px - ax - dx * t, ey = py - ay - dy * t, d2 = ex * ex + ey * ey; if (d2 < best) { best = d2; bi = i; bt = t; } }+ const dx = c.x[bi + 1] - c.x[bi], dy = c.y[bi + 1] - c.y[bi];+ NR.d = Math.sqrt(best); NR.s = c.s[bi] + (c.s[bi + 1] - c.s[bi]) * bt; NR.r = c.r[bi] + (c.r[bi + 1] - c.r[bi]) * bt; NR.k = c.k[bi] + (c.k[bi + 1] - c.k[bi]) * bt;+ NR.side = dx * (py - c.y[bi]) - dy * (px - c.x[bi]) >= 0 ? 1 : -1;+};+// [x, y, radius]: a hook that cradles, a stem that stops short, a dot on the ground+export const Q1 = curve([[578, 1226, 8], [588, 1184, 13], [634, 1154, 19], [698, 1150, 22], [750, 1184, 22], [760, 1244, 20], [724, 1300, 17], [688, 1346, 14], [678, 1400, 12], [678, 1456, 9]]);+export const Q2 = curve([[1128, 1082, 7], [1138, 1036, 12], [1184, 1002, 17], [1240, 1002, 19], [1272, 1042, 19], [1268, 1102, 17], [1236, 1152, 15], [1212, 1204, 13], [1208, 1300, 11], [1208, 1446, 8]]);+export const DOT1 = [678, 1540, 30], DOT2 = [1208, 1538, 25];+// the scroll: [x, y, half width]. It leaves the cheek, lies along the second hook, and hangs.+export const SCROLL = curve([[800, 705, 118], [900, 742, 104], [1000, 806, 88], [1100, 868, 76], [1196, 908, 70], [1280, 926, 66], [1340, 976, 60], [1366, 1060, 54], [1366, 1160, 48], [1350, 1260, 42], [1352, 1350, 34], [1368, 1420, 26]], 16);+const SLEN = SCROLL.s[SCROLL.n - 1];++// ---------------------------------------------------------------- objects, back to front+// Each returns: edge distance in px (+ inside), height toward the eye in px, two coordinates the+// painter needs, and which material it is.+export type Obj = { box: [number, number, number, number]; at: (x: number, y: number, o: Float32Array) => void };+export const M_FLESH = 1, M_NIGHT = 2, M_WALL = 3, M_WOOD = 4, M_SCROLL = 5;+const tube = (c: Curve, pad: number): Obj => { let x0 = 1e9, y0 = 1e9, x1 = -1e9, y1 = -1e9; for (let i = 0; i < c.n; i++) { x0 = Math.min(x0, c.x[i] - c.r[i]); x1 = Math.max(x1, c.x[i] + c.r[i]); y0 = Math.min(y0, c.y[i] - c.r[i]); y1 = Math.max(y1, c.y[i] + c.r[i]); } return { box: [x0 - pad, y0 - pad, x1 + pad, y1 + pad], at: (x, y, o) => { near(c, x, y); const r = NR.r, d = NR.d; o[0] = r - d; o[1] = d < r ? Math.sqrt(r * r - d * d) : 0; o[2] = NR.s; o[3] = d * NR.side; o[4] = M_WOOD; } }; };+const ball = (b: number[]): Obj => ({ box: [b[0] - b[2] - 3, b[1] - b[2] - 3, b[0] + b[2] + 3, b[1] + b[2] + 3], at: (x, y, o) => { const d = Math.hypot(x - b[0], y - b[1]), r = b[2]; o[0] = r - d; o[1] = d < r ? Math.sqrt(r * r - d * d) : 0; o[2] = x * 0.6; o[3] = y - b[1]; o[4] = M_WOOD; } });+export const scrollW = (s: number, r: number) => { const e = SLEN - s; return e < 40 ? r * Math.sqrt(Math.max(0, 1 - Math.pow(1 - e / 40, 2))) : r; };+const scroll: Obj = { box: [680, 560, 1440, 1460], at: (x, y, o) => {+ near(SCROLL, x, y); const w = scrollW(NR.s, NR.r), d = NR.d, q = Math.max(0, 1 - (d / Math.max(1, w)) * (d / Math.max(1, w)));+ // where it bends it wrinkles on the inside of the bend, as soft matter does+ const bend = cl(Math.abs(NR.k) * 90), inner = 0.5 + 0.5 * cl((NR.side * Math.sign(NR.k) * d) / Math.max(1, w), -1, 1);+ o[0] = NR.s <= 0.5 || NR.s >= SLEN - 0.01 ? Math.min(w - d, -1) + (NR.s >= SLEN - 0.01 && d < 1 ? 1 : 0) : w - d;+ o[1] = 22 + 15 * Math.pow(q, 0.5) + 3.2 * Math.sin(NR.s * 0.19) * bend * inner + 2 * Math.sin(NR.s * 0.021 + 1) * q;+ o[2] = NR.s; o[3] = d * NR.side; o[4] = M_SCROLL;+} };+const mask: Obj = { box: [MX - 0.56 * S, MY - 0.76 * S, MX + 0.56 * S, MY + 0.76 * S], at: (x, y, o) => {+ const X = (x - MX) / S, Y = (y - MY) / S, u = X * CT + Y * ST, v = -X * ST + Y * CT, a = halfW(v), da = (halfW(v + 0.004) - a) / 0.004;+ let e = ((a - Math.abs(u)) * S) / Math.sqrt(1 + da * da);+ const front = (v - crown(u)) * S * 0.92;+ e = Math.min(e, front, (0.699 - v) * S);+ const h = MBASE + faceH(u, v) * S;+ o[1] = h; o[2] = u; o[3] = v; o[4] = M_FLESH;+ if (u > WIN.u0 && u < WIN.u1 && v > WIN.v0 && v < WIN.v1) { // the window in the forehead+ const open = u > WIN.u0 + WIN.wall && v > WIN.v0 + WIN.wall; // we look up into it from the right: left and top walls show+ o[4] = open ? M_NIGHT : M_WALL; o[1] = h - (open ? 26 : 12);+ }+ o[0] = e;+} };+export const M_INSIDE = 6;+export const backRim = (u: number) => -0.6 - 0.085 * Math.sqrt(Math.max(0, 1 - (u / RIMW) * (u / RIMW)));+// above the cut we look down into the shell and see its far wall from inside+const inside: Obj = { box: [MX - 0.56 * S, MY - 0.76 * S, MX + 0.56 * S, MY - 0.5 * S], at: (x, y, o) => {+ const X = (x - MX) / S, Y = (y - MY) / S, u = X * CT + Y * ST, v = -X * ST + Y * CT, cu = Math.sqrt(Math.max(0, 1 - (u / RIMW) * (u / RIMW)));+ o[0] = Math.min((v - backRim(u)) * S, (RIMW - Math.abs(u)) * S, (crown(u) + 0.02 - v) * S); o[1] = MBASE - 30 - 60 * cu; o[2] = u; o[3] = v; o[4] = M_INSIDE;+} };+export const OBJS: Obj[] = [tube(Q2, 3), tube(Q1, 3), ball(DOT2), ball(DOT1), scroll, inside, mask];++// ---------------------------------------------------------------- the painter+const FLESH = lin("#ecd0ac"), LIP = lin("#c9836c"), PAPERC = lin("#efe2c4"), INK = lin("#3a2414"), WOOD = lin("#6b3c1c"), WOODD = lin("#3a1e0e");+// faux handwriting: arches for the small letters, the odd ascender and descender, gaps for words+export const script = (s: number, d: number, w: number) => {+ let ink = 0;+ for (let j = -5; j <= 5; j++) { const base = j * 19 + 5; if (Math.abs(base) > w - 11) continue; const cw = 7.6, cell = Math.floor(s / cw), word = hash2(Math.floor(s / 47 + j * 3.7), j, 5); if (hash2(cell, j, 9) < 0.12 || word < 0.1) continue;+ const lx = s / cw - cell, hh = hash2(cell, j, 3), yy = d - base, X = (lx - 0.5) * cw, amp = 3.6 + 2 * hash2(cell, j, 4);+ let dist = Math.abs(yy) + (lx > 0.8 || lx < 0.2 ? 0 : 3); // the thread that joins letter to letter+ if (hh < 0.12) dist = Math.min(dist, Math.max(Math.abs(X + 1), yy < 0 ? -yy : yy - 8.5)); // a descender+ else if (hh < 0.34) dist = Math.min(dist, Math.abs(Math.hypot(X, (yy + 2.8) * 1.15) - 2.6)); // a round letter+ else if (hh < 0.52) dist = Math.min(dist, Math.abs(yy + amp * (1 - Math.sin(Math.PI * lx)))); // a cup+ else if (hh < 0.82) dist = Math.min(dist, Math.abs(yy + amp * Math.sin(Math.PI * lx))); // an arch+ else dist = Math.min(dist, Math.max(Math.abs(X - 0.6 + (yy + 7) * 0.12), yy > 0 ? yy : -yy - 14.5), Math.abs(yy + amp * Math.sin(Math.PI * lx))); // an ascender, leaning+ const k = 1 - sm(0.5, 1.35, dist); if (k > ink) ink = k; }+ return ink;+};+// the spark in the window: a many-rayed burst, each ray a blunt petal+const RAYS = (() => { const r = rng(41), n = 12, out: number[][] = []; for (let i = 0; i < n; i++) { const a = (i / n) * Math.PI * 2 + (r() - 0.5) * 0.22, l = 0.62 + r() * 0.38; out.push([Math.cos(a), Math.sin(a), l]); } return out; })();+export const spark = (x: number, y: number) => { let best = 1e9; const rr = Math.hypot(x, y); for (const [cx, sy, l] of RAYS) { const t = cl(x * cx + y * sy, 0.1, l), d = Math.hypot(x - cx * t, y - sy * t) - (0.05 + 0.055 * (t / l)); if (d < best) best = d; } return Math.min(best, rr - 0.16); };++export type Bufs = { DW: number; DH: number; s: number; Hg: Float32Array; Ag: Float32Array; Hb: Float32Array };+export const hAt = (b: Bufs, x: number, y: number) => { const ix = (x * b.s) | 0, iy = (y * b.s) | 0; return ix < 0 || iy < 0 || ix >= b.DW || iy >= b.DH ? -1e9 : b.Hg[iy * b.DW + ix]; };+// is the sun hidden from this point by anything nearer the eye? walk toward it across the heights+export const sunAt = (b: Bufs, x: number, y: number, h: number) => { let occ = 0; for (let k = 1; k <= 70; k++) { const d = k * 2.6, hs = hAt(b, x + LDX * d, y + LDY * d); if (hs > -1e8) { const o = (hs - (h + RISE * d + 2)) / (d * 0.5 + 7); if (o > occ) { occ = o; if (occ >= 1) break; } } } return 1 - cl(occ); };+export const OUT: C3 = [0, 0, 0];+let NOINK = false;+export const light = (al: C3, nx: number, ny: number, nz: number, sh: number, ao: number, spec: number, gloss: number) => {+ const dif = Math.max(0, nx * LS[0] + ny * LS[1] + nz * LS[2]) * sh, skyk = (0.5 - 0.5 * ny) * ao, bnc = (0.5 + 0.5 * ny) * ao;+ const sp = spec * Math.pow(Math.max(0, nx * HV[0] + ny * HV[1] + nz * HV[2]), gloss) * sh;+ for (let i = 0; i < 3; i++) OUT[i] = al[i] * (SUN[i] * dif + SKYL[i] * 0.36 * skyk + BNC[i] * 0.34 * bnc) + sp * SUN[i];+};+export const paint = (b: Bufs, mat: number, x: number, y: number, h: number, nx: number, ny: number, nz: number, a1: number, a2: number, e: number) => {+ if (mat === M_NIGHT) {+ const wu = (a1 - (WIN.u0 + WIN.u1) / 2) / ((WIN.u1 - WIN.u0) / 2), wv = (a2 - (WIN.v0 + WIN.v1) / 2) / ((WIN.v1 - WIN.v0) / 2), X = wu * 1.42, Y = wv;+ const d = spark(X / 0.62, Y / 0.62) * 0.62, glow = Math.exp(-(X * X + Y * Y) / 0.5), k = 1 - sm(-0.012, 0.012, d);+ const star = hash2(Math.floor(a1 * 520), Math.floor(a2 * 520), 77) > 0.985 ? 0.5 : 0;+ const dusk = 0.5 + 0.5 * wv;+ OUT[0] = 0.006 + 0.02 * dusk + 0.5 * glow * glow + star; OUT[1] = 0.012 + 0.035 * dusk + 0.14 * glow * glow + star; OUT[2] = 0.06 + 0.1 * dusk + 0.03 * glow + star;+ const body = 0.75 + 0.35 * (0.5 - 0.5 * (X * 0.6 + Y * 0.6)); // the spark is a lit, solid thing+ OUT[0] = OUT[0] * (1 - k) + 0.86 * body * k; OUT[1] = OUT[1] * (1 - k) + 0.3 * body * k; OUT[2] = OUT[2] * (1 - k) + 0.13 * body * k;+ const recess = 0.45 + 0.55 * sm(0, 0.22, Math.min(wu + 1 - 0.17, wv + 1 - 0.24)); // the lintel's shadow inside+ OUT[0] *= recess; OUT[1] *= recess; OUT[2] *= recess; return;+ }+ const sh = sunAt(b, x, y, h), ix = (x * b.s) | 0, iy = (y * b.s) | 0, ao = 1 - 0.6 * cl((b.Hb[iy * b.DW + ix] - h) / 26);+ if (mat === M_INSIDE) { // concave: the sun comes over the left rim and lands on the right of the far wall+ const t = sm(-0.3, 0.42, a1), depth = cl((a2 - backRim(a1)) / 0.085), k = (0.1 + 0.7 * t * sh) * (0.55 + 0.45 * depth) ;+ OUT[0] = FLESH[0] * (0.1 + 1.0 * k) ; OUT[1] = FLESH[1] * (0.085 + 0.92 * k); OUT[2] = FLESH[2] * (0.12 + 0.8 * k); return; }+ if (mat === M_WALL) { light(FLESH, 0.75, 0.55, 0.36, 0, 1, 0, 1); OUT[0] = OUT[0] * 0.55 + 0.05; OUT[1] = OUT[1] * 0.5 + 0.018; OUT[2] *= 0.5; return; }+ if (mat === M_WOOD) { const grain = fbm(a1 * 0.03, a2 * 0.5, 3, 21), g = 0.35 + 0.65 * grain; light([WOODD[0] + (WOOD[0] - WOODD[0]) * g, WOODD[1] + (WOOD[1] - WOODD[1]) * g, WOODD[2] + (WOOD[2] - WOODD[2]) * g], nx, ny, nz, sh, 1, 0.5, 46); return; }+ if (mat === M_SCROLL) {+ const w = scrollW(a1, 200) < 200 ? 60 : 200; near(SCROLL, x, y); const ww = scrollW(NR.s, NR.r);+ const toPaper = sm(40, 330, a1), al: C3 = [FLESH[0] + (PAPERC[0] - FLESH[0]) * toPaper, FLESH[1] + (PAPERC[1] - FLESH[1]) * toPaper, FLESH[2] + (PAPERC[2] - FLESH[2]) * toPaper];+ const foxing = 1 - 0.1 * fbm(x * 0.012, y * 0.012, 3, 31); al[0] *= foxing; al[1] *= foxing * foxing; al[2] *= foxing * foxing * foxing;+ const ink = NOINK ? 0 : script(a1, a2, ww) * sm(150, 340, a1) * 0.8 * (w > 0 ? 1 : 1);+ al[0] += (INK[0] - al[0]) * ink; al[1] += (INK[1] - al[1]) * ink; al[2] += (INK[2] - al[2]) * ink;+ light(al, nx, ny, nz, sh, ao, 0.05, 18); return;+ }+ // flesh: wax-pale, a rose at the lips and lids, the few dark lines a face cannot do without+ const u = a1, v = a2, au = Math.abs(u), al: C3 = [FLESH[0], FLESH[1], FLESH[2]];+ const rose = 0.85 * G(u, v - 0.405, 0.13, 0.04) * (1 - sm(0.13, 0.17, au)) + 0.16 * G(au - 0.3, v - 0.08, 0.13, 0.1) + 0.12 * G(au - 0.218, v + 0.12, 0.09, 0.04);+ for (let i = 0; i < 3; i++) al[i] += (LIP[i] - al[i]) * cl(rose);+ let dark = 0;+ dark = Math.max(dark, 0.78 * Math.exp(-Math.pow((v - mouthLine(u)) / 0.0048, 2)) * (1 - sm(0.135, 0.172, au))); // the mouth line+ const lx = (au - 0.218) / 0.095;+ if (lx > -1.4 && lx < 1.4) { const fade = 1 - sm(0.92, 1.18, Math.abs(lx)), lv = lashLine(au); dark = Math.max(dark, 0.9 * Math.exp(-Math.pow((v - lv) / 0.0068, 2)) * fade);+ const lash = v - lv; if (lash > 0 && lash < 0.03) { const comb = Math.pow(0.5 + 0.5 * Math.sin((u + lash * 0.9 * Math.sign(u)) * 520), 6); dark = Math.max(dark, 0.66 * comb * (1 - lash / 0.03) * fade); } } // lashes, combed outward+ dark = Math.max(dark, 0.7 * G(au - 0.052, v - 0.228, 0.026, 0.012)); // nostrils+ const bx = (au - 0.215) / 0.15; if (bx > -1.1 && bx < 1.15) { const bv = -0.262 + 0.06 * bx * bx - 0.012 * bx, th = 0.02 * (1 - 0.55 * sm(-0.2, 1.1, bx)), hairs = 0.55 + 0.45 * Math.pow(0.5 + 0.5 * Math.sin((u * Math.sign(u) * 1.0 + (v - bv) * 1.6) * 700), 2); dark = Math.max(dark, 0.78 * Math.exp(-Math.pow((v - bv) / th, 2)) * (1 - sm(0.85, 1.12, Math.abs(bx))) * hairs); } // brows+ al[0] *= 1 - dark * 0.82; al[1] *= 1 - dark * 0.9; al[2] *= 1 - dark * 0.93;+ // the cut crown shows the thickness of the shell+ const rim = (v - crown(u)) * S; if (rim < 7) { al[0] = al[0] * 0.8 + 0.2; al[1] = al[1] * 0.8 + 0.17; al[2] = al[2] * 0.8 + 0.12; }+ const mottle = fbm(u * 5, v * 5, 3, 51) - 0.5; al[0] *= 1 + 0.05 * mottle; al[1] *= 1 - 0.03 * mottle; al[2] *= 1 - 0.09 * mottle; // thin glazes never lie quite even+ light(al, nx, ny, nz, sh * (0.8 + 0.2 * ao), ao, 0.16, 36);+ const dif = Math.max(0, nx * LS[0] + ny * LS[1] + nz * LS[2]) * sh, sss = 0.07 * Math.exp(-Math.pow((dif - 0.14) / 0.13, 2)); // blood-warm where light turns to shadow+ OUT[0] += sss; OUT[1] += sss * 0.3; OUT[2] += sss * 0.14;+ const wd = Math.hypot((u - 0) * S, (v + 0.415) * S), spill = 0.07 * Math.exp(-(wd * wd) / (95 * 95)); // the spark warms the brow round its window+ OUT[0] += spill; OUT[1] += spill * 0.42; OUT[2] += spill * 0.12;+ void e;+};++export const ridge = (x: number) => { const t1 = (x - 1340) / 430, m1 = t1 > -1 && t1 < 1 ? Math.pow(1 - t1 * t1, 1.2) * 92 * (0.62 + 0.76 * fbm(x * 0.011, 0.3, 4, 7)) : 0, t2 = (x - 170) / 190, m2 = t2 > -1 && t2 < 1 ? Math.pow(1 - t2 * t2, 1.4) * 26 * (0.6 + 0.8 * fbm(x * 0.02, 0.7, 3, 8)) : 0; return Math.max(m1, m2); };+const STONES = [[236, 1694, 26], [1016, 1772, 30], [1338, 1672, 17], [524, 1626, 14], [140, 1536, 10], [1470, 1600, 10], [770, 1700, 11], [330, 1454, 6], [1096, 1616, 6], [566, 1404, 4], [1268, 1838, 22], [404, 1848, 18]];++// ---------------------------------------------------------------- the picture+export const build = (env: Env) => {+ const s = env.scale, DW = Math.round(W * s), DH = Math.round(H * s);+ const b: Bufs = { DW, DH, s, Hg: new Float32Array(DW * DH).fill(-1e9), Ag: new Float32Array(DW * DH), Hb: new Float32Array(DW * DH) };+ const o = new Float32Array(5), GAM = new Uint8ClampedArray(4097); for (let i = 0; i <= 4096; i++) GAM[i] = Math.round(255 * Math.pow(i / 4096, 1 / 2.2));+ const tone = (v: number) => GAM[Math.round(4096 * (1 - Math.exp(-1.35 * Math.max(0, v))))];++ // 1. every object's height and edge, kept per object, and the highest height at every pixel+ const local = OBJS.map((ob) => { const x0 = Math.max(0, Math.floor(ob.box[0] * s)), y0 = Math.max(0, Math.floor(ob.box[1] * s)), x1 = Math.min(DW, Math.ceil(ob.box[2] * s)), y1 = Math.min(DH, Math.ceil(ob.box[3] * s)), w = x1 - x0, h = y1 - y0; const E = new Float32Array(w * h), Hh = new Float32Array(w * h), A1 = new Float32Array(w * h), A2 = new Float32Array(w * h), Mt = new Uint8Array(w * h);+ for (let j = 0; j < h; j++) for (let i = 0; i < w; i++) { ob.at((x0 + i + 0.5) / s, (y0 + j + 0.5) / s, o); const k = j * w + i; E[k] = o[0]; Hh[k] = o[1]; A1[k] = o[2]; A2[k] = o[3]; Mt[k] = o[4]; if (o[0] > 0) { const g = (y0 + j) * DW + x0 + i; if (o[1] > b.Hg[g]) b.Hg[g] = o[1]; const a = cl(o[0] * s + 0.5); if (a > b.Ag[g]) b.Ag[g] = a; } }+ return { x0, y0, w, h, E, Hh, A1, A2, Mt }; });++ // the hollows: where a point sits below the average height round it, less sky reaches it+ { const R = Math.round(11 * s), tmp = new Float32Array(DW * DH), n = 2 * R + 1;+ for (let j = 0; j < DH; j++) { let acc = 0; const row = j * DW; for (let i = -R; i < DW; i++) { const a = i + R < DW ? Math.max(0, b.Hg[row + i + R]) : 0, d = i - R - 1 >= 0 ? Math.max(0, b.Hg[row + i - R - 1]) : 0; acc += a - d; if (i >= 0) tmp[row + i] = acc / n; } }+ for (let i = 0; i < DW; i++) { let acc = 0; for (let j = -R; j < DH; j++) { const a = j + R < DH ? tmp[(j + R) * DW + i] : 0, d = j - R - 1 >= 0 ? tmp[(j - R - 1) * DW + i] : 0; acc += a - d; if (j >= 0) b.Hb[j * DW + i] = acc / n; } } }+ // 2. paint each object, back to front, into one layer+ const objL = env.canvas(DW, DH), img = objL.ctx.createImageData(DW, DH), px = img.data, oid = new Uint8Array(DW * DH), SL = local[4], bare = new Uint8ClampedArray(SL.w * SL.h * 3);+ for (let li = 0; li < local.length; li++) { const L = local[li]; for (let j = 1; j < L.h - 1; j++) for (let i = 1; i < L.w - 1; i++) { const k = j * L.w + i, e = L.E[k]; if (e * s < -0.5) continue; const a = cl(e * s + 0.5), h = L.Hh[k];+ const m = L.Mt[k], ml = L.Mt[k - 1] === m, mr = L.Mt[k + 1] === m, mu = L.Mt[k - L.w] === m, md = L.Mt[k + L.w] === m;+ let nx = -s * (ml && mr ? (L.Hh[k + 1] - L.Hh[k - 1]) / 2 : mr ? L.Hh[k + 1] - h : ml ? h - L.Hh[k - 1] : 0), ny = -s * (mu && md ? (L.Hh[k + L.w] - L.Hh[k - L.w]) / 2 : md ? L.Hh[k + L.w] - h : mu ? h - L.Hh[k - L.w] : 0), nz = 1; const nl = Math.hypot(nx, ny, nz); nx /= nl; ny /= nl; nz /= nl;+ paint(b, L.Mt[k], (L.x0 + i + 0.5) / s, (L.y0 + j + 0.5) / s, h, nx, ny, nz, L.A1[k], L.A2[k], e);+ const g = ((L.y0 + j) * DW + L.x0 + i) * 4, r = tone(OUT[0]), gg = tone(OUT[1]), bb = tone(OUT[2]), a0 = px[g + 3] / 255, ao = a + a0 * (1 - a);+ if (a > 0.02) oid[g >> 2] = L.Mt[k] === M_NIGHT ? 8 : li + 1;+ if (L.Mt[k] === M_SCROLL) { NOINK = true; paint(b, L.Mt[k], (L.x0 + i + 0.5) / s, (L.y0 + j + 0.5) / s, h, nx, ny, nz, L.A1[k], L.A2[k], e); NOINK = false; bare[k * 3] = tone(OUT[0]); bare[k * 3 + 1] = tone(OUT[1]); bare[k * 3 + 2] = tone(OUT[2]); }+ px[g] = (r * a + px[g] * a0 * (1 - a)) / ao; px[g + 1] = (gg * a + px[g + 1] * a0 * (1 - a)) / ao; px[g + 2] = (bb * a + px[g + 2] * a0 * (1 - a)) / ao; px[g + 3] = ao * 255; } }+ objL.ctx.putImageData(img, 0, 0);++ // 3. sky, far rocks and the plain, with every cast shadow+ const bgL = env.canvas(DW, DH), bimg = bgL.ctx.createImageData(DW, DH), bp = bimg.data, c: C3 = [0, 0, 0], hz: C3 = [0, 0, 0];+ const bgN = env.canvas(DW, DH), nimg = bgN.ctx.createImageData(DW, DH), np = nimg.data; let n0 = 0, n1 = 0, n2 = 0;+ const boards: number[][] = [[Z0, AX0, 1], ...COPIES.map(([z, ax]) => [z, ax, Z0 / z])];+ const alphaAt = (mx: number, my: number) => { const ix = (mx * s) | 0, iy = (my * s) | 0; return ix < 0 || iy < 0 || ix >= DW || iy >= DH ? 0 : b.Ag[iy * DW + ix]; };+ const TAPS = [[0, 0], [0.7, 0.2], [-0.7, -0.2], [0.2, -0.7], [-0.2, 0.7], [0.5, 0.6], [-0.5, -0.6], [0.6, -0.5], [-0.6, 0.5]];+ for (let j = 0; j < DH; j++) { const y = (j + 0.5) / s;+ for (let i = 0; i < DW; i++) { const x = (i + 0.5) / s, g = (j * DW + i) * 4;+ if (y < YH) {+ const t = y / YH; ramp(SKY, t, c);+ const sunward = 1 - x / W; c[0] += 14 * sunward * t * t; c[1] += 8 * sunward * t * t; c[2] -= 10 * sunward * t * t;+ const cloud = sm(0.52, 0.74, fbm(x * 0.0016 + 2, y * 0.013, 4, 5)) * sm(380, 760, y) * (1 - sm(1010, 1190, y)) * 0.5;+ c[0] += (246 - c[0]) * cloud; c[1] += (226 - c[1]) * cloud; c[2] += (190 - c[2]) * cloud;+ const rh = ridge(x), top = YH - rh;+ if (rh > 1 && y > top - 1) { const cov = cl((y - top + 0.5) * s), slope = ridge(x + 3) - ridge(x - 3), facet = fbm(x * 0.07, y * 0.028, 4, 9), lit = sm(0.4, 0.6, 0.5 + slope * 0.06 + (facet - 0.5) * 1.5), depth = (y - top) / Math.max(1, rh); const rr = 126 + (228 - 126) * lit, rg = 118 + (196 - 118) * lit, rb = 146 + (150 - 146) * lit; ramp(SKY, 1, hz); const haze = 0.3 + 0.3 * depth; c[0] += (rr + (hz[0] - rr) * haze - c[0]) * cov; c[1] += (rg + (hz[1] - rg) * haze - c[1]) * cov; c[2] += (rb + (hz[2] - rb) * haze - c[2]) * cov; }+ } else {+ const z = (F * CAMH) / Math.max(0.5, y - YH), wx = ((x - CX) * z) / F, fog = 1 - Math.exp(-z / 55);+ ramp(GROUND, Math.pow(fog, 0.8), c);+ const tn = (fbm(wx * 0.22, z * 0.22, 4, 11) - 0.5) * 0.2 * (1 - fog) + (fbm(wx * 7, z * 7, 2, 12) - 0.5) * 0.12 * cl(1 - z / 22) + (fbm(wx * 0.9, z * 0.05, 3, 13) - 0.5) * 0.07, k = (1 + tn) * (1 + 0.1 * (1 - x / W));+ c[0] *= k; c[1] *= k; c[2] *= k;+ // shadows: from this point of the plain, walk toward the sun and see which standing thing is in the way+ let shd = 0;+ for (const [zb, ax, kb] of boards) { const far = kb < 0.6, ay = YH + (F * CAMH) / zb; if (y > ay + 0.5 || y < YH + (F * CAMH) / (zb + 17) - 1) continue;+ // far off, one pixel row of plain spans many paces, so a far shadow is the average of four depths inside the pixel+ let acc = 0; const sub = far ? 4 : 1;+ for (let q = 0; q < sub; q++) { const yq = far ? y + ((q + 0.5) / sub - 0.5) / s : y, zq = (F * CAMH) / Math.max(0.05, yq - YH); if (zq <= zb) continue; const wq = ((x - CX) * zq) / F, t = (zb - zq) / LW[2], Yb = t * LW[1]; if (Yb > 9.5) continue; const Xb = wq + t * LW[0], sx = CX + (F * Xb) / zb, sy = YH + (F * (CAMH - Yb)) / zb, mx = AX0 + (sx - ax) / kb, my = AY0 + (sy - ay) / kb; if (mx < 300 || mx > 1460 || my < 300) continue; const rad = 0.7 + 0.9 * t; let a = 0; for (const [tx, ty] of TAPS) a += alphaAt(mx + tx * rad, my + ty * rad); acc += a / TAPS.length; }+ acc /= sub; if (acc > shd) shd = acc; }+ // a dot rests on the plain: the dark where it touches+ for (const [zb, ax, kb] of boards) for (const d of [DOT1, DOT2]) { const dx = (x - (ax + (d[0] - AX0) * kb)) / (d[2] * kb * 1.25), dy = (y - (YH + (F * CAMH) / zb - 4 * kb)) / (d[2] * kb * 0.3), q = dx * dx + dy * dy; if (q < 4) shd = Math.max(shd, 0.9 * Math.exp(-q * 1.2)); }+ n0 = c[0]; n1 = c[1]; n2 = c[2];+ const sk = shd * 0.8; c[0] *= 1 - sk * 0.74; c[1] *= 1 - sk * 0.7; c[2] *= 1 - sk * 0.5;+ const fore = sm(1790, 1985, y + 70 * (fbm(x * 0.004, 0.5, 3, 14) - 0.5)) * 0.72; c[0] *= 1 - fore * 0.8; c[1] *= 1 - fore * 0.8; c[2] *= 1 - fore * 0.66; n0 *= 1 - fore * 0.8; n1 *= 1 - fore * 0.8; n2 *= 1 - fore * 0.66; // something out of frame throws its shadow across the foot of the picture+ }+ const dn = (hash2(i, j, 3) - 0.5) * 1.6; bp[g] = c[0] + dn; bp[g + 1] = c[1] + dn; bp[g + 2] = c[2] + dn; bp[g + 3] = 255;+ if (y < YH) { n0 = c[0]; n1 = c[1]; n2 = c[2]; } np[g] = n0 + dn; np[g + 1] = n1 + dn; np[g + 2] = n2 + dn; np[g + 3] = 255; } }+ bgL.ctx.putImageData(bimg, 0, 0); bgN.ctx.putImageData(nimg, 0, 0);+ return { objL, bgL, bgN, DW, DH, px, oid, bare, SL };+};++export type Built = ReturnType<typeof build>;+export const built = (env: Env): Built => { const key = `dreamGlaze@${env.scale}`; let B = env.cache.get(key) as Built | undefined; if (!B) { B = build(env); env.cache.set(key, B); } return B; };+// one of the further masks, a little more lost in the evening air the further off it stands+export const copyLayer = (B: Built, env: Env, z: number, ax: number) => { const s = env.scale, k = Z0 / z, ay = YH + (F * CAMH) / z, T = env.canvas(B.DW, B.DH), t = T.ctx; t.setTransform(1, 0, 0, 1, 0, 0); t.clearRect(0, 0, B.DW, B.DH); t.imageSmoothingEnabled = true; t.imageSmoothingQuality = "high"; t.drawImage(B.objL.canvas, (ax - AX0 * k) * s, (ay - AY0 * k) * s, B.DW * k, B.DH * k); t.globalCompositeOperation = "source-atop"; t.globalAlpha = cl(0.1 + 0.5 * (1 - Math.exp(-z / 160))); t.fillStyle = "#ecd9ae"; t.fillRect(0, 0, B.DW, B.DH); t.globalAlpha = 1; t.globalCompositeOperation = "source-over"; return T; };+// small things standing on the plain: stones, and the one who asks. Each throws the same shadow.+export const smallThings = (ctx: Ctx, env: Env, nStones = 99, figure = 1) => {+ const s = env.scale; ctx.setTransform(s, 0, 0, s, 0, 0);+ const poly = (pts: number[][], fill: string | CanvasGradient) => { ctx.beginPath(); pts.forEach(([x, y], i) => (i ? ctx.lineTo(x, y) : ctx.moveTo(x, y))); ctx.closePath(); ctx.fillStyle = fill; ctx.fill(); };+ const SX = -LW[0] / LW[1], SZ = -LW[2] / LW[1];+ const cast = (pts: number[][], gy: number) => { const z = (F * CAMH) / (gy - YH), ky = (CAMH / z) * SZ; return pts.map(([x, y]) => [x + (gy - y) * SX, gy - (gy - y) * ky]); };+ STONES.slice(0, nStones).forEach(([cx, cy, r], n) => { const rr = rng(700 + n), m = 9, pts: number[][] = []; for (let i = 0; i < m; i++) { const a = (i / m) * Math.PI * 2 + (rr() - 0.5) * 0.4, k = 0.72 + rr() * 0.42; pts.push([cx + Math.cos(a) * r * k, cy - r * 0.5 + Math.sin(a) * r * 0.5 * k]); }+ poly(cast(pts, cy), "rgba(46,30,48,0.6)");+ const g = ctx.createLinearGradient(cx - r, cy - r, cx + r * 0.8, cy + r * 0.2); g.addColorStop(0, "#f0d9a8"); g.addColorStop(0.42, "#b98e58"); g.addColorStop(0.62, "#6e4c30"); g.addColorStop(1, "#3c2a22"); poly(pts, g); });+ if (figure > 0) { if (figure < 1) { ctx.save(); ctx.beginPath(); ctx.rect(1380, 1366 - 74 * figure, 220, 74 * figure + 4); ctx.clip(); }+ { const fx = 1478, fy = 1366, k = 0.7, T = (pts: number[][]) => pts.map(([x, y]) => [fx + (x - 50) * k, fy + (y - 100) * k]);+ const LEGB = [[51, 74], [57, 74], [57.5, 96], [59.5, 100], [51, 100], [53, 96]], LEGF = [[44, 74], [50.5, 74], [50, 96], [51.5, 100], [42.5, 100], [45.5, 96]];+ const COAT = [[43, 17], [50, 15], [57, 18], [59.5, 30], [60, 52], [62.5, 79], [41, 79], [42.5, 52], [42, 30]], COATL = [[43, 17], [45.5, 17.5], [44.6, 30], [45, 52], [44, 79], [41, 79], [42.5, 52], [42, 30]];+ const HEAD = [[44.6, 6], [46, 2.2], [50, 0.4], [54.4, 1.6], [56.4, 5.6], [55.8, 10.6], [53, 14.6], [49, 15.2], [46.2, 13.2], [44.4, 11], [45.2, 9]], HAIR = [[49.4, 0.4], [54.4, 1.6], [56.4, 5.6], [55.8, 10.6], [53.6, 13.4], [52.2, 8], [50, 4.4]];+ const ARM = [[46, 20.5], [38, 31], [31.5, 21.5]], PAGE = [[23.5, 11.5], [31.4, 9.8], [33, 20.2], [25, 22]];+ const armPoly = [[44.5, 19], [47.6, 21.6], [39, 33.4], [36.4, 32.6], [30, 22.4], [32.6, 20.4], [38, 28]];+ for (const p of [LEGB, LEGF, COAT, HEAD, armPoly, PAGE]) poly(cast(T(p), fy), "rgba(46,30,48,0.62)");+ poly(T(LEGB), "#17141f"); poly(T(LEGF), "#221d2c"); poly(T(COAT), "#2c2a4a"); poly(T(COATL), "#a98660");+ poly(T(HEAD), "#c79a72"); poly(T(HAIR), "#241815");+ ctx.lineCap = "round"; ctx.lineJoin = "round"; ctx.strokeStyle = "#35335a"; ctx.lineWidth = 3.4 * k; ctx.beginPath(); T(ARM).forEach(([x, y], i) => (i ? ctx.lineTo(x, y) : ctx.moveTo(x, y))); ctx.stroke();+ poly(T(PAGE), "#f4ead0"); poly(T([[31.4, 9.8], [33, 20.2], [31.6, 20.5], [30, 10.1]]), "#cdbd98"); }+ if (figure < 1) ctx.restore(); }+ ctx.setTransform(1, 0, 0, 1, 0, 0);+};+// signed by the sitter, small, in the shadow at the foot of the picture+const SIG = (() => { const raw = [[[10, -16], [6, -19], [1, -15], [0, -8], [2, -2], [7, 0], [11, -3]], [[14, -6], [18, -14], [18, -20], [16, -20], [15.5, -10], [16, -2], [18, 0], [20, -3]], [[27, -8], [24, -10], [21, -7], [21, -2], [24, 0], [27, -3], [27.5, -9], [27.5, -2], [29, 0], [31, -3], [32, -9], [32, -3], [34, 0], [37, -3], [38, -9], [38, -2], [40, 0], [42, -3]], [[48, -8], [45, -10], [42, -7], [42, -2], [45, 0], [48, -3], [48.5, -20], [48.5, -2], [50, 0], [52, -3], [55, -5], [57, -8], [55, -10], [52.5, -7], [53, -2], [56, 0], [61, -4]]];+ // each stroke flattened to a fine polyline, so the pen can stop anywhere along it+ return raw.map((st) => { const q = st.map(([x, y]) => [1404 + x * 1.7 + y * -0.25, 1950 + y * 1.7]), out: number[][] = [q[0]]; let cur = q[0]; for (let i = 1; i < q.length - 1; i++) { const c = q[i], e = [(q[i][0] + q[i + 1][0]) / 2, (q[i][1] + q[i + 1][1]) / 2]; for (let k = 1; k <= 8; k++) { const u = k / 8; out.push([(1 - u) * (1 - u) * cur[0] + 2 * (1 - u) * u * c[0] + u * u * e[0], (1 - u) * (1 - u) * cur[1] + 2 * (1 - u) * u * c[1] + u * u * e[1]]); } cur = e; } out.push(q[q.length - 1]); return out; }); })();+export const signature = (ctx: Ctx, env: Env, prog = 1, dx = 0, dy = 0) => { const s = env.scale, total = SIG.reduce((a, st) => a + st.length - 1, 0); let left = prog >= 1 ? total : prog * total;+ ctx.setTransform(s, 0, 0, s, dx * s, dy * s); ctx.strokeStyle = "rgba(214,160,74,0.9)"; ctx.lineWidth = 1.5; ctx.lineCap = "round"; ctx.lineJoin = "round";+ for (const st of SIG) { if (left <= 0) break; const n = Math.min(st.length - 1, left), whole = Math.floor(n), fr = n - whole; ctx.beginPath(); ctx.moveTo(st[0][0], st[0][1]); for (let i = 1; i <= whole; i++) ctx.lineTo(st[i][0], st[i][1]); if (fr > 0) ctx.lineTo(st[whole][0] + (st[whole + 1][0] - st[whole][0]) * fr, st[whole][1] + (st[whole + 1][1] - st[whole][1]) * fr); ctx.stroke(); left -= st.length - 1; }+ ctx.setTransform(1, 0, 0, 1, 0, 0); };+// the surface: a fine linen under thin paint, and the corners a little sunk, as old varnish does+export const surface = (ctx: Ctx, env: Env, W = 1600, H = 2000) => { const s = env.scale, g = new Gfx(ctx, env, 0, PENCIL); weave(g, 0.04); g.paper("paper", 0.05);+ ctx.setTransform(s, 0, 0, s, 0, 0); ctx.globalCompositeOperation = "multiply"; const vg = ctx.createRadialGradient(W * 0.46, H * 0.44, H * 0.34, W * 0.5, H * 0.5, H * 0.76); vg.addColorStop(0, "rgba(255,255,255,1)"); vg.addColorStop(1, "rgba(150,128,112,1)"); ctx.fillStyle = vg; ctx.fillRect(0, 0, W, H); ctx.globalCompositeOperation = "source-over"; ctx.setTransform(1, 0, 0, 1, 0, 0); };++export const drawDreamGlaze = (ctx: Ctx, _frame: number, env: Env) => {+ const B = built(env);+ ctx.setTransform(1, 0, 0, 1, 0, 0); ctx.globalAlpha = 1; ctx.globalCompositeOperation = "source-over";+ ctx.drawImage(B.bgL.canvas, 0, 0);+ ctx.imageSmoothingEnabled = true; ctx.imageSmoothingQuality = "high";+ for (const [z, ax] of COPIES) ctx.drawImage(copyLayer(B, env, z, ax).canvas, 0, 0); // furthest first+ smallThings(ctx, env);+ signature(ctx, env);+ ctx.drawImage(B.objL.canvas, 0, 0);+ surface(ctx, env);+};++export const dreamGlaze: Film = {+ meta: { title: "dreamGlaze", W, H, fps: 30, bpm: 60, durationFrames: 1, raster: "cpu" },+ assets: { images: {} },+ shots: [{ id: "dreamGlaze", start: 0, end: 1, draw: drawDreamGlaze }],+};+export const STYLE = { id: "dreamGlaze", name: "Dream glaze", family: "paint", medium: "resin-thinned oil glazes laid with a very small soft brush on a smooth white ground: no visible stroke, every form turned pixel by pixel under one low sun, every edge hard", nearest: "paintedOil", hero: "a hollow mask of a calm face held up by question marks in an empty desert, its cheek running out into a scroll of handwriting" };diff --git a/skills/anidoodle/engine/src/canvas-core/dreamGlazeDraw.ts b/skills/anidoodle/engine/src/canvas-core/dreamGlazeDraw.tsnew file mode 100644index 0000000..5f9aa34--- /dev/null+++ b/skills/anidoodle/engine/src/canvas-core/dreamGlazeDraw.ts@@ -0,0 +1,126 @@+import { type Ctx, type Env, type Layer } from "./core";+import { Film } from "./film";+import { AX0, AY0, CAMH, COPIES, CT, DOT1, DOT2, F, H, MX, MY, OBJS, Q1, Q2, RIMW, S, SCROLL, ST, W, WIN, YH, Z0, backRim, built, cl, copyLayer, crown, drawDreamGlaze, halfW, hash2, lashLine, mouthLine, ridge, scrollW, signature, sm, smallThings, surface, type Built, type Curve } from "./dreamGlaze";++// THE SOFT SELF-PORTRAIT, PAINTED · the same picture, in the order its hand works.+//+// ORDER (resin-oil glazes, a very small brush): a white primed panel; the drawing, in thin umber;+// the sky laid twice, a thin glaze and then the full one, in rows from the top; the plain the same+// way; then each form, furthest first, laid in its shadow tone; the cast shadows; the handwriting+// written along the scroll; the small things on the plain; the face worked up dark to light, last+// and slowest; the spark lit; the signature. The last second is the still, pixel for pixel.++const FPS = 30, N = 810, HOLD = 780;+// every frame number in the film lives here+const CUE = {+ draw: [6, 104], drawFar: [104, 122],+ sky1: [122, 188], sky2: [188, 252], plain1: [252, 300], plain2: [300, 346],+ far: [346, 392],+ // [underpaint from, to, worked up from, to], by owner: Q2, Q1, dot 2, dot 1, scroll, inside, mask, night+ form: [[392, 416, 410, 444], [402, 426, 420, 454], [426, 434, 434, 452], [430, 438, 438, 456], [440, 486, 474, 534], [486, 506, 500, 534], [520, 600, 640, 752], [752, 758, 756, 780]],+ shadows: [560, 650], write: [610, 710], stones: [660, 700], figure: [690, 716], sign: [750, 778],+};+// what the drawing's lines belong to, and the frame by which paint has covered them+const GONE: Record<string, number> = { rock: 252, horizon: 346, far: 392, q: 456, scroll: 486, mask: 600 };+for (const v of Object.values(CUE).flat(2) as number[]) if (!(v >= 0 && v <= HOLD)) throw new Error(`dreamGlazeDraw: cue ${v} is outside the film`);++// ---------------------------------------------------------------- the drawing under the paint+type Line = { pts: number[][]; len: number; grp: string; t0: number; t1: number };+const uv = (u: number, v: number) => { const X = u * CT - v * ST, Y = u * ST + v * CT; return [MX + X * S, MY + Y * S]; };+const hull = (c: Curve, wOf: (s: number, r: number) => number) => { const a: number[][] = [], b: number[][] = []; for (let i = 0; i < c.n; i++) { const j = Math.min(c.n - 1, i + 1), k = Math.max(0, i - 1), dx = c.x[j] - c.x[k], dy = c.y[j] - c.y[k], l = Math.hypot(dx, dy) || 1, w = wOf(c.s[i], c.r[i]); a.push([c.x[i] - (dy / l) * w, c.y[i] + (dx / l) * w]); b.push([c.x[i] + (dy / l) * w, c.y[i] - (dx / l) * w]); } return [...a, ...b.reverse(), a[0]]; };+const ring = (d: number[]) => Array.from({ length: 25 }, (_, i) => [d[0] + Math.cos((i / 24) * Math.PI * 2) * d[2], d[1] + Math.sin((i / 24) * Math.PI * 2) * d[2]]);+const span = (n: number, f: (t: number) => number[]) => Array.from({ length: n + 1 }, (_, i) => f(i / n));+const GROUP: [string, number[][]][] = (() => {+ const out: [string, number[][]][] = [];+ out.push(["mask", [...span(40, (t) => uv(-halfW(-0.6 + 1.299 * t), -0.6 + 1.299 * t)), ...span(40, (t) => uv(halfW(0.699 - 1.299 * t), 0.699 - 1.299 * t))]]);+ out.push(["mask", span(48, (t) => uv(RIMW - 2 * RIMW * t, crown(RIMW - 2 * RIMW * t)))]);+ out.push(["mask", span(32, (t) => uv(-RIMW + 2 * RIMW * t, backRim(-RIMW + 2 * RIMW * t)))]);+ out.push(["mask", [uv(WIN.u0, WIN.v0), uv(WIN.u1, WIN.v0), uv(WIN.u1, WIN.v1), uv(WIN.u0, WIN.v1), uv(WIN.u0, WIN.v0)]]);+ for (const sg of [-1, 1]) { out.push(["mask", span(14, (t) => { const bx = -1.05 + 2.15 * t; return uv(sg * (0.215 + 0.15 * bx), -0.262 + 0.06 * bx * bx - 0.012 * bx); })]); out.push(["mask", span(14, (t) => { const au = 0.218 + 0.095 * (-1.1 + 2.2 * t); return uv(sg * au, lashLine(au)); })]); }+ out.push(["mask", [uv(0.03, -0.2), uv(0.04, 0), uv(0.06, 0.14), uv(0.11, 0.2), uv(0.08, 0.235), uv(0, 0.245), uv(-0.08, 0.235), uv(-0.11, 0.2), uv(-0.085, 0.16)]]);+ out.push(["mask", span(16, (t) => { const u = -0.165 + 0.33 * t; return uv(u, mouthLine(u)); })]);+ out.push(["mask", span(10, (t) => { const u = -0.1 + 0.2 * t; return uv(u, 0.476 - 2 * u * u); })]);+ out.push(["q", hull(Q1, (_s, r) => r)], ["q", ring(DOT1)], ["scroll", hull(SCROLL, scrollW)], ["q", hull(Q2, (_s, r) => r)], ["q", ring(DOT2)]);+ return out;+})();+const LINES: Line[] = (() => {+ const near: [string, number[][]][] = [["horizon", [[0, YH], [W, YH]]], ["rock", span(70, (t) => { const x = 905 + 695 * t; return [x, YH - ridge(x)]; })], ["rock", span(24, (t) => { const x = 0 + 345 * t; return [x, YH - ridge(x)]; })], ...GROUP];+ const far: [string, number[][]][] = []; for (const [z, ax] of [...COPIES].reverse()) { const k = Z0 / z, ay = YH + (F * CAMH) / z; for (const [, p] of GROUP) far.push(["far", p.map(([x, y]) => [ax + (x - AX0) * k, ay + (y - AY0) * k])]); }+ const lay = (set: [string, number[][]][], a: number, b: number) => { const L = set.map(([grp, pts]) => { let len = 0; for (let i = 1; i < pts.length; i++) len += Math.hypot(pts[i][0] - pts[i - 1][0], pts[i][1] - pts[i - 1][1]); return { pts, len, grp, t0: 0, t1: 0 }; }), cost = L.map((l) => 1.5 + Math.pow(l.len, 0.55)), sum = cost.reduce((p, c) => p + c, 0); let t = a; L.forEach((l, i) => { l.t0 = t; t += ((b - a) * cost[i]) / sum; l.t1 = t; }); return L; }; // a long line is drawn fast, a short one slowly+ return [...lay(near, CUE.draw[0], CUE.draw[1]), ...lay(far, CUE.drawFar[0], CUE.drawFar[1])];+})();+const drawing = (ctx: Ctx, s: number, f: number) => {+ ctx.setTransform(s, 0, 0, s, 0, 0); ctx.strokeStyle = "rgba(104,64,36,0.88)"; ctx.lineCap = "round"; ctx.lineJoin = "round";+ for (const l of LINES) { if (f <= l.t0 || f >= GONE[l.grp]) continue; const p = f >= l.t1 ? 1 : (f - l.t0) / (l.t1 - l.t0); let left = p * l.len; ctx.lineWidth = l.grp === "far" ? 0.9 : 1.7; ctx.beginPath(); ctx.moveTo(l.pts[0][0], l.pts[0][1]);+ for (let i = 1; i < l.pts.length && left > 0; i++) { const a = l.pts[i - 1], b = l.pts[i], d = Math.hypot(b[0] - a[0], b[1] - a[1]), k = d <= left ? 1 : left / d; ctx.lineTo(a[0] + (b[0] - a[0]) * k, a[1] + (b[1] - a[1]) * k); left -= d; } ctx.stroke(); }+ ctx.setTransform(1, 0, 0, 1, 0, 0);+};++// ---------------------------------------------------------------- a brush laying a ground in rows+// The region painted so far: whole rows above, and the row in hand as far as the brush has got.+// Rows run left to right, then right to left; their lower edge wavers as a hand's does.+const wav = (x: number, row: number) => 6 * Math.sin(x * 0.011 + row * 1.7) + 3 * Math.sin(x * 0.037 + row);+const rows = (ctx: Ctx, x0: number, y0: number, x1: number, y1: number, band: number, p: number) => {+ const n = Math.ceil((y1 - y0) / band), q = cl(p) * n, k = Math.min(n, Math.floor(q)), fr = q - k;+ ctx.beginPath(); ctx.rect(x0, y0, x1 - x0, y1 - y0); ctx.clip(); ctx.beginPath();+ if (k > 0) { const yb = y0 + k * band; ctx.moveTo(x0, y0 - 20); ctx.lineTo(x1, y0 - 20); for (let x = x1; x >= x0 - 40; x -= 40) ctx.lineTo(x, k >= n ? y1 + 20 : yb + wav(x, k)); ctx.closePath(); }+ if (k < n && fr > 0) { const yt = y0 + k * band - 12, yb = y0 + (k + 1) * band, ltr = k % 2 === 0, xf = ltr ? x0 + fr * (x1 - x0 + 60) : x1 - fr * (x1 - x0 + 60), xs = ltr ? x0 - 10 : x1 + 10, dir = ltr ? 1 : -1;+ ctx.moveTo(xs, yt); ctx.lineTo(xf, yt); ctx.quadraticCurveTo(xf + dir * 26, (yt + yb) / 2, xf - dir * 6, yb + wav(xf, k + 1)); for (let x = xf - dir * 6; dir * (x - xs) > 0; x -= dir * 40) ctx.lineTo(x, yb + wav(x, k + 1)); ctx.lineTo(xs, yb + wav(xs, k + 1)); ctx.closePath(); }+ ctx.clip();+};+const laid = (ctx: Ctx, s: number, src: Layer, f: number, cue: number[], region: number[], band: number, alpha: number) => { if (f <= cue[0]) return; ctx.save(); ctx.setTransform(s, 0, 0, s, 0, 0); rows(ctx, region[0], region[1], region[2], region[3], band, (f - cue[0]) / (cue[1] - cue[0])); ctx.setTransform(1, 0, 0, 1, 0, 0); ctx.globalAlpha = alpha; ctx.drawImage(src.canvas, 0, 0); ctx.restore(); };++// ---------------------------------------------------------------- the forms, dark to light+// For every pixel a form owns: when the small brush reaches it (its place in the rows), and how+// light it is. A form is first laid in its shadow tone; then the lights are worked up across it.+type Plan = { idx: Uint32Array; ord: Float32Array; lum: Float32Array; who: Uint8Array; sIdx: Int32Array; img: ImageData; L: Layer };+const BAND = [9, 9, 5, 5, 15, 12, 19, 100];+const plan = (B: Built, env: Env): Plan => {+ const key = `dreamGlazeDraw:plan@${env.scale}`; let P = env.cache.get(key) as Plan | undefined; if (P) return P;+ const s = env.scale, { DW, DH, px, oid, SL } = B; let n = 0; for (let i = 0; i < DW * DH; i++) if (px[i * 4 + 3] > 0 && oid[i]) n++;+ const idx = new Uint32Array(n), ord = new Float32Array(n), lum = new Float32Array(n), who = new Uint8Array(n), sIdx = new Int32Array(n); let m = 0;+ for (let j = 0; j < DH; j++) for (let i = 0; i < DW; i++) { const g = j * DW + i, id = oid[g]; if (!(px[g * 4 + 3] > 0 && id)) continue; const x = (i + 0.5) / s, y = (j + 0.5) / s;+ const box = id === 8 ? [0, 0, W, H] : OBJS[id - 1].box, band = BAND[id - 1], nr = Math.max(1, Math.ceil((box[3] - box[1]) / band)), yy = y - box[1] + 0.45 * wav(x * 3, id), row = cl(Math.floor(yy / band), 0, nr - 1), fx = cl((x - box[0]) / (box[2] - box[0]));+ idx[m] = g; who[m] = id; ord[m] = id === 8 ? 0 : (row + (row % 2 ? 1 - fx : fx)) / nr; lum[m] = Math.max(px[g * 4], px[g * 4 + 1], px[g * 4 + 2]) / 255;+ sIdx[m] = id === 5 && i >= SL.x0 && i < SL.x0 + SL.w && j >= SL.y0 && j < SL.y0 + SL.h ? (j - SL.y0) * SL.w + (i - SL.x0) : -1; m++; }+ const L = env.canvas(DW, DH); P = { idx, ord, lum, who, sIdx, img: L.ctx.createImageData(DW, DH), L }; env.cache.set(key, P); return P;+};+const SHADE = 0.4; // the shadow tone a form is laid in with, as a ceiling on its lightness+const forms = (ctx: Ctx, B: Built, env: Env, f: number) => {+ if (f <= CUE.form[0][0]) return; const P = plan(B, env), d = P.img.data, { px, bare, SL } = B;+ const pu = CUE.form.map((c) => cl((f - c[0]) / (c[1] - c[0]))), pm = CUE.form.map((c) => cl((f - c[2]) / (c[3] - c[2])));+ // the writing: line after line down the scroll, each one running out along its length+ const SLEN = SCROLL.s[SCROLL.n - 1], penAt = (j: number) => cl((f - (CUE.write[0] + (j + 5) * 7.4)) / 26) * (SLEN + 20);+ for (let m = 0; m < P.idx.length; m++) { const g = P.idx[m] * 4, id = P.who[m] - 1, o = P.ord[m];+ if (pu[id] < 1 && pu[id] * 1.0001 <= o) { d[g + 3] = 0; continue; }+ let r = px[g], gg = px[g + 1], b = px[g + 2];+ const k = P.sIdx[m]; if (k >= 0) { const line = cl(Math.round((SL.A2[k] - 5) / 19), -5, 5); if (SL.A1[k] > penAt(line)) { r = bare[k * 3]; gg = bare[k * 3 + 1]; b = bare[k * 3 + 2]; } }+ if (pm[id] < 1) { const t = cl((pm[id] * 1.4 - o) / 0.4), cap = SHADE + (1 - SHADE) * t * t * (3 - 2 * t), l = Math.max(r, gg, b) / 255, q = l > cap ? cap / l : 1; r *= q; gg *= q; b *= q; }+ d[g] = r; d[g + 1] = gg; d[g + 2] = b; d[g + 3] = px[g + 3]; }+ P.L.ctx.putImageData(P.img, 0, 0); ctx.drawImage(P.L.canvas, 0, 0);+};++export const drawDreamGlazeDraw = (ctx: Ctx, f: number, env: Env) => {+ if (f >= HOLD) { drawDreamGlaze(ctx, 0, env); return; }+ const B = built(env), s = env.scale, sky = [0, 0, W, YH], plain = [0, YH, W, H];+ ctx.setTransform(1, 0, 0, 1, 0, 0); ctx.globalAlpha = 1; ctx.globalCompositeOperation = "source-over"; ctx.imageSmoothingEnabled = true; ctx.imageSmoothingQuality = "high";+ ctx.fillStyle = "#f7f2e7"; ctx.fillRect(0, 0, B.DW, B.DH); // the primed panel+ if (f < CUE.sky1[1]) drawing(ctx, s, f); // under the first thin glaze the drawing still shows+ laid(ctx, s, B.bgN, f, CUE.sky1, sky, 84, 0.6); laid(ctx, s, B.bgN, f, CUE.sky2, sky, 84, 1);+ laid(ctx, s, B.bgN, f, CUE.plain1, plain, 62, 0.6); laid(ctx, s, B.bgN, f, CUE.plain2, plain, 62, 1);+ // cast shadows: painted outward from the things that throw them, the way the light runs+ if (f > CUE.shadows[0]) { const p = (f - CUE.shadows[0]) / (CUE.shadows[1] - CUE.shadows[0]), xf = -200 + p * (W + 260); ctx.save(); ctx.setTransform(s, 0, 0, s, 0, 0); ctx.beginPath(); ctx.moveTo(-10, YH); ctx.lineTo(xf + 200, YH); ctx.quadraticCurveTo(xf + 40, (YH + H) / 2, xf - 60, H + 10); ctx.lineTo(-10, H + 10); ctx.closePath(); ctx.clip(); ctx.setTransform(1, 0, 0, 1, 0, 0); ctx.drawImage(B.bgL.canvas, 0, 0); ctx.restore(); }+ if (f >= CUE.sky1[1]) drawing(ctx, s, f);+ // the further masks, furthest first, each laid in rows+ if (f > CUE.far[0]) { const each = (CUE.far[1] - CUE.far[0]) / COPIES.length; COPIES.forEach(([z, ax], i) => { const a = CUE.far[0] + i * each; if (f <= a) return; const k = Z0 / z, ay = YH + (F * CAMH) / z, T = copyLayer(B, env, z, ax); ctx.save(); ctx.setTransform(s, 0, 0, s, 0, 0); rows(ctx, ax + (330 - AX0) * k, ay + (300 - AY0) * k, ax + (1460 - AX0) * k, ay + 4, Math.max(5, 46 * k), (f - a) / each); ctx.setTransform(1, 0, 0, 1, 0, 0); ctx.drawImage(T.canvas, 0, 0); ctx.restore(); }); }+ if (f > CUE.stones[0]) smallThings(ctx, env, Math.ceil(((f - CUE.stones[0]) / (CUE.stones[1] - CUE.stones[0])) * 12), cl((f - CUE.figure[0]) / (CUE.figure[1] - CUE.figure[0])));+ if (f > CUE.sign[0]) signature(ctx, env, (f - CUE.sign[0]) / (CUE.sign[1] - CUE.sign[0]));+ forms(ctx, B, env, f);+ surface(ctx, env);+};++export const dreamGlazeDraw: Film = {+ meta: { title: "dreamGlazeDraw", W, H, fps: FPS, bpm: 60, durationFrames: N, raster: "cpu", kind: "drawing", holds: [[CUE.form[7][2], N, "only the spark and the signature are still being finished, both too small to measure; then the painting rests"]] },+ assets: { images: {} },+ shots: [{ id: "dreamGlazeDraw", start: 0, end: N, draw: drawDreamGlazeDraw }],+};diff --git a/skills/anidoodle/engine/src/hosts/page-dreamGlaze.ts b/skills/anidoodle/engine/src/hosts/page-dreamGlaze.tsnew file mode 100644index 0000000..c60244e--- /dev/null+++ b/skills/anidoodle/engine/src/hosts/page-dreamGlaze.ts@@ -0,0 +1,4 @@+import { dreamGlaze } from "../canvas-core/dreamGlaze";+import { mountFilm } from "./page";++mountFilm(dreamGlaze);diff --git a/skills/anidoodle/engine/src/hosts/page-dreamGlazeDraw.ts b/skills/anidoodle/engine/src/hosts/page-dreamGlazeDraw.tsnew file mode 100644index 0000000..f37b418--- /dev/null+++ b/skills/anidoodle/engine/src/hosts/page-dreamGlazeDraw.ts@@ -0,0 +1,4 @@+import { dreamGlazeDraw } from "../canvas-core/dreamGlazeDraw";+import { mountFilm } from "./page";++mountFilm(dreamGlazeDraw);diff --git a/skills/anidoodle/engine/styles.gen.json b/skills/anidoodle/engine/styles.gen.jsonindex 84f057e..462c689 100644--- a/skills/anidoodle/engine/styles.gen.json+++ b/skills/anidoodle/engine/styles.gen.json@@ -54,6 +54,17 @@"drawFilm": "colouredPencil","source": "scanned"},+ {+ "id": "dreamGlaze",+ "name": "Dream glaze",+ "family": "paint",+ "medium": "resin-thinned oil glazes laid with a very small soft brush on a smooth white ground: no visible stroke, every form turned pixel by pixel under one low sun, every edge hard",+ "nearest": "paintedOil",+ "hero": "a hollow mask of a calm face held up by question marks in an empty desert, its cheek running out into a scroll of handwriting",+ "module": "engine/src/canvas-core/dreamGlaze.ts",+ "drawFilm": "dreamGlazeDraw",+ "source": "scanned"+ },{"id": "embroidery","name": "Hand embroidery",diff --git a/skills/anidoodle/references/styles/INDEX.md b/skills/anidoodle/references/styles/INDEX.mdindex 33bf965..06ccbbc 100644--- a/skills/anidoodle/references/styles/INDEX.md+++ b/skills/anidoodle/references/styles/INDEX.md@@ -10,31 +10,32 @@ blocks in `engine/src/canvas-core/` plus `engine/styles.legacy.json`. Do not edi| 3 | Broken colour (`brokenColour`) | opaque oil dabs from a loaded flat hog brush on primed linen, unmixed colours side by side for the eye to mix | `engine/src/canvas-core/brokenColour.ts` | `engine/src/canvas-core/brokenColour.ts` || 4 | Charcoal, erased and redrawn (`charcoalErasure`) | vine and compressed charcoal on heavy rag paper, stumped, lifted with a kneaded eraser, redrawn over its own residue | `engine/src/canvas-core/charcoalErasure.ts` | `engine/src/canvas-core/charcoalErasure.ts` || 5 | Coloured pencil (`colouredPencil`) | wax coloured pencils hatched in one diagonal on toothy cream cartridge paper, hues layered, darks cross-hatched | `engine/src/canvas-core/colouredPencil.ts` | `engine/src/canvas-core/colouredPencil.ts` |-| 6 | Hand embroidery (`embroidery`) | stranded cotton floss stitched through natural plain-weave linen in a beech hoop | `engine/src/canvas-core/embroidery.ts` | `engine/src/canvas-core/embroidery.ts` |-| 7 | Flat vector (`flatVector`) | pen-tool paths in a vector app, flat fills that land when a path closes, long-shadow shapes with a transparency ramp, a raster grain brush over the shade sides | `engine/src/canvas-core/flatVector.ts` | `engine/src/canvas-core/flatVector.ts` |-| 8 | Folk-tale storybook (`folkTale`) | gouache and watercolour over an HB pencil drawing on cream cartridge: opaque, dry-brushed paint in the foreground thinning to a pale wash and then to bare pencil in the distance | `engine/src/canvas-core/folkTale.ts` | `engine/src/canvas-core/folkTale.ts` |-| 9 | Cut-paper collage (`fox`) | zero drawn lines: torn pieces with a white fibrous edge, scissor pieces crisp, each lifting a soft shadow off the piece below | `engine/src/canvas-core/fox.ts` | `engine/src/canvas-core/foxDraw.ts` |-| 10 | Newsprint halftone (`halftone`) | web-offset newspaper print: black on a 45 degree AM screen plus one orange spot at 15 degrees, oil ink gaining into unbleached groundwood newsprint | `engine/src/canvas-core/halftone.ts` | `engine/src/canvas-core/halftone.ts` |-| 11 | Isometric cutaway (`isometric`) | flat vector planes on a true 2:1 isometric grid, three tones per material, crisp edges, pen-tool order | `engine/src/canvas-core/isometric.ts` | `engine/src/canvas-core/isometric.ts` |-| 12 | Marker comic (`koi`) | alcohol-marker cel fills with a hard shadow edge under one heavy contour that thickens away from the light | `engine/src/canvas-core/koi.ts` | `engine/src/canvas-core/koiDraw.ts` |-| 13 | Risograph (`lighthouse`) | soy ink, one layer per drum multiplied through its own registration offset; every other colour an overprint, tone a halftone screen per ink angle, white is bare paper | `engine/src/canvas-core/lighthouse.ts` | `engine/src/canvas-core/lighthouseDraw.ts` |-| 14 | Low-poly (`lowPoly`) | triangle meshes projected by hand through a pinhole camera, each facet flat-shaded by its normal against one low sun, painter-sorted far to near; no 3D engine | `engine/src/canvas-core/lowPoly.ts` | `engine/src/canvas-core/lowPoly.ts` |-| 15 | Single-line engraving (`mellan`) | one unbroken engraved line whose width follows a procedural tone field: the whole picture is a single stroke | `engine/src/canvas-core/mellan.ts` | `engine/src/canvas-core/mellanUnspool.ts` |-| 16 | Mid-century gouache (`midCentury`) | opaque matte designer's gouache on warm illustration board, a dry brush dragged over the flats, a loose brush-and-ink line printed off register | `engine/src/canvas-core/midCentury.ts` | `engine/src/canvas-core/midCentury.ts` |-| 17 | Chalkboard (`moonPhases`) | side-of-the-chalk scumble on a slate board, lit limbs worked twice, every stroke broken by the board's tooth with dust either side, ghosts of old lessons | `engine/src/canvas-core/moonPhases.ts` | `engine/src/canvas-core/moonPhasesDraw.ts` |-| 18 | Oil on canvas (`paintedOil`) | opaque oil paint with hog-bristle brushes on a toned linen canvas, lean block-in to fat impasto | `engine/src/canvas-core/paintedOil.ts` | `engine/src/canvas-core/paintedOil.ts` |-| 19 | Toy-theatre paper collage (`paperCraft`) | a cardboard toy theatre: patterned and sugar papers cut and torn, gouache-painted cut-outs with a white sticker margin, every piece with a card edge and a gap to the flat behind | `engine/src/canvas-core/paperCraft.ts` | `engine/src/canvas-core/paperCraft.ts` |-| 20 | Pixel art (`pixelArt`) | a 120x120 grid of cells, each one of 16 declared palette colours, laid one cell at a time and blown up by a whole number, no smoothing | `engine/src/canvas-core/pixelArt.ts` | `engine/src/canvas-core/pixelArt.ts` |-| 21 | Ballpoint sketch (`pocketWatch`) | one blue ballpoint on cream cartridge, near-constant weight; tone only from where the hatching sits, plus the blob where a firm stroke stops | `engine/src/canvas-core/pocketWatch.ts` | `engine/src/canvas-core/pocketWatchDraw.ts` |-| 22 | Pencil & watercolour (`ranunculus`) | graphite and pan watercolour on cold-press: washes that never quite fill their outline, form shaded toward one light, graphite over the paint | `engine/src/canvas-core/ranunculus.ts` | `engine/src/canvas-core/ranunculusDraw.ts` |-| 23 | Rubber hose (`rubberHose`) | India ink at one pressure on a clear cel over a blue-pencil rough, flat grey paint on the back, photographed and printed on black-and-white film | `engine/src/canvas-core/rubberHose.ts` | `engine/src/canvas-core/rubberHose.ts` |-| 24 | Archival scrapbook (`scrapbook`) | foxed rag-paper album page; torn cards, cellulose tape, a clothespin on twine; copperplate engravings hand-tinted; typewriter, ransom-note cut letters, red pen, rubber stamp | `engine/src/canvas-core/scrapbook.ts` | `engine/src/canvas-core/scrapbook.ts` |-| 25 | Scratchboard (`scratchboard`) | white china clay under black India ink; every mark is ink scraped away with a knife or scratch nib | `engine/src/canvas-core/scratchboard.ts` | `engine/src/canvas-core/scratchboard.ts` |-| 26 | Pen-and-ink stipple (`stipple`) | one 0.25 mm technical pen dotted straight down onto hot-press bristol; tone is dot density only | `engine/src/canvas-core/stipple.ts` | `engine/src/canvas-core/stipple.ts` |-| 27 | Storybook pencil + watercolour (`storybook`) | storybook graphite and gentle pan watercolour, drawn for a recurring character | `engine/src/canvas-core/storybook.ts` | `engine/src/canvas-core/storybookDraw.ts` |-| 28 | Sumi-e ink painting (`sumiE`) | one loaded soft brush of sumi ink, five dilutions, on unsized absorbent xuan paper, with a cinnabar seal | `engine/src/canvas-core/sumiE.ts` | `engine/src/canvas-core/sumiE.ts` |-| 29 | Toy brick (`toyBrick`) | moulded ABS toy bricks, rendered flat-plastic in orthographic view: face tones by the cube rule, bevel highlights, seam hairlines, real studs, a soft ground shadow | `engine/src/canvas-core/toyBrick.ts` | `engine/src/canvas-core/toyBrick.ts` |-| 30 | Ukiyo-e colour woodblock (`woodcut`) | water-based pigment printed by baren from hand-carved cherry blocks onto damp kozo washi: a sumi keyblock, flat colour blocks, bokashi wipes | `engine/src/canvas-core/woodcut.ts` | `engine/src/canvas-core/woodcut.ts` |-| 31 | Ink & line-wash (`wren`) | wet washes first that flood past the line and settle along each shape's bottom edge, backruns, then a flexible nib thick on the press and hair-thin on the lift | `engine/src/canvas-core/wren.ts` | `engine/src/canvas-core/wrenDraw.ts` |+| 6 | Dream glaze (`dreamGlaze`) | resin-thinned oil glazes laid with a very small soft brush on a smooth white ground: no visible stroke, every form turned pixel by pixel under one low sun, every edge hard | `engine/src/canvas-core/dreamGlaze.ts` | `engine/src/canvas-core/dreamGlazeDraw.ts` |+| 7 | Hand embroidery (`embroidery`) | stranded cotton floss stitched through natural plain-weave linen in a beech hoop | `engine/src/canvas-core/embroidery.ts` | `engine/src/canvas-core/embroidery.ts` |+| 8 | Flat vector (`flatVector`) | pen-tool paths in a vector app, flat fills that land when a path closes, long-shadow shapes with a transparency ramp, a raster grain brush over the shade sides | `engine/src/canvas-core/flatVector.ts` | `engine/src/canvas-core/flatVector.ts` |+| 9 | Folk-tale storybook (`folkTale`) | gouache and watercolour over an HB pencil drawing on cream cartridge: opaque, dry-brushed paint in the foreground thinning to a pale wash and then to bare pencil in the distance | `engine/src/canvas-core/folkTale.ts` | `engine/src/canvas-core/folkTale.ts` |+| 10 | Cut-paper collage (`fox`) | zero drawn lines: torn pieces with a white fibrous edge, scissor pieces crisp, each lifting a soft shadow off the piece below | `engine/src/canvas-core/fox.ts` | `engine/src/canvas-core/foxDraw.ts` |+| 11 | Newsprint halftone (`halftone`) | web-offset newspaper print: black on a 45 degree AM screen plus one orange spot at 15 degrees, oil ink gaining into unbleached groundwood newsprint | `engine/src/canvas-core/halftone.ts` | `engine/src/canvas-core/halftone.ts` |+| 12 | Isometric cutaway (`isometric`) | flat vector planes on a true 2:1 isometric grid, three tones per material, crisp edges, pen-tool order | `engine/src/canvas-core/isometric.ts` | `engine/src/canvas-core/isometric.ts` |+| 13 | Marker comic (`koi`) | alcohol-marker cel fills with a hard shadow edge under one heavy contour that thickens away from the light | `engine/src/canvas-core/koi.ts` | `engine/src/canvas-core/koiDraw.ts` |+| 14 | Risograph (`lighthouse`) | soy ink, one layer per drum multiplied through its own registration offset; every other colour an overprint, tone a halftone screen per ink angle, white is bare paper | `engine/src/canvas-core/lighthouse.ts` | `engine/src/canvas-core/lighthouseDraw.ts` |+| 15 | Low-poly (`lowPoly`) | triangle meshes projected by hand through a pinhole camera, each facet flat-shaded by its normal against one low sun, painter-sorted far to near; no 3D engine | `engine/src/canvas-core/lowPoly.ts` | `engine/src/canvas-core/lowPoly.ts` |+| 16 | Single-line engraving (`mellan`) | one unbroken engraved line whose width follows a procedural tone field: the whole picture is a single stroke | `engine/src/canvas-core/mellan.ts` | `engine/src/canvas-core/mellanUnspool.ts` |+| 17 | Mid-century gouache (`midCentury`) | opaque matte designer's gouache on warm illustration board, a dry brush dragged over the flats, a loose brush-and-ink line printed off register | `engine/src/canvas-core/midCentury.ts` | `engine/src/canvas-core/midCentury.ts` |+| 18 | Chalkboard (`moonPhases`) | side-of-the-chalk scumble on a slate board, lit limbs worked twice, every stroke broken by the board's tooth with dust either side, ghosts of old lessons | `engine/src/canvas-core/moonPhases.ts` | `engine/src/canvas-core/moonPhasesDraw.ts` |+| 19 | Oil on canvas (`paintedOil`) | opaque oil paint with hog-bristle brushes on a toned linen canvas, lean block-in to fat impasto | `engine/src/canvas-core/paintedOil.ts` | `engine/src/canvas-core/paintedOil.ts` |+| 20 | Toy-theatre paper collage (`paperCraft`) | a cardboard toy theatre: patterned and sugar papers cut and torn, gouache-painted cut-outs with a white sticker margin, every piece with a card edge and a gap to the flat behind | `engine/src/canvas-core/paperCraft.ts` | `engine/src/canvas-core/paperCraft.ts` |+| 21 | Pixel art (`pixelArt`) | a 120x120 grid of cells, each one of 16 declared palette colours, laid one cell at a time and blown up by a whole number, no smoothing | `engine/src/canvas-core/pixelArt.ts` | `engine/src/canvas-core/pixelArt.ts` |+| 22 | Ballpoint sketch (`pocketWatch`) | one blue ballpoint on cream cartridge, near-constant weight; tone only from where the hatching sits, plus the blob where a firm stroke stops | `engine/src/canvas-core/pocketWatch.ts` | `engine/src/canvas-core/pocketWatchDraw.ts` |+| 23 | Pencil & watercolour (`ranunculus`) | graphite and pan watercolour on cold-press: washes that never quite fill their outline, form shaded toward one light, graphite over the paint | `engine/src/canvas-core/ranunculus.ts` | `engine/src/canvas-core/ranunculusDraw.ts` |+| 24 | Rubber hose (`rubberHose`) | India ink at one pressure on a clear cel over a blue-pencil rough, flat grey paint on the back, photographed and printed on black-and-white film | `engine/src/canvas-core/rubberHose.ts` | `engine/src/canvas-core/rubberHose.ts` |+| 25 | Archival scrapbook (`scrapbook`) | foxed rag-paper album page; torn cards, cellulose tape, a clothespin on twine; copperplate engravings hand-tinted; typewriter, ransom-note cut letters, red pen, rubber stamp | `engine/src/canvas-core/scrapbook.ts` | `engine/src/canvas-core/scrapbook.ts` |+| 26 | Scratchboard (`scratchboard`) | white china clay under black India ink; every mark is ink scraped away with a knife or scratch nib | `engine/src/canvas-core/scratchboard.ts` | `engine/src/canvas-core/scratchboard.ts` |+| 27 | Pen-and-ink stipple (`stipple`) | one 0.25 mm technical pen dotted straight down onto hot-press bristol; tone is dot density only | `engine/src/canvas-core/stipple.ts` | `engine/src/canvas-core/stipple.ts` |+| 28 | Storybook pencil + watercolour (`storybook`) | storybook graphite and gentle pan watercolour, drawn for a recurring character | `engine/src/canvas-core/storybook.ts` | `engine/src/canvas-core/storybookDraw.ts` |+| 29 | Sumi-e ink painting (`sumiE`) | one loaded soft brush of sumi ink, five dilutions, on unsized absorbent xuan paper, with a cinnabar seal | `engine/src/canvas-core/sumiE.ts` | `engine/src/canvas-core/sumiE.ts` |+| 30 | Toy brick (`toyBrick`) | moulded ABS toy bricks, rendered flat-plastic in orthographic view: face tones by the cube rule, bevel highlights, seam hairlines, real studs, a soft ground shadow | `engine/src/canvas-core/toyBrick.ts` | `engine/src/canvas-core/toyBrick.ts` |+| 31 | Ukiyo-e colour woodblock (`woodcut`) | water-based pigment printed by baren from hand-carved cherry blocks onto damp kozo washi: a sumi keyblock, flat colour blocks, bokashi wipes | `engine/src/canvas-core/woodcut.ts` | `engine/src/canvas-core/woodcut.ts` |+| 32 | Ink & line-wash (`wren`) | wet washes first that flood past the line and settle along each shape's bottom edge, backruns, then a flexible nib thick on the press and hair-thin on the lift | `engine/src/canvas-core/wren.ts` | `engine/src/canvas-core/wrenDraw.ts` |-31 styles.+32 styles.diff --git a/skills/anidoodle/references/styles/dreamGlaze.md b/skills/anidoodle/references/styles/dreamGlaze.mdnew file mode 100644index 0000000..b89165f--- /dev/null+++ b/skills/anidoodle/references/styles/dreamGlaze.md@@ -0,0 +1,19 @@+# Dream glaze (hand-painted dream) · `dreamGlaze.ts`++**Medium, physically.** Oil thinned with resin, laid in thin glazes with a very small soft brush on a smooth white ground. The surface is enamel-flat: no bristle, no ridge, no visible stroke. This is the hand of the "hand-painted dream photograph": an impossible scene painted as carefully as a still life.++**The mark.** None that shows. A form is turned by value steps too fine to see, so the unit is the single pixel, each one lit by the same sun. Every standing thing is a height field (`Obj.at` returns its edge distance, its height toward the eye, two surface coordinates and a material); the painter takes the normal from the heights, walks toward the sun across them for cast shadows (`sunAt`), and mixes a warm sun, a cool sky and a warm bounce from the ground (`light`). Nothing is a stroke, a gradient fill or a blur.++**The edge.** Hard, near and far alike. Depth is haze and scale, never softness. A thing a mile off is as sharp as a thing at arm's length, only smaller and paler.++**Order.** A white primed panel; the drawing in thin umber; the sky laid twice (a thin glaze, then the full one) in rows from the top; the plain the same way; each form, furthest first, laid in its shadow tone; the cast shadows; the small accents (handwriting, lashes, stars); the main form worked up dark to light, last and slowest; the signature.++**Space and light.** A pinhole camera over an endless plain, the horizon low. One low sun, front-left: every form is lit from it and every shadow rakes right and away, computed on the ground from the same alpha that draws the object. Small figures and repeated objects give the scale.++**Palette & ground.** Ultramarine falling through turquoise to lemon at the horizon; an ochre and umber plain; waxy flesh; violet-umber shadows; one saturated orange, kept for a single accent. A fine linen weave at 4% and the core `paper` tile at 5%; the corners a little sunk, as old varnish does.++**Not its neighbour.** `paintedOil` shows its bristle, loses its edges into shadow and works wet into wet. Dream glaze hides the brush and keeps every edge; its drama is in the idea and the light, never in the paint.++**Subject rule.** The hand is only half of it. The picture needs soft things that should be hard, things held up that should fall, one object repeated to the horizon, and one image hiding a second meaning. Invent your own props for your own subject; never re-stage a known painting.++**Motion grammar.** Marks arrive; nothing fades. Grounds are laid in boustrophedon rows whose lower edge wavers (`rows`). Forms are laid in a shadow tone and then worked up: a ceiling on lightness rises across the form, so shadows finish first and highlights last (`forms`). Handwriting runs out along its line. The last frames are the still, pixel for pixel.diff --git a/skills/anidoodle/references/workflows/launch-video.md b/skills/anidoodle/references/workflows/launch-video.mdindex 7510821..51b23df 100644--- a/skills/anidoodle/references/workflows/launch-video.md+++ b/skills/anidoodle/references/workflows/launch-video.md@@ -64,7 +64,7 @@ pieces are examples of the craft, never material for someone else's film.product's UI, the detail the shot is about, or busy texture. Check it in a review still atthe smallest delivery size. In doubt, the word gets its own frame.- **3-7 words a frame, few frames.** Collapse word cards into one claim then proof ("JUST CODE."- then "31 STYLES"); fewer cards leave more time for the proof.+ then "32 STYLES"); fewer cards leave more time for the proof.- **Hold each settled word 0.5 s or more**, longer for the claim.- **Judge DESIGN in review stills, not only collisions**: hierarchy, spacing, whether the framewould pass as a poster. A frame with nothing overlapping can still be ugly.diff --git a/skills/anidoodle/references/working-method.md b/skills/anidoodle/references/working-method.mdindex e9f0de4..3cc3e8f 100644--- a/skills/anidoodle/references/working-method.md+++ b/skills/anidoodle/references/working-method.md@@ -68,7 +68,7 @@ None of that was drawing. These habits cut it by an order of magnitude:is every 50th frame from 0 to 300. Add `--sheet out/sheet.jpg` for a contact sheet of them at`--sheet-scale` (default 0.4). `--out out/dir/` or `--out out/x-{frame}.png` names the PNGs.- **Plate cache.** Finished plate frames are kept in `engine/.cache/bakes/<browser version>-<binary>/`,- keyed by a hash of the plate's whole import closure, so a wall of 31 live plates stops+ keyed by a hash of the plate's whole import closure, so a wall of 32 live plates stopsre-baking (about 60 s) on every still, and an edited plate simply misses and is drawn again.It is never needed: delete `.cache/` any time. `--no-bake-cache` (or `ANIDOODLE_BAKE_CACHE=0`)draws every plate cold, which is what to do when you suspect the cache.