Skip to content

alexgreensh/anidoodle / skills/anidoodle

anidoodle

Flagged

Code-drawn stills, films, 3D motion graphics, explainers and web animations in 32 styles, with scores, narration and subtitles. Use when asked for an illustration, animation, video or drawing lesson.

FileKindSize
SKILL.mdskill md13.7 KB
assets/styles.jpgbinary1.6 MB
engine/SFX_VERSIONING.mdmarkdown862 B
engine/assets/brand/lantern/brand.jsonconfig1.8 KB
engine/assets/brand/lantern/brand.tsscript1.7 KB
engine/assets/brand/lantern/lanternMark.svgother687 B
engine/assets/fonts/InstrumentSans-Bold.ttfbinary66.5 KB
engine/assets/fonts/InstrumentSans-OFL.txtmarkdown4.3 KB
engine/assets/fonts/InstrumentSans-Regular.ttfbinary66.4 KB
engine/assets/fonts/Lora-Bold.ttfbinary130.7 KB
engine/assets/fonts/Lora-OFL.txtmarkdown4.3 KB
engine/assets/fonts/PROVENANCE.mdmarkdown3.2 KB
engine/assets/fonts/Poppins-Bold.ttfbinary152.3 KB
engine/assets/fonts/Poppins-OFL.txtmarkdown4.3 KB
engine/assets/fonts/poppinsBold.tsscript203.7 KB
engine/assets/narration/narrationDemo.jsonconfig700 B
engine/assets/refs/PROVENANCE.jsonconfig836 B
engine/assets/refs/vangogh-almond-blossom.jpgbinary1021.9 KB
engine/facts/launchClip.jsonconfig789 B
engine/facts/launchExample.jsonconfig708 B
engine/facts/launchExampleBrand.jsonconfig1.2 KB
engine/facts/launchExampleClean.jsonconfig1.4 KB
engine/facts/launchExampleCleanChat.jsonconfig1.1 KB
engine/package-lock.jsonmanifest122.6 KB
engine/package.jsonmanifest934 B
engine/reviews/launchClip.jsonconfig4.8 KB
engine/reviews/launchExample.jsonconfig4.4 KB
engine/reviews/launchExampleBrand.jsonconfig9.2 KB
engine/reviews/launchExampleClean.jsonconfig4.4 KB
engine/reviews/launchExampleCleanChat.jsonconfig13.3 KB
engine/src/canvas-core/adaptAlmond.tsscript15.2 KB
engine/src/canvas-core/adaptAquarelle.tsscript14.1 KB
engine/src/canvas-core/adaptScrapbook.tsscript11.5 KB
engine/src/canvas-core/assetKit.tsscript8.4 KB
engine/src/canvas-core/bake.tsscript8.0 KB
engine/src/canvas-core/bakerSheet.tsscript4.7 KB
engine/src/canvas-core/balloon.tsscript20.0 KB
engine/src/canvas-core/balloonDraw.tsscript4.7 KB
engine/src/canvas-core/banner.tsscript42.3 KB
engine/src/canvas-core/bitRig.tsscript23.9 KB
engine/src/canvas-core/blueprint.tsscript42.5 KB
engine/src/canvas-core/blueprintKit.tsscript15.1 KB
engine/src/canvas-core/brandKit.tsscript10.4 KB
engine/src/canvas-core/brickBalloon.tsscript31.1 KB
engine/src/canvas-core/brokenColour.tsscript31.2 KB
engine/src/canvas-core/brokenColourKit.tsscript9.7 KB
engine/src/canvas-core/callout.tsscript9.6 KB
engine/src/canvas-core/calloutDemo.tsscript3.6 KB
engine/src/canvas-core/camera.tsscript13.2 KB
engine/src/canvas-core/character/build.tsscript2.9 KB
engine/src/canvas-core/character/check.tsscript9.5 KB
engine/src/canvas-core/character/design.tsscript7.3 KB
engine/src/canvas-core/character/human/balance.tsscript8.2 KB
engine/src/canvas-core/character/human/canon.tsscript3.8 KB
engine/src/canvas-core/character/human/clothing.tsscript4.5 KB
engine/src/canvas-core/character/human/figure.tsscript4.0 KB
engine/src/canvas-core/character/human/hands.tsscript10.9 KB
engine/src/canvas-core/character/human/head.tsscript23.2 KB
engine/src/canvas-core/character/human/mannequin.tsscript15.7 KB
engine/src/canvas-core/character/human/skeleton.tsscript10.3 KB
engine/src/canvas-core/character/human/walk.tsscript7.9 KB
engine/src/canvas-core/character/identity.tsscript2.3 KB
engine/src/canvas-core/character/math3.tsscript5.6 KB
engine/src/canvas-core/character/render/brick.tsscript4.0 KB
engine/src/canvas-core/character/render/grid.tsscript5.2 KB
engine/src/canvas-core/character/render/marker.tsscript3.5 KB
engine/src/canvas-core/character/render/pencil.tsscript6.6 KB
engine/src/canvas-core/character/render/pixel.tsscript3.1 KB
engine/src/canvas-core/character/render/riso.tsscript7.1 KB
engine/src/canvas-core/character/render/scratch.tsscript6.2 KB
engine/src/canvas-core/character/render/storybook.tsscript5.6 KB
engine/src/canvas-core/character/render/sumi.tsscript5.3 KB
engine/src/canvas-core/character/render/woodcut.tsscript4.3 KB
engine/src/canvas-core/character/shape2d.tsscript4.7 KB
engine/src/canvas-core/character/types.tsscript3.3 KB
engine/src/canvas-core/character/view25d.tsscript2.9 KB
engine/src/canvas-core/characters/mira/drawn.tsscript5.1 KB
engine/src/canvas-core/characters/mira/index.tsscript19.1 KB
engine/src/canvas-core/characters/mira/palettes.tsscript7.0 KB
engine/src/canvas-core/characters/mira/poses.tsscript10.2 KB
engine/src/canvas-core/characters/theo/baker.tsscript15.0 KB
engine/src/canvas-core/characters/theo/index.tsscript6.1 KB
engine/src/canvas-core/characters/theo/poses.tsscript10.6 KB
engine/src/canvas-core/characters/theo/wardrobe.tsscript12.4 KB
engine/src/canvas-core/charcoalErasure.tsscript30.7 KB
engine/src/canvas-core/charcoalErasureKit.tsscript9.4 KB
engine/src/canvas-core/cheetahBody.tsscript16.5 KB
engine/src/canvas-core/cheetahDusk.tsscript20.9 KB
engine/src/canvas-core/cheetahRig.tsscript8.9 KB
engine/src/canvas-core/cheetahRun.tsscript19.0 KB
engine/src/canvas-core/cheetahRunSigned.tsscript173 B
engine/src/canvas-core/cheetahScenery.tsscript11.8 KB
engine/src/canvas-core/cheetahTurn.tsscript5.5 KB
engine/src/canvas-core/colouredPencil.tsscript45.0 KB
engine/src/canvas-core/colouredPencilCrow.tsscript13.4 KB
engine/src/canvas-core/colouredPencilKit.tsscript17.8 KB
engine/src/canvas-core/core.tsscript30.0 KB
engine/src/canvas-core/cues.tsscript7.7 KB
engine/src/canvas-core/drafting.tsscript7.4 KB
engine/src/canvas-core/drawingMarks.tsscript13.3 KB
engine/src/canvas-core/drawingScore.tsscript17.5 KB
engine/src/canvas-core/dreamGlaze.tsscript30.9 KB
engine/src/canvas-core/dreamGlazeDraw.tsscript10.4 KB
engine/src/canvas-core/dreamGlazeKit.tsscript19.1 KB
engine/src/canvas-core/embroidery.tsscript32.2 KB
engine/src/canvas-core/embroideryAlive.tsscript19.6 KB
engine/src/canvas-core/embroideryKit.tsscript14.6 KB
engine/src/canvas-core/endCard.tsscript8.8 KB
engine/src/canvas-core/figureSheet.tsscript8.2 KB
engine/src/canvas-core/film.tsscript6.4 KB
engine/src/canvas-core/fixtureDeck.tsscript165 B
engine/src/canvas-core/fixtureMotion.tsscript5.4 KB
engine/src/canvas-core/fixtureRigBrokenGrip.tsscript250 B
engine/src/canvas-core/fixtureShip.tsscript7.4 KB
engine/src/canvas-core/fixtureShipBlind.tsscript159 B
engine/src/canvas-core/fixtureShipGreen.tsscript159 B
engine/src/canvas-core/fixtureShipLocked.tsscript126 B
engine/src/canvas-core/fixtureShipRed.tsscript157 B
engine/src/canvas-core/fixtureShipTrack.tsscript125 B
engine/src/canvas-core/fixtureWorld.tsscript166 B
engine/src/canvas-core/flatVector.tsscript22.8 KB
engine/src/canvas-core/folkTale.tsscript56.9 KB
engine/src/canvas-core/folkTaleKit.tsscript42.7 KB
engine/src/canvas-core/formMascot.tsscript4.9 KB
engine/src/canvas-core/fox.tsscript15.7 KB
engine/src/canvas-core/foxDraw.tsscript5.6 KB
engine/src/canvas-core/fromPhoto.tsscript8.7 KB
engine/src/canvas-core/gallery.tsscript9.5 KB
engine/src/canvas-core/halftone.tsscript10.3 KB
engine/src/canvas-core/halftoneKit.tsscript9.7 KB
engine/src/canvas-core/halftoneScene.tsscript26.5 KB
engine/src/canvas-core/input.tsscript16.8 KB
engine/src/canvas-core/isometric.tsscript36.2 KB
engine/src/canvas-core/isometricKit.tsscript3.9 KB
engine/src/canvas-core/kinetic.tsscript42.6 KB
engine/src/canvas-core/kineticDemo.tsscript3.6 KB
engine/src/canvas-core/koi.tsscript28.9 KB
engine/src/canvas-core/koiAlive.tsscript34 B
engine/src/canvas-core/koiDraw.tsscript3.5 KB
engine/src/canvas-core/koiDrawKit.tsscript6.9 KB
engine/src/canvas-core/koiWorld.tsscript9.3 KB
engine/src/canvas-core/launch.tsscript39.5 KB
engine/src/canvas-core/launch2.tsscript27.6 KB
engine/src/canvas-core/launch3.tsscript9.2 KB
engine/src/canvas-core/launchClip.tsscript39 B
engine/src/canvas-core/launchCode.tsscript3.8 KB
engine/src/canvas-core/launchCut.tsscript6.9 KB
engine/src/canvas-core/launchExample.tsscript3.4 KB
engine/src/canvas-core/launchExampleBrand.tsscript7.7 KB
engine/src/canvas-core/launchExampleClean.tsscript6.7 KB
engine/src/canvas-core/launchExampleCleanChat.tsscript5.0 KB
engine/src/canvas-core/launchExampleCleanScore.tsscript3.4 KB
engine/src/canvas-core/launchExampleScore.tsscript3.7 KB
engine/src/canvas-core/launchGallery.tsscript9.2 KB
engine/src/canvas-core/launchKit.tsscript28.1 KB
engine/src/canvas-core/launchLayout.tsscript19.9 KB
engine/src/canvas-core/launchLook.tsscript17.7 KB
engine/src/canvas-core/launchSound.tsscript5.8 KB
engine/src/canvas-core/launchTemplate.tsscript117.8 KB
engine/src/canvas-core/lesson.tsscript9.4 KB
engine/src/canvas-core/lessonCat.tsscript22.4 KB
engine/src/canvas-core/lessonCatFinal.tsscript204 B
engine/src/canvas-core/lessonCatSheet.tsscript263 B
engine/src/canvas-core/lessonOwl.tsscript49.3 KB
engine/src/canvas-core/lessonOwlFinal.tsscript204 B
engine/src/canvas-core/lessonOwlLayout.tsscript11.0 KB
engine/src/canvas-core/lessonOwlScore.tsscript8.7 KB
engine/src/canvas-core/lessonOwlSheet.tsscript446 B
engine/src/canvas-core/lessonOwlSocial.tsscript6.2 KB
engine/src/canvas-core/lettering.tsscript5.9 KB
engine/src/canvas-core/lighthouse.tsscript12.3 KB
engine/src/canvas-core/lighthouseDraw.tsscript5.5 KB
engine/src/canvas-core/lowPoly.tsscript24.5 KB
engine/src/canvas-core/mascotHero.tsscript4.6 KB
engine/src/canvas-core/mechanism.tsscript27.9 KB
engine/src/canvas-core/mechanismBlueprint.tsscript260 B
engine/src/canvas-core/mechanismDraw.tsscript297 B
engine/src/canvas-core/mechanismExplorer.tsscript4.8 KB
engine/src/canvas-core/mechanismHands.tsscript17.1 KB
engine/src/canvas-core/mechanismKit.tsscript38.9 KB
engine/src/canvas-core/mechanismPencil.tsscript277 B
engine/src/canvas-core/mechanismStipple.tsscript250 B
engine/src/canvas-core/mellan.tsscript9.7 KB
engine/src/canvas-core/mellanUnspool.tsscript3.2 KB
engine/src/canvas-core/midCentury.tsscript24.6 KB
engine/src/canvas-core/miraComic.tsscript4.3 KB
engine/src/canvas-core/miraEveryHand.tsscript5.2 KB
engine/src/canvas-core/miraRiso.tsscript3.6 KB
engine/src/canvas-core/miraSheet.tsscript8.0 KB
engine/src/canvas-core/miraTile.tsscript5.1 KB
engine/src/canvas-core/miraTriptych.tsscript2.7 KB
engine/src/canvas-core/miraWalk.tsscript7.7 KB
engine/src/canvas-core/moonPhases.tsscript16.7 KB
engine/src/canvas-core/moonPhasesDraw.tsscript4.3 KB
engine/src/canvas-core/morph.tsscript8.8 KB
engine/src/canvas-core/morphDemo.tsscript2.4 KB
engine/src/canvas-core/motif.tsscript2.5 KB
engine/src/canvas-core/motionKit.tsscript9.3 KB
engine/src/canvas-core/motionMeta.tsscript1.1 KB
engine/src/canvas-core/music/arc.tsscript6.2 KB

engine/src/canvas-core/adaptAlmond.ts

View on GitHub
import { rng, fractal, type Medium, type P } from "./core";
import type { Film } from "./film";
import { bounds, clamp, inside, mix, smooth } from "./gallery";
import { fit, runProcess, timeline, type Proc } from "./sumiEKit";
import { fill, oilStroke, weave, type OStroke } from "./paintedOilKit";
import { KOI_HI, koiBody, koiFins, padShape, tail } from "./koi";

// A KOI IN THE ALMOND-BLOSSOM HAND · adapted from a picture the user brought.
//
// REFERENCE: Vincent van Gogh, Almond Blossom (1890), public domain (Wikimedia Commons; sha256 and
// source in engine/assets/refs/PROVENANCE.json). What is borrowed is the HAND.
// The subject (a flowering branch against the sky), the composition (branches crossing the whole
// field from the lower edge) and the blossoms themselves are not taken. The subject here is the
// launch film's own koi, in its own pond, laid out as in koi.ts, so the same fish can be seen
// changing hands.
//
// MEDIUM RECIPE, written from the painting at full size and at a 3x crop:
//   MARK: opaque oil, a loaded bristle brush, short strokes about a finger long. The ground (his
//     sky, our water) is laid in small patches of strokes that share a direction, the patches
//     turning against each other, so the flat colour shimmers without ever breaking into dabs.
//     Forms are painted ALONG their length (a branch in strokes that run with it), so the form's
//     own grain reads. Lights are thick: the blossoms stand off the canvas, ridged.
//   EDGE: hard and outlined. The Japanese-print line: a dark blue-green contour laid last with a
//     small round brush, broken, heavier on the shadow side, sometimes skipping a stretch
//     entirely. Ground strokes butt up to the forms; nothing is blended across an edge.
//   ORDER: the ground first, everywhere; the forms over it in their mid tone; their lights; the
//     contour; the last thick whites.
//   PAPER: canvas, the weave showing through the thinner ground strokes.
//   PALETTE: turquoise to cerulean for the ground (value range narrow and high, L 0.68-0.84); a
//     cool sage and grey-green for the woody forms; cream and lead white warmed with a yellow-green
//     heart; a whisper of pink and rust; the contour a deep blue-green, never black.
// WHAT IT IS NOT: nearest by eye is paintedOil (the same bristle mark and impasto). It differs in
//   three things: a high-key flat decorative ground instead of a lit room, a drawn dark contour
//   (paintedOil has none: its edges are found and lost), and no modelling in depth beyond one
//   step of shadow. The analyzer's nearest (charcoalErasure, storybook) are wrong by eye.

const W = 1080, H = 1080, N = 450; // 15 s; the last 30 frames are the finished picture
const OIL: Medium = { nib: 1, taper: 1, pressure: 1, retrace: false, wobble: 0, rough: 0 };

// ---------------------------------------------------------------- colour
const WATER = ["#6aa4b2", "#79b1bb", "#88bcc1", "#97c6c6", "#a9d1cc"];
const SHADE_W = "#5a92a1";
const SAGE = ["#6f8f74", "#88a684", "#a2bb96", "#bccdaa"];
const CREAM = "#f1eedc", CREAM_S = "#c7d3c1", LEAD = "#fbf8ea";
const RED = "#dc5f30", RED_S = "#ad4429", RED_L = "#ec8a55";
const CONTOUR = "#27413c", CONTOUR_2 = "#34524a";
const pick = (stops: string[], t: number) => { const f = clamp(t) * (stops.length - 1), i = Math.min(stops.length - 2, Math.floor(f)); return mix(stops[i], stops[i + 1], f - i); };

// ---------------------------------------------------------------- the forms (koi.ts's own)
const b = koiBody(), fins = koiFins(b), cau = tail(b);
const PADS: [number, number, number, number, number][] = [[905, 205, 168, 2.3, 3100], [890, 905, 120, 3.6, 3300], [120, 640, 88, 0.2, 3400]];
const padShapes = PADS.map(([x, y, r, n, s]) => padShape(x, y, r, n, s));
const patches = KOI_HI.map(([t, s, dt, ds, seed]) => { const r = rng(seed * 17), pts: P[] = []; for (let i = 0; i < 16; i++) { const a = (i / 16) * Math.PI * 2, kk = 0.8 + r() * 0.35; pts.push(b.at(t + Math.cos(a) * dt * kk, s + Math.sin(a) * ds * kk)); } return smooth(pts, true, 6); });

// the body's own frame, inverted by lookup: where along the fish (t) and across it (s) a point is
const TS: { p: P; t: number; s: number }[] = [];
for (let t = 0; t <= 1.0001; t += 0.01) for (let s = -1; s <= 1.0001; s += 0.1) TS.push({ p: b.at(t, s), t, s });
const frameOf = (x: number, y: number) => { let best = TS[0], d = 1e9; for (const q of TS) { const e = (q.p[0] - x) ** 2 + (q.p[1] - y) ** 2; if (e < d) { d = e; best = q; } } return best; };
const alongBody = (x: number, y: number) => { const q = frameOf(x, y), a = b.at(Math.min(1, q.t + 0.01), q.s), c = b.at(Math.max(0, q.t - 0.01), q.s); return Math.atan2(a[1] - c[1], a[0] - c[0]); };
// the fish's cast shadow on the pond floor, down and right, as in the marker plate
const castShadow = [b.outline, cau.shape].map((s) => s.map(([x, y]) => [x + 30, y + 40] as P));
const inCast = (x: number, y: number) => castShadow.some((s) => inside(s, x, y));
const onForm = (x: number, y: number) => inside(b.outline, x, y) || padShapes.some((s) => inside(s, x, y));

// ---------------------------------------------------------------- the passes
type Stage = { name: string; per: number; strokes: OStroke[]; clip?: P[][]; out?: P[][]; within?: P[] }; // out: kept clear, e.g. a fin's line where the fin runs under the body
const st = (ctrl: P[], w: number, c0: string, seed: number, c1 = c0, imp = 0.4, dry = 0.3, load = 1.05): OStroke => ({ ctrl, w, c0, c1, load, dry, impasto: imp, jit: 0.06, seed });
// a broken contour: the outline walked in short strokes of the small brush, a gap now and then,
// heavier on the side away from the light (upper left)
const contour = (path: P[], closed: boolean, w: number, seed: number, skip = 0.16): OStroke[] => {
  const r = rng(seed), pts = closed ? [...path, path[0]] : path, out: OStroke[] = [];
  let i = 0;
  while (i < pts.length - 2) {
    const n = 12 + Math.floor(r() * 16), seg = pts.slice(i, Math.min(pts.length, i + n + 2)); i += n;
    if (seg.length < 2 || r() < skip) continue;
    const m = seg[Math.floor(seg.length / 2)], prev = seg[0], next = seg[seg.length - 1], nx = -(next[1] - prev[1]), ny = next[0] - prev[0], shade = clamp(0.5 + 0.5 * ((nx * 0.62 + ny * 0.78) / (Math.hypot(nx, ny) || 1)));
    out.push(st(seg, w * (0.6 + 0.7 * shade) * (0.85 + 0.3 * r()), r() < 0.3 ? CONTOUR_2 : CONTOUR, seed * 100 + out.length, CONTOUR, 0.25, 0.35, 1.1));
    void m;
  }
  return out;
};

const stages = (): Stage[] => {
  const S: Stage[] = [];
  const FRAME: P[] = [[-30, -30], [W + 30, -30], [W + 30, H + 30], [-30, H + 30]];
  // 1. the ground: the whole pond in patches of like-directed strokes, darker in the fish's cast shadow
  const patchDir = (x: number, y: number) => (fractal(401, x, y, 0.006, 0.006, 2) - 0.5) * 5.2 + 0.25;
  S.push({ name: "water", per: 0.18, strokes: fill({
    region: FRAME, step: 19, len: 58, w: 20, dir: patchDir, seed: 410, dry: 0.2, load: 1.15, impasto: 0.42, jit: 0.08, soft: 0.2, bend: 0.5, sweep: 0.9,
    color: (x, y) => (onForm(x, y) && !inCast(x, y) ? null : inCast(x, y) ? mix(SHADE_W, pick(WATER, fractal(402, x, y, 0.01, 0.01, 2)), 0.25) : pick(WATER, fractal(402, x, y, 0.006, 0.006, 3) * 1.25 - 0.12)),
  }) });
  S.push({ name: "water lights", per: 0.3, strokes: fill({
    region: FRAME, step: 34, len: 46, w: 14, dir: patchDir, seed: 415, dry: 0.35, impasto: 0.4, jit: 0.06, soft: 0.2, bend: 0.5, sweep: 0.9,
    color: (x, y) => (onForm(x, y) || inCast(x, y) || fractal(416, x, y, 0.012, 0.012, 2) < 0.58 ? null : fractal(417, x, y, 0.02, 0.02, 1) > 0.5 ? mix(WATER[3], WATER[4], 0.5) : "#6fa7b8"),
  }) });
  // 2. the pads: sage, painted from the stalk outward like a leaf's own veins
  padShapes.forEach((pad, i) => {
    const [cx, cy, rr] = PADS[i];
    S.push({ name: `pad${i}`, per: 0.5, clip: [pad], strokes: fill({
      region: pad, step: 11, len: 30, w: 11, seed: 420 + i, dry: 0.3, impasto: 0.35, jit: 0.06, soft: 0.2,
      dir: (x, y) => Math.atan2(y - cy, x - cx),
      color: (x, y) => { const d = Math.hypot(x - cx, y - cy) / rr, lit = clamp(0.5 - 0.35 * ((x - cx) * 0.62 + (y - cy) * 0.78) / rr); return pick(SAGE, clamp(0.25 + 0.5 * lit + 0.2 * d + (fractal(430 + i, x, y, 0.03, 0.03, 2) - 0.5) * 0.3)); },
    }) });
  });
  // 3. the body in cream, strokes running nose to tail; one step of cool shadow on the far flank
  S.push({ name: "body", per: 0.6, clip: [b.outline], strokes: fill({
    region: b.outline, step: 10, len: 34, w: 12, seed: 440, dry: 0.25, impasto: 0.45, jit: 0.05, soft: 0.2, dir: alongBody,
    color: (x, y) => { const q = frameOf(x, y); return q.s > 0.45 ? mix(CREAM_S, CREAM, clamp((0.9 - q.s) * 1.5)) : CREAM; },
  }) });
  // 4. fins and tail: long strokes laid down each ray, cream going cool toward the edge, sage between
  const rayStrokes = (rays: P[][], seed: number, w: number) => rays.map((ray, k) => st(ray, w, CREAM, seed + k, CREAM_S, 0.3, 0.45, 1));
  fins.forEach((f, i) => S.push({ name: `fin${i}`, per: 1.2, clip: [f.shape], strokes: [...fill({ region: f.shape, step: 9, len: 22, w: 9, seed: 450 + i, dry: 0.4, impasto: 0.2, jit: 0.05, dir: (x, y) => Math.atan2(y - f.rays[0][0][1], x - f.rays[0][0][0]), color: () => mix(SAGE[3], CREAM_S, 0.5) }), ...rayStrokes(f.rays, 460 + i * 20, 8)] }));
  S.push({ name: "tail", per: 1, clip: [cau.shape], strokes: [...fill({ region: cau.shape, step: 10, len: 28, w: 10, seed: 470, dry: 0.4, impasto: 0.2, jit: 0.05, dir: (x, y) => Math.atan2(y - b.at(0.955, 0)[1], x - b.at(0.955, 0)[0]), color: () => mix(SAGE[3], CREAM_S, 0.5) }), ...rayStrokes(cau.rays, 480, 9)] });
  // 5. the red: vermilion laid along the body, rust on the shadow flank, a lighter pull on the back
  patches.forEach((pt, i) => S.push({ name: `red${i}`, per: 0.9, clip: [pt], within: b.outline, strokes: fill({
    region: pt, step: 8, len: 26, w: 10, seed: 500 + i, dry: 0.22, impasto: 0.5, jit: 0.05, soft: 0.15, dir: alongBody,
    color: (x, y) => { const q = frameOf(x, y); return q.s > 0.4 ? RED_S : q.s < -0.35 ? mix(RED, RED_L, 0.6) : RED; },
  }) }));
  // 6. the water lily on the big pad: thick white petals pulled from the heart outward, a yellow-green heart
  const LC: P = [880, 195], petals: OStroke[] = [];
  for (let k = 0; k < 11; k++) { const a = (k / 11) * Math.PI * 2 + 0.3, L = 46 + (k % 3) * 10; petals.push(st([[LC[0] + Math.cos(a) * 10, LC[1] + Math.sin(a) * 10], [LC[0] + Math.cos(a + 0.08) * L * 0.6, LC[1] + Math.sin(a + 0.08) * L * 0.6], [LC[0] + Math.cos(a) * L, LC[1] + Math.sin(a) * L]], 20, LEAD, 540 + k, k % 4 === 0 ? "#efc9c0" : CREAM, 0.85, 0.2, 1.3)); }
  for (let k = 0; k < 6; k++) { const a = (k / 6) * Math.PI * 2, L = 26; petals.push(st([[LC[0], LC[1]], [LC[0] + Math.cos(a) * L, LC[1] + Math.sin(a) * L]], 16, "#f7f2de", 560 + k, "#f3dcd0", 0.9, 0.15, 1.3)); }
  petals.push(st([[LC[0] - 6, LC[1] - 2], [LC[0] + 2, LC[1] + 3], [LC[0] + 8, LC[1] - 1]], 13, "#d8d676", 570, "#c9c85a", 0.9, 0.1, 1.4));
  S.push({ name: "lily", per: 2, strokes: petals });
  // 7. the contour: the dark blue-green line, laid last, broken
  const n = b.outline.length / 2, Lside = b.outline.slice(0, n), Rside = b.outline.slice(n).reverse(), cut = Math.round(n * 0.965);
  S.push({ name: "fin lines", per: 1.4, out: [b.outline], strokes: [...fins.flatMap((f, i) => contour(f.shape, true, 4, 610 + i, 0.08)), ...contour(cau.shape.slice(3, cau.shape.length - 3), false, 5, 620, 0.06)] });
  S.push({ name: "contour", per: 1.4, strokes: [
    ...contour([...Lside.slice(0, cut).reverse(), ...Rside.slice(0, cut)], false, 6.5, 600, 0.05),
    ...padShapes.flatMap((p, i) => contour(p, true, 5, 630 + i, 0.1)),
    ...patches.flatMap((p, i) => contour(p, true, 2.4, 640 + i, 0.55)),
  ] });
  // 8. the head: gill arcs and eyes in the contour colour, a glint of lead white
  const head: OStroke[] = [];
  [-1, 1].forEach((sd, hi) => {
    const gill: P[] = []; for (let i = 0; i <= 6; i++) gill.push(b.at(0.155 - Math.sin((i / 6) * Math.PI) * 0.03, sd * (0.98 - i * 0.1)));
    head.push(st(gill, 4, CONTOUR, 700 + hi, CONTOUR, 0.25, 0.4, 1.1));
    const e = b.at(0.085, sd * 0.8), ring = (r: number) => [0, 1, 2, 3, 4, 5, 6].map((k) => [e[0] + Math.cos(k * 1.05) * r, e[1] + Math.sin(k * 1.05) * r] as P);
    head.push(st(ring(6), 7, "#e3d48f", 710 + hi, "#e3d48f", 0.5, 0.1, 1.3), st(ring(2.5), 6, "#1e2a2a", 712 + hi, "#1e2a2a", 0.5, 0.05, 1.4), st([[e[0] - 3, e[1] - 3], [e[0] - 1, e[1] - 4]], 3, LEAD, 714 + hi, LEAD, 0.9, 0, 1.4));
  });
  S.push({ name: "head", per: 2, strokes: head });
  // 9. the last thick whites: light along the back and on the head, a few pulled ripples in the water
  const back: OStroke[] = [[0.2, 0.3, -0.6, 8], [0.335, 0.43, -0.64, 7], [0.47, 0.52, -0.66, 5.5], [0.06, 0.1, -0.4, 7]].map(([t0, t1, sv, w], k) => st([b.at(t0, sv), b.at((t0 + t1) / 2, sv - 0.03), b.at(t1, sv)], w, LEAD, 800 + k, "#f4f1df", 1, 0.2, 1.4));
  const rip: OStroke[] = [];
  [[300, 196, 34], [300, 196, 58], [300, 196, 84]].forEach(([x, y, r], k) => { const a0 = -2.4 + k * 0.2, a1 = a0 + 1.3; rip.push(st([0, 0.5, 1].map((u) => [x + Math.cos(a0 + (a1 - a0) * u) * r, y + Math.sin(a0 + (a1 - a0) * u) * r * 0.62] as P), 6, WATER[4], 820 + k, "#c3e0d8", 0.45, 0.5, 1.1)); });
  S.push({ name: "lights", per: 2, strokes: [...back, ...rip] });
  return S;
};

// ---------------------------------------------------------------- the process
const ground = (g: import("./core").Gfx) => { const c = g.cur, e = g.env; c.setTransform(e.scale, 0, 0, e.scale, 0, 0); c.fillStyle = "#e9e6d8"; c.fillRect(0, 0, e.W, e.H); weave(g, 0.5); };
const finish = (g: import("./core").Gfx) => weave(g, 0.22);
const withClip = (g: import("./core").Gfx, s: Stage, fn: () => void) => {
  if (!s.clip && !s.out) return fn();
  const c = g.cur, ring = (p: P[]) => { c.moveTo(p[0][0], p[0][1]); p.forEach(([x, y]) => c.lineTo(x, y)); c.closePath(); };
  c.save(); c.beginPath();
  if (s.clip) { s.clip.forEach(ring); c.clip("nonzero"); if (s.within) { c.beginPath(); ring(s.within); c.clip(); } } else { c.rect(-50, -50, W + 100, H + 100); s.out!.forEach(ring); c.clip("evenodd"); }
  fn(); c.restore();
};
const build = (k: number): Proc => {
  const tl = timeline(8, k, true);
  stages().forEach((s, si) => {
    const B = Math.max(1, Math.round(2 / s.per));
    for (let a = 0; a < s.strokes.length; a += B) {
      const batch = s.strokes.slice(a, a + B);
      tl.add(batch.length * s.per, (g, p) => withClip(g, s, () => { const f = p * batch.length; batch.forEach((x, i) => { if (p >= 1 || i < Math.floor(f)) oilStroke(g, x, 1); else if (i === Math.floor(f)) oilStroke(g, x, f - i); }); }));
    }
    tl.wait(si === 0 ? 10 : 4);
  });
  return { id: "adaptAlmond", medium: OIL, ground, ops: tl.ops, finish };
};
let PROC: Proc | null = null;
const proc = () => (PROC ??= fit(build, N - 31));

export const STYLE = { id: "adaptAlmond", name: "Almond-blossom hand, adapted", family: "paint", medium: "opaque oil in short patterned strokes on canvas, a broken dark blue-green contour, thick lead-white lights", nearest: "paintedOil", hero: "the launch film's koi, repainted in a hand borrowed from a public-domain painting", house: "styles/house/almond-blossom.json" };

export const adaptAlmond: Film = {
  meta: { title: "Koi · the almond-blossom hand (adapted)", W, H, fps: 30, bpm: 120, durationFrames: N, raster: "cpu" },
  assets: { images: {} },
  shots: [{ id: "paint", start: 0, end: N, draw: (ctx, f, env) => { const p = proc(); runProcess(p, ctx, Math.min(f, p.ops[p.ops.length - 1].t1), env); } }],
};
receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 322kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 322kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 322kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 322kUpdated Claude CodeCodexVerifiedInstall