@autoaiai/aicut 0.1.7 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MANUAL.md +94 -84
- package/package.json +1 -1
- package/product.json +2 -1
- package/skills/aicut/SKILL.md +4 -4
- package/skills/aicut/references/commands.md +15 -15
- package/skills/aicut/references/film-format.md +1 -1
- package/skills/aicut/references/recipes.md +4 -4
- package/skills/aicut/references/troubleshooting.md +2 -2
- package/skills/aicut-motion/SKILL.md +75 -9
- package/skills/aicut-motion/THIRD_PARTY_NOTICES.md +14 -0
- package/skills/aicut-motion/assets/atlas/lib/harness.js +116 -0
- package/skills/aicut-motion/assets/atlas/lib/sound.js +274 -0
- package/skills/aicut-motion/assets/atlas/styles/001-flat-vector-science/code.js +937 -0
- package/skills/aicut-motion/assets/atlas/styles/001-flat-vector-science/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/001-flat-vector-science/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/002-watercolor-wash/code.js +909 -0
- package/skills/aicut-motion/assets/atlas/styles/002-watercolor-wash/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/002-watercolor-wash/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/003-shadow-puppet-theatre/code.js +881 -0
- package/skills/aicut-motion/assets/atlas/styles/003-shadow-puppet-theatre/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/003-shadow-puppet-theatre/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/004-whiteboard-explainer/code.js +897 -0
- package/skills/aicut-motion/assets/atlas/styles/004-whiteboard-explainer/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/004-whiteboard-explainer/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/005-psychedelic-poster/code.js +814 -0
- package/skills/aicut-motion/assets/atlas/styles/005-psychedelic-poster/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/005-psychedelic-poster/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/006-tech-glow-explainer/code.js +990 -0
- package/skills/aicut-motion/assets/atlas/styles/006-tech-glow-explainer/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/006-tech-glow-explainer/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/007-papercraft-models/code.js +994 -0
- package/skills/aicut-motion/assets/atlas/styles/007-papercraft-models/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/007-papercraft-models/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/008-1940s-film-noir/code.js +792 -0
- package/skills/aicut-motion/assets/atlas/styles/008-1940s-film-noir/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/008-1940s-film-noir/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/009-manim-style-math/code.js +840 -0
- package/skills/aicut-motion/assets/atlas/styles/009-manim-style-math/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/009-manim-style-math/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/010-illuminated-manuscript/code.js +1126 -0
- package/skills/aicut-motion/assets/atlas/styles/010-illuminated-manuscript/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/010-illuminated-manuscript/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/011-editorial-essay-collage/code.js +854 -0
- package/skills/aicut-motion/assets/atlas/styles/011-editorial-essay-collage/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/011-editorial-essay-collage/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/012-bioluminescent-deep-sea/code.js +1124 -0
- package/skills/aicut-motion/assets/atlas/styles/012-bioluminescent-deep-sea/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/012-bioluminescent-deep-sea/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/013-product-launch-reveal/code.js +728 -0
- package/skills/aicut-motion/assets/atlas/styles/013-product-launch-reveal/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/013-product-launch-reveal/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/014-halftone-pop-panel/code.js +664 -0
- package/skills/aicut-motion/assets/atlas/styles/014-halftone-pop-panel/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/014-halftone-pop-panel/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/015-isometric-pastel/code.js +991 -0
- package/skills/aicut-motion/assets/atlas/styles/015-isometric-pastel/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/015-isometric-pastel/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/016-oscilloscope-vector-art/code.js +801 -0
- package/skills/aicut-motion/assets/atlas/styles/016-oscilloscope-vector-art/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/016-oscilloscope-vector-art/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/017-risograph-zine/code.js +692 -0
- package/skills/aicut-motion/assets/atlas/styles/017-risograph-zine/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/017-risograph-zine/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/018-claymation-set/code.js +756 -0
- package/skills/aicut-motion/assets/atlas/styles/018-claymation-set/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/018-claymation-set/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/019-neon-sign-at-night/code.js +922 -0
- package/skills/aicut-motion/assets/atlas/styles/019-neon-sign-at-night/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/019-neon-sign-at-night/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/020-kawaii-anime/code.js +852 -0
- package/skills/aicut-motion/assets/atlas/styles/020-kawaii-anime/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/020-kawaii-anime/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/021-ukiyo-e-woodblock/code.js +724 -0
- package/skills/aicut-motion/assets/atlas/styles/021-ukiyo-e-woodblock/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/021-ukiyo-e-woodblock/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/022-16-bit-pixel-odyssey/code.js +793 -0
- package/skills/aicut-motion/assets/atlas/styles/022-16-bit-pixel-odyssey/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/022-16-bit-pixel-odyssey/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/023-chalkboard-lesson/code.js +846 -0
- package/skills/aicut-motion/assets/atlas/styles/023-chalkboard-lesson/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/023-chalkboard-lesson/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/024-cut-paper-diorama/code.js +1008 -0
- package/skills/aicut-motion/assets/atlas/styles/024-cut-paper-diorama/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/024-cut-paper-diorama/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/025-cathedral-glass/code.js +680 -0
- package/skills/aicut-motion/assets/atlas/styles/025-cathedral-glass/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/025-cathedral-glass/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/026-editorial-chart/code.js +633 -0
- package/skills/aicut-motion/assets/atlas/styles/026-editorial-chart/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/026-editorial-chart/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/027-synthwave-outrun/code.js +757 -0
- package/skills/aicut-motion/assets/atlas/styles/027-synthwave-outrun/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/027-synthwave-outrun/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/028-origami-studio/code.js +828 -0
- package/skills/aicut-motion/assets/atlas/styles/028-origami-studio/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/028-origami-studio/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/029-linocut-relief-print/code.js +697 -0
- package/skills/aicut-motion/assets/atlas/styles/029-linocut-relief-print/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/029-linocut-relief-print/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/030-holographic-foil-card/code.js +687 -0
- package/skills/aicut-motion/assets/atlas/styles/030-holographic-foil-card/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/030-holographic-foil-card/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/031-voxel-diorama/code.js +727 -0
- package/skills/aicut-motion/assets/atlas/styles/031-voxel-diorama/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/031-voxel-diorama/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/032-sumi-e-ink-wash/code.js +903 -0
- package/skills/aicut-motion/assets/atlas/styles/032-sumi-e-ink-wash/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/032-sumi-e-ink-wash/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/033-etch-a-sketch-toy/code.js +662 -0
- package/skills/aicut-motion/assets/atlas/styles/033-etch-a-sketch-toy/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/033-etch-a-sketch-toy/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/034-cosmic-star-chart/code.js +951 -0
- package/skills/aicut-motion/assets/atlas/styles/034-cosmic-star-chart/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/034-cosmic-star-chart/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/035-punk-zine-collage/code.js +759 -0
- package/skills/aicut-motion/assets/atlas/styles/035-punk-zine-collage/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/035-punk-zine-collage/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/036-thermal-camera/code.js +738 -0
- package/skills/aicut-motion/assets/atlas/styles/036-thermal-camera/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/036-thermal-camera/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/037-engineering-blueprint/code.js +793 -0
- package/skills/aicut-motion/assets/atlas/styles/037-engineering-blueprint/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/037-engineering-blueprint/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/038-impasto-night/code.js +673 -0
- package/skills/aicut-motion/assets/atlas/styles/038-impasto-night/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/038-impasto-night/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/039-win95-desktop/code.js +907 -0
- package/skills/aicut-motion/assets/atlas/styles/039-win95-desktop/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/039-win95-desktop/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/040-low-poly-faceted/code.js +833 -0
- package/skills/aicut-motion/assets/atlas/styles/040-low-poly-faceted/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/040-low-poly-faceted/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/041-manga-page/code.js +845 -0
- package/skills/aicut-motion/assets/atlas/styles/041-manga-page/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/041-manga-page/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/042-wood-type-letterpress/code.js +496 -0
- package/skills/aicut-motion/assets/atlas/styles/042-wood-type-letterpress/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/042-wood-type-letterpress/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/043-light-painting/code.js +635 -0
- package/skills/aicut-motion/assets/atlas/styles/043-light-painting/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/043-light-painting/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/044-felt-patchwork/code.js +799 -0
- package/skills/aicut-motion/assets/atlas/styles/044-felt-patchwork/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/044-felt-patchwork/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/045-phosphor-terminal/code.js +547 -0
- package/skills/aicut-motion/assets/atlas/styles/045-phosphor-terminal/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/045-phosphor-terminal/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/046-glassmorphism-ui/code.js +592 -0
- package/skills/aicut-motion/assets/atlas/styles/046-glassmorphism-ui/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/046-glassmorphism-ui/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/047-tarot-card/code.js +768 -0
- package/skills/aicut-motion/assets/atlas/styles/047-tarot-card/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/047-tarot-card/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/048-transit-map/code.js +666 -0
- package/skills/aicut-motion/assets/atlas/styles/048-transit-map/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/048-transit-map/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/049-gouache-travel-poster/code.js +559 -0
- package/skills/aicut-motion/assets/atlas/styles/049-gouache-travel-poster/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/049-gouache-travel-poster/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/050-napkin-sketch/code.js +943 -0
- package/skills/aicut-motion/assets/atlas/styles/050-napkin-sketch/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/050-napkin-sketch/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/051-art-deco-foil/code.js +606 -0
- package/skills/aicut-motion/assets/atlas/styles/051-art-deco-foil/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/051-art-deco-foil/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/052-radiograph-on-lightbox/code.js +730 -0
- package/skills/aicut-motion/assets/atlas/styles/052-radiograph-on-lightbox/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/052-radiograph-on-lightbox/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/053-vaporwave/code.js +782 -0
- package/skills/aicut-motion/assets/atlas/styles/053-vaporwave/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/053-vaporwave/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/054-ebru-paper-marbling/code.js +504 -0
- package/skills/aicut-motion/assets/atlas/styles/054-ebru-paper-marbling/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/054-ebru-paper-marbling/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/055-isotype-pictograms/code.js +517 -0
- package/skills/aicut-motion/assets/atlas/styles/055-isotype-pictograms/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/055-isotype-pictograms/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/056-soft-3d-clay/code.js +713 -0
- package/skills/aicut-motion/assets/atlas/styles/056-soft-3d-clay/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/056-soft-3d-clay/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/057-cross-stitch-sampler/code.js +717 -0
- package/skills/aicut-motion/assets/atlas/styles/057-cross-stitch-sampler/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/057-cross-stitch-sampler/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/058-constructivist-propaganda/code.js +540 -0
- package/skills/aicut-motion/assets/atlas/styles/058-constructivist-propaganda/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/058-constructivist-propaganda/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/059-pocket-monochrome/code.js +524 -0
- package/skills/aicut-motion/assets/atlas/styles/059-pocket-monochrome/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/059-pocket-monochrome/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/060-botanical-plate/code.js +934 -0
- package/skills/aicut-motion/assets/atlas/styles/060-botanical-plate/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/060-botanical-plate/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/061-kinetic-type/code.js +690 -0
- package/skills/aicut-motion/assets/atlas/styles/061-kinetic-type/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/061-kinetic-type/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/062-byzantine-mosaic/code.js +612 -0
- package/skills/aicut-motion/assets/atlas/styles/062-byzantine-mosaic/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/062-byzantine-mosaic/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/063-y2k-liquid-chrome/code.js +666 -0
- package/skills/aicut-motion/assets/atlas/styles/063-y2k-liquid-chrome/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/063-y2k-liquid-chrome/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/064-sticky-note-wall/code.js +651 -0
- package/skills/aicut-motion/assets/atlas/styles/064-sticky-note-wall/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/064-sticky-note-wall/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/065-vintage-newsprint/code.js +656 -0
- package/skills/aicut-motion/assets/atlas/styles/065-vintage-newsprint/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/065-vintage-newsprint/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/066-hidden-line-wireframe/code.js +672 -0
- package/skills/aicut-motion/assets/atlas/styles/066-hidden-line-wireframe/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/066-hidden-line-wireframe/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/067-memphis-group/code.js +548 -0
- package/skills/aicut-motion/assets/atlas/styles/067-memphis-group/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/067-memphis-group/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/068-ballpoint-notebook/code.js +989 -0
- package/skills/aicut-motion/assets/atlas/styles/068-ballpoint-notebook/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/068-ballpoint-notebook/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/069-op-art-sphere/code.js +440 -0
- package/skills/aicut-motion/assets/atlas/styles/069-op-art-sphere/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/069-op-art-sphere/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/070-topographic-survey/code.js +895 -0
- package/skills/aicut-motion/assets/atlas/styles/070-topographic-survey/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/070-topographic-survey/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/071-pointillist-afternoon/code.js +563 -0
- package/skills/aicut-motion/assets/atlas/styles/071-pointillist-afternoon/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/071-pointillist-afternoon/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/072-vector-arcade-1980/code.js +627 -0
- package/skills/aicut-motion/assets/atlas/styles/072-vector-arcade-1980/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/072-vector-arcade-1980/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/073-patent-drawing/code.js +1096 -0
- package/skills/aicut-motion/assets/atlas/styles/073-patent-drawing/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/073-patent-drawing/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/074-bauhaus-poster/code.js +595 -0
- package/skills/aicut-motion/assets/atlas/styles/074-bauhaus-poster/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/074-bauhaus-poster/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/075-bitmap-paint-doodle/code.js +665 -0
- package/skills/aicut-motion/assets/atlas/styles/075-bitmap-paint-doodle/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/075-bitmap-paint-doodle/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/076-nail-thread-string-art/code.js +645 -0
- package/skills/aicut-motion/assets/atlas/styles/076-nail-thread-string-art/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/076-nail-thread-string-art/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/077-ridgeline/code.js +436 -0
- package/skills/aicut-motion/assets/atlas/styles/077-ridgeline/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/077-ridgeline/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/078-sketchbook-graphite/code.js +1237 -0
- package/skills/aicut-motion/assets/atlas/styles/078-sketchbook-graphite/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/078-sketchbook-graphite/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/079-teletext-page/code.js +622 -0
- package/skills/aicut-motion/assets/atlas/styles/079-teletext-page/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/079-teletext-page/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/080-silkscreen-grid/code.js +524 -0
- package/skills/aicut-motion/assets/atlas/styles/080-silkscreen-grid/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/080-silkscreen-grid/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/081-guilloch-security-print/code.js +689 -0
- package/skills/aicut-motion/assets/atlas/styles/081-guilloch-security-print/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/081-guilloch-security-print/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/082-ascii-demoscene/code.js +574 -0
- package/skills/aicut-motion/assets/atlas/styles/082-ascii-demoscene/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/082-ascii-demoscene/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/083-international-typographic-style/code.js +469 -0
- package/skills/aicut-motion/assets/atlas/styles/083-international-typographic-style/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/083-international-typographic-style/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/084-flow-field/code.js +531 -0
- package/skills/aicut-motion/assets/atlas/styles/084-flow-field/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/084-flow-field/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/085-macpaint-1984/code.js +675 -0
- package/skills/aicut-motion/assets/atlas/styles/085-macpaint-1984/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/085-macpaint-1984/style.json +13 -0
- package/skills/aicut-motion/assets/atlas/styles/086-multi-scale-truchet/code.js +609 -0
- package/skills/aicut-motion/assets/atlas/styles/086-multi-scale-truchet/poster.jpg +0 -0
- package/skills/aicut-motion/assets/atlas/styles/086-multi-scale-truchet/style.json +13 -0
- package/skills/aicut-motion/references/design-systems/README.md +1 -1
- package/skills/aicut-motion/references/motion-delivery.md +55 -0
- package/skills/aicut-motion/references/pages.md +1 -1
- package/skills/aicut-motion/references/style-index.json +690 -0
- package/skills/aicut-motion/references/style-research.md +73 -0
- package/skills/aicut-motion/references/style-selection.md +71 -0
- package/skills/aicut-motion/scripts/atlas-viewer.html +195 -0
- package/skills/aicut-motion/scripts/atlas.mjs +109 -0
- package/studio/client.mjs +3 -3
- package/studio/server/fetch-github.mjs +14 -3
- package/studio/server/server.mjs +71 -6
- package/studio/server/skill-summaries.mjs +60 -0
- package/studio/server/skills.mjs +121 -7
- package/studio/server/styles-store.mjs +235 -0
- package/studio/server/template-posters.mjs +2 -2
- package/studio/server/templates-page.mjs +93 -93
- package/studio/server/templates.mjs +32 -7
- package/studio/ui/dist/assets/ExportCenter-DasulhAv.js +1 -0
- package/studio/ui/dist/assets/SettingsModal-BZw0Hz2_.js +2 -0
- package/studio/ui/dist/assets/apple-touch-icon-ClxQ7j-O.png +0 -0
- package/studio/ui/dist/assets/es-C8XPZARI.js +1 -0
- package/studio/ui/dist/assets/favicon-Blwx8Trs.png +0 -0
- package/studio/ui/dist/assets/index-BjJVmBzB.js +1623 -0
- package/studio/ui/dist/assets/index-C3BfKZFO.css +1 -0
- package/studio/ui/dist/assets/ja-BeNkdaEj.js +1 -0
- package/studio/ui/dist/assets/ko-DcTVhdzK.js +1 -0
- package/studio/ui/dist/assets/zh-CN-Cg51ctbL.js +1 -0
- package/studio/ui/dist/index.html +4 -3
- package/studio/ui/dist/assets/ExportCenter-F-2vF-lQ.js +0 -1
- package/studio/ui/dist/assets/SettingsModal-BgVYguNu.js +0 -2
- package/studio/ui/dist/assets/es-BRUzvuoM.js +0 -1
- package/studio/ui/dist/assets/index-Bhg-9dA3.css +0 -1
- package/studio/ui/dist/assets/index-CWur1Iw9.js +0 -1625
- package/studio/ui/dist/assets/ja-Cth-uDcW.js +0 -1
- package/studio/ui/dist/assets/ko-upvw591D.js +0 -1
- package/studio/ui/dist/assets/zh-CN-BCfJFazB.js +0 -1
|
@@ -0,0 +1,943 @@
|
|
|
1
|
+
// Napkin Sketch — Sharpie startup idea on a crumpled cafe napkin.
|
|
2
|
+
{
|
|
3
|
+
const seg = (pts, step = 2.5) => {
|
|
4
|
+
const out = [];
|
|
5
|
+
for (let i = 0; i < pts.length - 1; i++) {
|
|
6
|
+
const [x0, y0] = pts[i], [x1, y1] = pts[i + 1];
|
|
7
|
+
const n = Math.max(1, Math.ceil(Math.hypot(x1 - x0, y1 - y0) / step));
|
|
8
|
+
for (let j = 0; j < n; j++) out.push([x0 + (x1 - x0) * j / n, y0 + (y1 - y0) * j / n]);
|
|
9
|
+
}
|
|
10
|
+
out.push(pts[pts.length - 1]);
|
|
11
|
+
return out;
|
|
12
|
+
};
|
|
13
|
+
const normals = (P) => P.map((p, i) => {
|
|
14
|
+
const a = P[Math.max(0, i - 1)], b = P[Math.min(P.length - 1, i + 1)];
|
|
15
|
+
const dx = b[0] - a[0], dy = b[1] - a[1], d = Math.hypot(dx, dy) || 1;
|
|
16
|
+
return [-dy / d, dx / d];
|
|
17
|
+
});
|
|
18
|
+
const wob = (pts, nz, seed, amp = 1.6, freq = 0.012) => {
|
|
19
|
+
const N = normals(pts); let L = 0;
|
|
20
|
+
return pts.map((p, i) => {
|
|
21
|
+
if (i) L += Math.hypot(p[0] - pts[i - 1][0], p[1] - pts[i - 1][1]);
|
|
22
|
+
const o = nz.n2(L * freq + seed * 1.37, seed * 0.71) * amp + nz.n2(L * freq * 6 + seed, seed + 3.3) * amp * 0.3;
|
|
23
|
+
return [p[0] + N[i][0] * o, p[1] + N[i][1] * o];
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
const ell = (cx, cy, rx, ry, a0 = 0, a1 = Math.PI * 2) => {
|
|
27
|
+
const n = Math.max(10, Math.ceil(Math.abs(a1 - a0) * Math.max(rx, ry) / 2.5)), out = [];
|
|
28
|
+
for (let i = 0; i <= n; i++) { const a = a0 + (a1 - a0) * i / n; out.push([cx + Math.cos(a) * rx, cy + Math.sin(a) * ry]); }
|
|
29
|
+
return out;
|
|
30
|
+
};
|
|
31
|
+
const quad = (p0, p1, p2, n = 40) => {
|
|
32
|
+
const out = [];
|
|
33
|
+
for (let i = 0; i <= n; i++) { const t = i / n, m = 1 - t; out.push([m * m * p0[0] + 2 * m * t * p1[0] + t * t * p2[0], m * m * p0[1] + 2 * m * t * p1[1] + t * t * p2[1]]); }
|
|
34
|
+
return out;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// >>>XE-ENGINE
|
|
38
|
+
// ===================== explainer story engine (shared script: "How does AI learn?") =====================
|
|
39
|
+
// Builds the diagram as timed world-space strokes/texts; each style renders them with its own medium.
|
|
40
|
+
const XC = {}; // cache for static textures (output still depends only on t)
|
|
41
|
+
const XE = (() => {
|
|
42
|
+
const clamp = (v, a = 0, b = 1) => Math.max(a, Math.min(b, v));
|
|
43
|
+
const win = (t, a, b) => clamp((t - a) / (b - a));
|
|
44
|
+
const eio = (x) => (x < 0.5 ? 4 * x * x * x : 1 - Math.pow(-2 * x + 2, 3) / 2);
|
|
45
|
+
const camAt = (keys, t) => {
|
|
46
|
+
if (t <= keys[0][0]) return keys[0].slice(1);
|
|
47
|
+
for (let i = 0; i < keys.length - 1; i++) {
|
|
48
|
+
const a = keys[i], b = keys[i + 1];
|
|
49
|
+
if (t <= b[0]) {
|
|
50
|
+
const u = eio((t - a[0]) / Math.max(1e-6, b[0] - a[0]));
|
|
51
|
+
return [a[1] + (b[1] - a[1]) * u, a[2] + (b[2] - a[2]) * u, Math.exp(Math.log(a[3]) + (Math.log(b[3]) - Math.log(a[3])) * u)];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return keys[keys.length - 1].slice(1);
|
|
55
|
+
};
|
|
56
|
+
const circ = (x, y, rx, ry, a0 = 0, a1 = Math.PI * 2, n = 0) => {
|
|
57
|
+
n = n || Math.max(12, Math.ceil(Math.abs(a1 - a0) * Math.max(rx, ry) / 6)); const o = [];
|
|
58
|
+
for (let i = 0; i <= n; i++) { const a = a0 + (a1 - a0) * i / n; o.push([x + Math.cos(a) * rx, y + Math.sin(a) * ry]); }
|
|
59
|
+
return o;
|
|
60
|
+
};
|
|
61
|
+
const quad = (p0, p1, p2, n = 30) => { const o = []; for (let i = 0; i <= n; i++) { const t = i / n, m = 1 - t; o.push([m * m * p0[0] + 2 * m * t * p1[0] + t * t * p2[0], m * m * p0[1] + 2 * m * t * p1[1] + t * t * p2[1]]); } return o; };
|
|
62
|
+
const cubic = (p0, p1, p2, p3, n = 40) => { const o = []; for (let i = 0; i <= n; i++) { const t = i / n, m = 1 - t; o.push([m * m * m * p0[0] + 3 * m * m * t * p1[0] + 3 * m * t * t * p2[0] + t * t * t * p3[0], m * m * m * p0[1] + 3 * m * m * t * p1[1] + 3 * m * t * t * p2[1] + t * t * t * p3[1]]); } return o; };
|
|
63
|
+
const rrect = (x, y, w, h, r) => {
|
|
64
|
+
const o = [[x + r, y], [x + w - r, y]]; o.push(...circ(x + w - r, y + r, r, r, -Math.PI / 2, 0, 5).slice(1));
|
|
65
|
+
o.push([x + w, y + h - r]); o.push(...circ(x + w - r, y + h - r, r, r, 0, Math.PI / 2, 5).slice(1));
|
|
66
|
+
o.push([x + r, y + h]); o.push(...circ(x + r, y + h - r, r, r, Math.PI / 2, Math.PI, 5).slice(1));
|
|
67
|
+
o.push([x, y + r]); o.push(...circ(x + r, y + r, r, r, Math.PI, Math.PI * 1.5, 5).slice(1));
|
|
68
|
+
o.push([x + r + 6, y - 1]); return o;
|
|
69
|
+
};
|
|
70
|
+
const head = (P, len = 20, spread = 0.5) => {
|
|
71
|
+
const a = P[P.length - 1], b = P[Math.max(0, P.length - 4)], an = Math.atan2(a[1] - b[1], a[0] - b[0]);
|
|
72
|
+
return [[a[0] - Math.cos(an - spread) * len, a[1] - Math.sin(an - spread) * len], a, [a[0] - Math.cos(an + spread) * len, a[1] - Math.sin(an + spread) * len]];
|
|
73
|
+
};
|
|
74
|
+
const cat = (x, y, s) => [
|
|
75
|
+
circ(x, y + 0.06 * s, 0.3 * s, 0.27 * s, -1.2, 5.1),
|
|
76
|
+
[[x - 0.27 * s, y - 0.02 * s], [x - 0.24 * s, y - 0.34 * s], [x - 0.07 * s, y - 0.2 * s]],
|
|
77
|
+
[[x + 0.07 * s, y - 0.2 * s], [x + 0.24 * s, y - 0.34 * s], [x + 0.27 * s, y - 0.02 * s]],
|
|
78
|
+
[[x - 0.03 * s, y + 0.1 * s], [x, y + 0.13 * s], [x + 0.03 * s, y + 0.1 * s]],
|
|
79
|
+
[[x - 0.12 * s, y + 0.12 * s], [x - 0.36 * s, y + 0.08 * s]], [[x - 0.12 * s, y + 0.16 * s], [x - 0.35 * s, y + 0.2 * s]],
|
|
80
|
+
[[x + 0.12 * s, y + 0.12 * s], [x + 0.36 * s, y + 0.08 * s]], [[x + 0.12 * s, y + 0.16 * s], [x + 0.35 * s, y + 0.2 * s]],
|
|
81
|
+
];
|
|
82
|
+
const dog = (x, y, s) => [
|
|
83
|
+
circ(x, y + 0.04 * s, 0.26 * s, 0.28 * s, -1.4, 4.9),
|
|
84
|
+
circ(x - 0.29 * s, y + 0.04 * s, 0.09 * s, 0.2 * s, 0, 6.4),
|
|
85
|
+
circ(x + 0.29 * s, y + 0.04 * s, 0.09 * s, 0.2 * s, 0, 6.4),
|
|
86
|
+
circ(x, y + 0.15 * s, 0.07 * s, 0.045 * s, 0, 6.4),
|
|
87
|
+
[[x - 0.08 * s, y + 0.23 * s], [x, y + 0.26 * s], [x + 0.08 * s, y + 0.23 * s]],
|
|
88
|
+
];
|
|
89
|
+
const eyes = (x, y, s, dy = 0.02) => [[x - 0.1 * s, y + dy * s], [x + 0.1 * s, y + dy * s]];
|
|
90
|
+
const fmt = (n) => Math.round(n).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
91
|
+
|
|
92
|
+
// L: layout options. mode: 'same' (progress drawn where the loop was) | 'below' | 'right'
|
|
93
|
+
// model(cx, cy, adj, add): style supplies its model drawing; adj 0..1 = how far the knobs have been adjusted.
|
|
94
|
+
const story = (t, L) => {
|
|
95
|
+
const items = [];
|
|
96
|
+
const line = (pts, role, w, a, b, g) => items.push({ k: 'line', pts, role, w, a, b, g });
|
|
97
|
+
const text = (s, x, y, size, font, role, a, b, opt = {}) => items.push({ k: 'text', s, x, y, size, font, role, a, b, rot: opt.rot || 0, align: opt.align || 'left', g: opt.g });
|
|
98
|
+
const dot = (x, y, r, role, a, g) => items.push({ k: 'dot', x, y, r, role, a, b: a + 0.05, g });
|
|
99
|
+
const S = L.s || 1;
|
|
100
|
+
// ---- 1 HOOK ----
|
|
101
|
+
const TX = L.titleX ?? 640, TY = L.titleY ?? 350;
|
|
102
|
+
text('How does AI learn?', TX, TY, 84 * S, 'title', 'ink', 0.15, 1.3, { align: 'center', rot: -0.015, g: 'A' });
|
|
103
|
+
line([[TX - 330 * S, TY + 32 * S], [TX + 330 * S, TY + 24 * S]], 'acc1', 7, 1.3, 1.55, 'A');
|
|
104
|
+
// ---- 2 DATA ----
|
|
105
|
+
const MX = L.modelX ?? 2250, MY = L.modelY ?? 640;
|
|
106
|
+
const mAdj = eio(win(t, 8.95, 9.5));
|
|
107
|
+
L.model(MX, MY, mAdj, (it) => { it.g = it.g || 'M'; items.push(it); }, { line, text, dot }, t);
|
|
108
|
+
text(L.modelName || 'model', MX, MY + 228, 38, 'label', 'ink', 3.15, 3.4, { align: 'center', g: 'M' });
|
|
109
|
+
const CS = 118, cx0 = MX - 870, cy0 = MY - 175;
|
|
110
|
+
for (let i = 0; i < 6; i++) {
|
|
111
|
+
const col = i % 3, row = (i / 3) | 0, x = cx0 + col * 150 + (row ? 40 : 0), y = cy0 + row * 170, isCat = [1, 0, 1, 1, 0, 0][i];
|
|
112
|
+
const a = 3.0 + i * 0.17;
|
|
113
|
+
line(rrect(x - CS / 2, y - CS / 2, CS, CS, 12), 'ink', 4, a, a + 0.12, 'B');
|
|
114
|
+
(isCat ? cat : dog)(x, y - 6, CS * 0.82).forEach((p) => line(p, 'ink', 3.2, a + 0.1, a + 0.22, 'B'));
|
|
115
|
+
eyes(x, y - 6, CS * 0.82).forEach(([ex, ey]) => dot(ex, ey, 3.2, 'ink', a + 0.22, 'B'));
|
|
116
|
+
// label tag hanging off the card
|
|
117
|
+
const tx = x + 18, ty = y + CS / 2 - 4;
|
|
118
|
+
line([[tx, ty], [tx + 70, ty], [tx + 84, ty + 19], [tx + 70, ty + 38], [tx, ty + 38], [tx, ty]], isCat ? 'acc1' : 'acc3', 3, a + 0.2, a + 0.3, 'B');
|
|
119
|
+
text(isCat ? 'cat' : 'dog', tx + 8, ty + 30, 31, 'label', isCat ? 'acc1' : 'acc3', a + 0.28, a + 0.36, { g: 'B' });
|
|
120
|
+
}
|
|
121
|
+
// flow arrow into the model
|
|
122
|
+
const fa = cubic([cx0 + 370, MY - 10], [cx0 + 470, MY - 60], [MX - 260, MY - 40], [MX - 165, MY - 10]);
|
|
123
|
+
line(fa, 'ink', 5, 4.15, 4.45, 'B'); line(head(fa, 24), 'ink', 5, 4.45, 4.55, 'B');
|
|
124
|
+
// little example cards streaming along the arrow
|
|
125
|
+
if (t > 4.5 && t < 6.2) {
|
|
126
|
+
for (let k = 0; k < 9; k++) {
|
|
127
|
+
const u = ((t - 4.5) * 0.9 + k / 9) % 1, ix = Math.min(fa.length - 1, Math.floor(u * fa.length));
|
|
128
|
+
const [px, py] = fa[ix], sz = 26 * (1 - 0.5 * u);
|
|
129
|
+
if (t - 4.5 < k / 9 / 0.9) continue;
|
|
130
|
+
items.push({ k: 'line', pts: rrect(px - sz / 2, py - sz / 2 - 18, sz, sz, 4), role: k % 2 ? 'acc1' : 'acc3', w: 2.5, a: -1, b: 0, g: 'F', inst: true });
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
// counter (numerals redrawn on twos)
|
|
134
|
+
if (t > 4.5) {
|
|
135
|
+
const u = win(Math.floor(t * 12) / 12, 4.55, 5.25), n = u >= 1 ? 1e6 : (Math.pow(10, u * 6) - 1) / (1e6 - 1) * 1e6;
|
|
136
|
+
items.push({ k: 'text', s: fmt(n), x: cx0 + 150, y: cy0 + 425, size: 76, font: 'num', role: 'ink', a: -1, b: 0, align: 'center', g: 'B', inst: true, live: true });
|
|
137
|
+
text('examples', cx0 + 150, cy0 + 472, 36, 'label', 'ink', 4.55, 4.8, { align: 'center', g: 'B' });
|
|
138
|
+
}
|
|
139
|
+
if (L.model2At) L.model(MX, MY, mAdj, (it) => { it.g = 'M2'; if (!it.inst) { it.a += L.model2At - 2.5; it.b += L.model2At - 2.5; } items.push(it); }, { line: (p, r, w, a, b) => line(p, r, w, a + L.model2At - 2.5, b + L.model2At - 2.5, 'M2'), text: (s2, x, y, sz, f, r, a, b, o = {}) => text(s2, x, y, sz, f, r, a + L.model2At - 2.5, b + L.model2At - 2.5, { ...o, g: 'M2' }), dot }, t - (L.model2At - 2.5));
|
|
140
|
+
// ---- 3 GUESS -> CHECK -> ADJUST ----
|
|
141
|
+
const qx = MX, qy = MY - 300;
|
|
142
|
+
line(rrect(qx - 62, qy - 62, 124, 124, 12), 'acc2', 4, 6.4, 6.55, 'C');
|
|
143
|
+
cat(qx, qy - 4, 100).forEach((p) => line(p, 'ink', 3.2, 6.5, 6.7, 'C'));
|
|
144
|
+
eyes(qx, qy - 4, 100).forEach(([ex, ey]) => dot(ex, ey, 3, 'ink', 6.7, 'C'));
|
|
145
|
+
text('new!', qx + 72, qy - 30, 30, 'label', 'acc2', 6.65, 6.8, { g: 'C' });
|
|
146
|
+
const dn = [[qx, qy + 70], [qx + 2, MY - 170]];
|
|
147
|
+
line(dn, 'ink', 5, 6.8, 6.95, 'C'); line(head(dn, 18), 'ink', 5, 6.95, 7.02, 'C');
|
|
148
|
+
const gA = [[MX + 175, MY - 10], [MX + 300, MY - 14], [MX + 400, MY - 8]];
|
|
149
|
+
line(gA, 'ink', 5, 7.02, 7.2, 'C'); line(head(gA, 20), 'ink', 5, 7.2, 7.26, 'C');
|
|
150
|
+
text('Guess', MX + 290, MY - 40, 38, 'label', 'ink', 7.15, 7.4, { align: 'center', g: 'C' });
|
|
151
|
+
const BX = MX + 540, BY = MY - 10;
|
|
152
|
+
line(rrect(BX - 120, BY - 55, 240, 110, 40), 'ink', 5, 7.3, 7.5, 'C');
|
|
153
|
+
line([[BX - 70, BY + 52], [BX - 96, BY + 92], [BX - 40, BY + 54]], 'ink', 5, 7.48, 7.55, 'C');
|
|
154
|
+
text('dog?', BX, BY + 18, 52, 'title', 'ink', 7.52, 7.75, { align: 'center', g: 'C' });
|
|
155
|
+
text('Check', BX, BY - 82, 38, 'label', 'acc2', 7.85, 8.05, { align: 'center', g: 'C' });
|
|
156
|
+
line([[BX + 140, BY - 40], [BX + 200, BY + 30]], 'acc2', 8, 8.0, 8.08, 'C');
|
|
157
|
+
line([[BX + 200, BY - 40], [BX + 140, BY + 30]], 'acc2', 8, 8.08, 8.16, 'C');
|
|
158
|
+
line(circ(BX + 4, BY + 2, 150, 82, -2.2, 4.4), 'acc2', 5, 8.15, 8.45, 'C'); // emphasis ring
|
|
159
|
+
const back = cubic([BX - 60, BY + 70], [BX - 80, BY + 290], [MX + 290, MY + 300], [MX + 155, MY + 190]);
|
|
160
|
+
line(back, 'acc2', 6, 8.45, 8.95, 'C'); line(head(back, 22), 'acc2', 6, 8.95, 9.02, 'C');
|
|
161
|
+
text('Adjust', (BX + MX) / 2 - 10, MY + 315, 40, 'label', 'acc2', 8.8, 9.05, { align: 'center', g: 'C' });
|
|
162
|
+
if (t > 8.95 && t < 9.4) { // error signal travelling back
|
|
163
|
+
const u = win(t, 8.95, 9.35), p = back[Math.min(back.length - 1, Math.floor((1 - u) * (back.length - 1)))];
|
|
164
|
+
items.push({ k: 'dot', x: p[0], y: p[1], r: 13, role: 'acc2', a: -1, b: 0, g: 'C', inst: true });
|
|
165
|
+
}
|
|
166
|
+
line([[BX - 66, BY + 4], [BX - 20, BY - 6], [BX + 24, BY + 6], [BX + 66, BY - 4]], 'ink', 5, 9.5, 9.62, 'C'); // strike
|
|
167
|
+
text('cat', BX + 30, BY + 118, 52, 'title', 'acc3', 9.62, 9.85, { align: 'center', g: 'C' });
|
|
168
|
+
line([[BX + 92, BY + 96], [BX + 112, BY + 122], [BX + 156, BY + 66]], 'acc3', 8, 9.85, 10.05, 'C');
|
|
169
|
+
if (L.bridge) { // a connector the hand draws while the camera travels to the next part
|
|
170
|
+
const B = L.bridge;
|
|
171
|
+
line(B.pts, 'acc1', 5, B.a, B.b, 'D'); line(head(B.pts, 22), 'acc1', 5, B.b, B.b + 0.06, 'D');
|
|
172
|
+
text(B.label, B.lx, B.ly, 40, 'label', 'acc1', B.b + 0.06, B.b + 0.3, { align: 'center', rot: B.rot || 0, g: 'D' });
|
|
173
|
+
}
|
|
174
|
+
// ---- 4 PROGRESS ----
|
|
175
|
+
const D = L.D;
|
|
176
|
+
const ox = D[0] - 380, oy = D[1] + 150, cw = 560, ch = 330;
|
|
177
|
+
line([[ox, oy - ch], [ox, oy], [ox + cw, oy]], 'ink', 5, L.pT, L.pT + 0.35, 'D');
|
|
178
|
+
line(head([[ox, oy], [ox, oy - ch]], 16), 'ink', 5, L.pT + 0.35, L.pT + 0.4, 'D');
|
|
179
|
+
line(head([[ox, oy], [ox + cw, oy]], 16), 'ink', 5, L.pT + 0.4, L.pT + 0.45, 'D');
|
|
180
|
+
text('training rounds', ox + cw / 2, oy + 48, 34, 'label', 'ink', L.pT + 0.3, L.pT + 0.55, { align: 'center', g: 'D' });
|
|
181
|
+
const cpts = [];
|
|
182
|
+
for (let i = 0; i <= 40; i++) {
|
|
183
|
+
const u = i / 40, acc = 61 + 36 * (1 - Math.pow(1 - u, 2.2)) + (i % 3 === 1 ? -2.5 : i % 3 === 2 ? 1.5 : 0) * (1 - u);
|
|
184
|
+
cpts.push([ox + 20 + u * (cw - 50), oy - (acc - 50) / 50 * ch]);
|
|
185
|
+
}
|
|
186
|
+
line(cpts, 'acc1', 6, L.pT + 0.5, L.pT + 1.7, 'D');
|
|
187
|
+
text('accuracy', D[0] + 330, D[1] - 120, 40, 'label', 'ink', L.pT + 0.45, L.pT + 0.7, { align: 'center', g: 'D' });
|
|
188
|
+
if (t > L.pT + 0.55) {
|
|
189
|
+
const u = win(Math.floor(t * 12) / 12, L.pT + 0.6, L.pT + 1.7), v = 61 + 36 * (1 - Math.pow(1 - u, 2.2));
|
|
190
|
+
items.push({ k: 'text', s: Math.round(v) + '%', x: D[0] + 330, y: D[1] + 10, size: 110, font: 'num', role: u >= 1 ? 'acc3' : 'ink', a: -1, b: 0, align: 'center', g: 'D', inst: true, live: true });
|
|
191
|
+
}
|
|
192
|
+
line(circ(D[0] + 335, D[1] - 25, 140, 90, -2.4, 4.2), 'acc2', 6, L.pT + 1.75, L.pT + 2.05, 'D');
|
|
193
|
+
// ---- 5 TAKEAWAY ----
|
|
194
|
+
text('More examples → better guesses', D[0], D[1] + 290, 62, 'title', 'ink', L.kT, L.kT + 0.75, { align: 'center', rot: -0.01, g: 'E' });
|
|
195
|
+
line([[D[0] - 450, D[1] + 316], [D[0] + 455, D[1] + 308]], 'acc1', 6, L.kT + 0.75, L.kT + 0.95, 'E');
|
|
196
|
+
return items;
|
|
197
|
+
};
|
|
198
|
+
// the 'tip' of whatever is currently being drawn (for the hand/tool)
|
|
199
|
+
const tipOf = (items, t, measure) => {
|
|
200
|
+
let tip = null;
|
|
201
|
+
for (const it of items) {
|
|
202
|
+
if (it.inst || it.k === 'dot') continue;
|
|
203
|
+
const p = win(t, it.a, it.b);
|
|
204
|
+
if (p > 0 && p < 1) {
|
|
205
|
+
if (it.k === 'line') { const P = it.pts; tip = P[Math.min(P.length - 1, Math.floor(p * (P.length - 1)))]; }
|
|
206
|
+
else tip = measure ? measure(it, p) : [it.x, it.y];
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return tip;
|
|
210
|
+
};
|
|
211
|
+
return { clamp, win, eio, camAt, circ, quad, cubic, rrect, head, cat, dog, story, tipOf, fmt };
|
|
212
|
+
})();
|
|
213
|
+
// <<<XE-ENGINE
|
|
214
|
+
registerStyle({
|
|
215
|
+
id: 'napkin-sketch',
|
|
216
|
+
name: 'Napkin Sketch',
|
|
217
|
+
category: 'Hand-Drawn',
|
|
218
|
+
description: 'A back-of-the-napkin startup pitch in black Sharpie: ink feathering into soft tissue fibers, an embossed napkin border, quarter-fold creases and crumples, a coffee ring, all lying on a warm wooden cafe table.',
|
|
219
|
+
motion: 'The marker scrawls each box and arrow in quick confident strokes while ink slowly feathers outward; the napkin breathes slightly as if just set down.',
|
|
220
|
+
fonts: ['400 54px "Permanent Marker"', '400 30px "Permanent Marker"', '400 26px "Permanent Marker"'],
|
|
221
|
+
frameT: 5.9,
|
|
222
|
+
duration: 6,
|
|
223
|
+
readsPixels: true,
|
|
224
|
+
draw(ctx, W, H_, t) {
|
|
225
|
+
const nz = H.makeNoise(64);
|
|
226
|
+
|
|
227
|
+
// ---------- wooden table (half-res, per pixel) ----------
|
|
228
|
+
{
|
|
229
|
+
const w2 = W / 2, h2 = H_ / 2, wl = H.layer(w2, h2), wc = wl.getContext('2d');
|
|
230
|
+
const id = wc.createImageData(w2, h2), d = id.data, rr = H.rng(3);
|
|
231
|
+
const PL = 92; // plank height (half-res)
|
|
232
|
+
const tints = [0, 1, 2, 3, 4, 5].map(() => [rr.range(-12, 12), rr.range(-0.4, 0.4)]);
|
|
233
|
+
for (let y = 0; y < h2; y++) for (let x = 0; x < w2; x++) {
|
|
234
|
+
const pi = Math.floor((y + 20) / PL), py = (y + 20) % PL;
|
|
235
|
+
const [tint, ph] = tints[pi % tints.length];
|
|
236
|
+
const warp = nz.fbm2(x * 0.0025 + pi * 7, py * 0.012 + pi, 3) * 5.5;
|
|
237
|
+
const ring = Math.sin((py * 0.07 + warp + ph * 3) * Math.PI * 2);
|
|
238
|
+
const fine = nz.n2(x * 0.012 + pi * 5, y * 0.55) * 0.6 + nz.n2(x * 0.05, y * 1.3) * 0.25;
|
|
239
|
+
let v = 0.5 + 0.16 * Math.sign(ring) * Math.pow(Math.abs(ring), 0.4) + 0.14 * fine + nz.n2(x * 0.004, y * 0.02 + pi) * 0.12;
|
|
240
|
+
const r0 = 118 + tint, g0 = 74 + tint * 0.6, b0 = 42 + tint * 0.3;
|
|
241
|
+
let r = r0 * (0.75 + 0.5 * v), g = g0 * (0.75 + 0.5 * v), b = b0 * (0.78 + 0.45 * v);
|
|
242
|
+
if (py < 2 || py > PL - 2) { r *= 0.35; g *= 0.3; b *= 0.3; }
|
|
243
|
+
const i = (y * w2 + x) * 4; d[i] = r; d[i + 1] = g; d[i + 2] = b; d[i + 3] = 255;
|
|
244
|
+
}
|
|
245
|
+
wc.putImageData(id, 0, 0);
|
|
246
|
+
ctx.imageSmoothingEnabled = true; ctx.drawImage(wl, 0, 0, W, H_);
|
|
247
|
+
// varnish sheen from a window
|
|
248
|
+
const sh = ctx.createLinearGradient(0, 0, W, H_);
|
|
249
|
+
sh.addColorStop(0, 'rgba(255,230,190,0.16)'); sh.addColorStop(0.4, 'rgba(255,230,190,0.02)'); sh.addColorStop(1, 'rgba(20,8,0,0.25)');
|
|
250
|
+
ctx.fillStyle = sh; ctx.fillRect(0, 0, W, H_);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// ---------- napkin geometry ----------
|
|
254
|
+
const NW = 600, NH = 576, NCX = 548, NCY = 368, NR = -0.06;
|
|
255
|
+
const toCanvas = (u, v) => {
|
|
256
|
+
const x = u - NW / 2, y = v - NH / 2, c = Math.cos(NR), s = Math.sin(NR);
|
|
257
|
+
return [NCX + x * c - y * s, NCY + x * s + y * c];
|
|
258
|
+
};
|
|
259
|
+
const toLocal = (X, Y) => {
|
|
260
|
+
const x = X - NCX, y = Y - NCY, c = Math.cos(-NR), s = Math.sin(-NR);
|
|
261
|
+
return [x * c - y * s + NW / 2, x * s + y * c + NH / 2];
|
|
262
|
+
};
|
|
263
|
+
const setLocal = (c) => { c.translate(NCX, NCY); c.rotate(NR); c.translate(-NW / 2, -NH / 2); };
|
|
264
|
+
// deckled outline
|
|
265
|
+
const outline = [];
|
|
266
|
+
{
|
|
267
|
+
const edge = (x0, y0, x1, y1, s) => {
|
|
268
|
+
const n = 60;
|
|
269
|
+
for (let i = 0; i < n; i++) {
|
|
270
|
+
const u = i / n, x = x0 + (x1 - x0) * u, y = y0 + (y1 - y0) * u;
|
|
271
|
+
const o = nz.n2(u * 9 + s, s) * 2.2 + nz.n2(u * 60, s + 1) * 0.8;
|
|
272
|
+
const nx = -(y1 - y0), ny = x1 - x0, l = Math.hypot(nx, ny);
|
|
273
|
+
outline.push([x + nx / l * o, y + ny / l * o]);
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
edge(4, 0, NW - 2, 6, 1); edge(NW, 4, NW - 6, NH - 2, 2); edge(NW - 4, NH, 2, NH - 4, 3); edge(0, NH - 2, 6, 6, 4);
|
|
277
|
+
}
|
|
278
|
+
const napPath = (c) => { c.beginPath(); outline.forEach(([x, y], i) => (i ? c.lineTo(x, y) : c.moveTo(x, y))); c.closePath(); };
|
|
279
|
+
|
|
280
|
+
// shadow on the table
|
|
281
|
+
ctx.save(); ctx.filter = 'blur(10px)'; ctx.translate(7, 10); setLocal(ctx); napPath(ctx);
|
|
282
|
+
ctx.fillStyle = 'rgba(25,10,0,0.55)'; ctx.fill(); ctx.restore();
|
|
283
|
+
|
|
284
|
+
// napkin body layer
|
|
285
|
+
const NL = H.layer(W, H_), nc = NL.getContext('2d');
|
|
286
|
+
nc.save(); setLocal(nc); napPath(nc); nc.fillStyle = '#f6f5f0'; nc.fill(); nc.restore();
|
|
287
|
+
// tissue fiber texture
|
|
288
|
+
{
|
|
289
|
+
const rr = H.rng(21);
|
|
290
|
+
nc.save(); setLocal(nc); napPath(nc); nc.clip();
|
|
291
|
+
for (let i = 0; i < 2600; i++) {
|
|
292
|
+
const x = rr.range(0, NW), y = rr.range(0, NH), a = rr.range(0, 6.28), l = rr.range(3, 10);
|
|
293
|
+
nc.strokeStyle = rr.chance(0.5) ? 'rgba(180,175,165,0.08)' : 'rgba(255,255,255,0.35)';
|
|
294
|
+
nc.lineWidth = 0.7; nc.beginPath(); nc.moveTo(x, y); nc.lineTo(x + Math.cos(a) * l, y + Math.sin(a) * l); nc.stroke();
|
|
295
|
+
}
|
|
296
|
+
nc.restore();
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// ---------- emboss pattern ----------
|
|
300
|
+
{
|
|
301
|
+
const EM = H.layer(W, H_), ec = EM.getContext('2d');
|
|
302
|
+
ec.save(); setLocal(ec); ec.strokeStyle = '#000'; ec.fillStyle = '#000'; ec.lineWidth = 2;
|
|
303
|
+
const inset = (k) => { ec.beginPath(); ec.roundRect(k, k, NW - 2 * k, NH - 2 * k, 6); ec.stroke(); };
|
|
304
|
+
inset(16); inset(52); ec.lineWidth = 1.2; inset(20);
|
|
305
|
+
const ring = (x, y) => {
|
|
306
|
+
ec.lineWidth = 1.6;
|
|
307
|
+
for (let k = 0; k < 4; k++) { const a = k * Math.PI / 2; ec.beginPath(); ec.ellipse(x + Math.cos(a) * 5, y + Math.sin(a) * 5, 5, 3, a, 0, 7); ec.stroke(); }
|
|
308
|
+
ec.beginPath(); ec.arc(x, y, 1.6, 0, 7); ec.fill();
|
|
309
|
+
};
|
|
310
|
+
const step = 34;
|
|
311
|
+
for (let x = 34 + step; x < NW - 34 - 10; x += step) { ring(x, 34); ring(x, NH - 34); }
|
|
312
|
+
for (let y = 34 + step; y < NH - 34 - 10; y += step) { ring(34, y); ring(NW - 34, y); }
|
|
313
|
+
[[34, 34], [NW - 34, 34], [34, NH - 34], [NW - 34, NH - 34]].forEach(([x, y]) => { ec.lineWidth = 1.6; ec.beginPath(); ec.arc(x, y, 9, 0, 7); ec.stroke(); ring(x, y); });
|
|
314
|
+
// fine quilted dot grid in the field
|
|
315
|
+
for (let y = 70; y < NH - 60; y += 16) for (let x = 70 + ((y / 16) % 2) * 8; x < NW - 60; x += 16) { ec.beginPath(); ec.arc(x, y, 0.9, 0, 7); ec.fill(); }
|
|
316
|
+
ec.restore();
|
|
317
|
+
const tint = (col, dx, dy, a) => {
|
|
318
|
+
const tl = H.layer(W, H_), tc = tl.getContext('2d');
|
|
319
|
+
tc.drawImage(EM, dx, dy); tc.globalCompositeOperation = 'source-in'; tc.fillStyle = col; tc.fillRect(0, 0, W, H_);
|
|
320
|
+
nc.save(); nc.globalAlpha = a; nc.drawImage(tl, 0, 0); nc.restore();
|
|
321
|
+
};
|
|
322
|
+
tint('#8f8a80', 1.1, 1.3, 0.35);
|
|
323
|
+
tint('#ffffff', -1, -1.1, 0.9);
|
|
324
|
+
nc.save(); nc.globalCompositeOperation = 'source-atop'; nc.globalAlpha = 0.05; nc.drawImage(EM, 0, 0); nc.restore();
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// ---------- coffee ring stain ----------
|
|
328
|
+
{
|
|
329
|
+
const RL = H.layer(W, H_), rc = RL.getContext('2d');
|
|
330
|
+
rc.save(); setLocal(rc);
|
|
331
|
+
const ring = (cx, cy, R, a) => {
|
|
332
|
+
for (let k = 0; k < 3; k++) {
|
|
333
|
+
const r = R + k * 1.4;
|
|
334
|
+
const g = rc.createRadialGradient(cx, cy, r - 16, cx, cy, r + 2);
|
|
335
|
+
g.addColorStop(0, 'rgba(150,95,45,0)'); g.addColorStop(0.7, `rgba(150,95,45,${a * 0.25})`);
|
|
336
|
+
g.addColorStop(0.92, `rgba(120,70,30,${a})`); g.addColorStop(1, 'rgba(120,70,30,0)');
|
|
337
|
+
rc.fillStyle = g; rc.beginPath(); rc.arc(cx + k * 0.8, cy - k * 0.6, r + 2, 0, 7); rc.fill();
|
|
338
|
+
}
|
|
339
|
+
const g2 = rc.createRadialGradient(cx, cy, 0, cx, cy, R);
|
|
340
|
+
g2.addColorStop(0, `rgba(170,120,60,${a * 0.07})`); g2.addColorStop(1, `rgba(170,120,60,${a * 0.12})`);
|
|
341
|
+
rc.fillStyle = g2; rc.beginPath(); rc.arc(cx, cy, R - 2, 0, 7); rc.fill();
|
|
342
|
+
};
|
|
343
|
+
ring(488, 128, 60, 0.55);
|
|
344
|
+
ring(512, 146, 59, 0.22);
|
|
345
|
+
rc.restore();
|
|
346
|
+
// partial: fade part of the ring away (cup was tilted)
|
|
347
|
+
rc.globalCompositeOperation = 'destination-in';
|
|
348
|
+
const [cxw, cyw] = toCanvas(488, 128);
|
|
349
|
+
const cg = rc.createConicGradient(0.6, cxw, cyw);
|
|
350
|
+
cg.addColorStop(0, 'rgba(0,0,0,1)'); cg.addColorStop(0.55, 'rgba(0,0,0,1)'); cg.addColorStop(0.72, 'rgba(0,0,0,0.15)'); cg.addColorStop(0.86, 'rgba(0,0,0,0.6)'); cg.addColorStop(1, 'rgba(0,0,0,1)');
|
|
351
|
+
rc.fillStyle = cg; rc.fillRect(0, 0, W, H_);
|
|
352
|
+
nc.save(); nc.globalCompositeOperation = 'multiply'; nc.drawImage(RL, 0, 0); nc.restore();
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// ---------- Sharpie ink ----------
|
|
356
|
+
const IL = H.layer(W, H_), ic = IL.getContext('2d');
|
|
357
|
+
ic.save(); setLocal(ic);
|
|
358
|
+
ic.lineCap = 'round'; ic.lineJoin = 'round'; ic.strokeStyle = 'rgb(22,20,28)'; ic.fillStyle = 'rgb(22,20,28)';
|
|
359
|
+
// stroke clock: quick, confident Sharpie strokes one after another
|
|
360
|
+
let clock = 0.25, TIP = null;
|
|
361
|
+
const slot = (dur) => { const a = clock; clock += dur; return H.clamp((t - a) / dur); };
|
|
362
|
+
const ink = (pts, w = 5, s = 1, amp = 1.4) => {
|
|
363
|
+
const P = wob(seg(pts), nz, s, amp);
|
|
364
|
+
let L = 0; for (let i = 1; i < P.length; i++) L += Math.hypot(P[i][0] - P[i - 1][0], P[i][1] - P[i - 1][1]);
|
|
365
|
+
const pr = slot(Math.max(0.05, L / 1900) + 0.025);
|
|
366
|
+
if (pr <= 0) return P;
|
|
367
|
+
const Q = pr < 1 ? P.slice(0, Math.max(2, Math.ceil(P.length * pr))) : P;
|
|
368
|
+
if (pr < 1) TIP = Q[Q.length - 1];
|
|
369
|
+
ic.lineWidth = w; ic.beginPath(); Q.forEach(([x, y], i) => (i ? ic.lineTo(x, y) : ic.moveTo(x, y))); ic.stroke();
|
|
370
|
+
return P;
|
|
371
|
+
};
|
|
372
|
+
const arrow = (pts, s, w = 5, hl = 18) => {
|
|
373
|
+
const P = ink(pts, w, s);
|
|
374
|
+
const a = P[P.length - 1], b = P[Math.max(0, P.length - 8)], an = Math.atan2(a[1] - b[1], a[0] - b[0]);
|
|
375
|
+
ink([[a[0] - Math.cos(an - 0.55) * hl, a[1] - Math.sin(an - 0.55) * hl], a, [a[0] - Math.cos(an + 0.55) * hl, a[1] - Math.sin(an + 0.55) * hl]], w, s + 100, 0.5);
|
|
376
|
+
};
|
|
377
|
+
const txt = (str, x, y, size, rot, s) => {
|
|
378
|
+
ic.save(); ic.font = `400 ${size}px "Permanent Marker"`; ic.translate(x, y); ic.rotate(rot);
|
|
379
|
+
const rr = H.rng(s); let px = 0;
|
|
380
|
+
const pr = slot(str.length * 0.034), nCh = Math.ceil(str.length * pr);
|
|
381
|
+
if (pr > 0 && pr < 1) { const ww = ic.measureText(str.slice(0, nCh)).width; TIP = [x + ww * Math.cos(rot), y + ww * Math.sin(rot) - size * 0.3]; }
|
|
382
|
+
let ci = 0;
|
|
383
|
+
for (const ch of str) { const w = ic.measureText(ch).width; if (ci++ >= nCh) { px += w; continue; } ic.save(); ic.translate(px, rr.range(-1.5, 1.5)); ic.rotate(rr.range(-0.05, 0.05)); ic.fillText(ch, 0, 0); ic.restore(); px += w + rr.range(-1, 1.5); }
|
|
384
|
+
ic.restore(); return px;
|
|
385
|
+
};
|
|
386
|
+
// title
|
|
387
|
+
const tw = txt('THE BIG IDEA', 78, 128, 54, -0.03, 1);
|
|
388
|
+
ink([[74, 146], [80 + tw * 0.55, 140], [78 + tw, 134]], 4.5, 2, 1.8);
|
|
389
|
+
ink([[96, 160], [80 + tw * 0.6, 154], [70 + tw, 150]], 4, 3, 1.8);
|
|
390
|
+
// stick person + speech bubble
|
|
391
|
+
ink(ell(112, 236, 22, 24, -1.6, 4.75), 5, 4, 0.8);
|
|
392
|
+
ink([[112, 262], [110, 330]], 5, 5); ink([[80, 290], [112, 282], [146, 292]], 5, 6); ink([[86, 378], [110, 330], [138, 376]], 5, 7);
|
|
393
|
+
ink([[160, 200], [168, 178], [196, 166], [280, 168], [300, 188], [296, 218], [270, 232], [196, 234], [182, 252], [178, 230], [162, 222], [158, 202]], 4.5, 8, 0.8);
|
|
394
|
+
txt('ugh!!', 190, 214, 30, -0.04, 9);
|
|
395
|
+
// arrow to AI box
|
|
396
|
+
arrow([[300, 260], [336, 262], [362, 258]], 10);
|
|
397
|
+
// robot head box
|
|
398
|
+
ink([[372, 210], [470, 206], [474, 304], [368, 308], [372, 202]], 5, 11, 1.2);
|
|
399
|
+
ink([[420, 206], [422, 180]], 4.5, 12); ink(ell(422, 172, 8, 8), 4, 13, 0.3);
|
|
400
|
+
ink(ell(400, 244, 9, 9), 4.5, 14, 0.3); ink(ell(444, 242, 9, 9), 4.5, 15, 0.3);
|
|
401
|
+
ink([[396, 278], [410, 284], [430, 284], [448, 276]], 4.5, 16, 0.6);
|
|
402
|
+
txt('AI', 398, 342, 30, 0.02, 17);
|
|
403
|
+
// arrow down into the chart
|
|
404
|
+
arrow(quad([480, 300], [540, 320], [520, 372]), 18, 5, 16);
|
|
405
|
+
// hockey-stick chart
|
|
406
|
+
ink([[268, 384], [266, 522], [520, 520]], 4.5, 19, 1);
|
|
407
|
+
const hs = quad([278, 508], [430, 506], [505, 392], 30);
|
|
408
|
+
arrow(hs, 20, 5.5, 18);
|
|
409
|
+
txt('$$$', 400, 420, 30, -0.1, 21);
|
|
410
|
+
ink(ell(432, 410, 50, 28, -2.5, 3.9), 4, 22, 1.4);
|
|
411
|
+
txt('users', 298, 552, 26, 0, 23);
|
|
412
|
+
// notes bottom-left with a scribbled-out word
|
|
413
|
+
txt('MVP in', 74, 452, 26, -0.04, 24);
|
|
414
|
+
const ww = txt('3', 186, 446, 26, -0.04, 25);
|
|
415
|
+
{ const rz = H.rng(5), P = []; for (let k = 0; k < 13; k++) P.push([178 + (k % 2) * 28 + rz.range(-4, 4), 420 + k * 2.4 + rz.range(-3, 3)]); ink(P, 3.5, 26, 0.6); }
|
|
416
|
+
txt('2 wks?', 74, 490, 26, -0.04, 27);
|
|
417
|
+
ic.restore();
|
|
418
|
+
const BUILD_END = clock;
|
|
419
|
+
|
|
420
|
+
// feathering: fiber-shaped bleed + soft halo + sharp core
|
|
421
|
+
{
|
|
422
|
+
const FB = H.layer(W, H_), fc = FB.getContext('2d'), rr = H.rng(44);
|
|
423
|
+
fc.strokeStyle = '#000'; fc.lineWidth = 0.9;
|
|
424
|
+
for (let i = 0; i < 42000; i++) {
|
|
425
|
+
const x = rr.range(80, 900), y = rr.range(40, 690), a = rr.range(0, 6.28), l = rr.range(1.5, 5);
|
|
426
|
+
fc.beginPath(); fc.moveTo(x, y); fc.lineTo(x + Math.cos(a) * l, y + Math.sin(a) * l); fc.stroke();
|
|
427
|
+
}
|
|
428
|
+
const BL = H.layer(W, H_), bc = BL.getContext('2d');
|
|
429
|
+
const soak = H.smooth(0.3, BUILD_END + 1.2, t); // ink keeps wicking into the fibres
|
|
430
|
+
bc.filter = `blur(${(1.2 + 2.2 * soak).toFixed(2)}px)`; bc.drawImage(IL, 0, 0); bc.drawImage(IL, 0, 0); bc.filter = 'none';
|
|
431
|
+
bc.globalCompositeOperation = 'destination-in'; bc.drawImage(FB, 0, 0);
|
|
432
|
+
nc.save(); nc.globalAlpha = 0.2 + 0.3 * soak; nc.drawImage(BL, 0, 0); nc.restore();
|
|
433
|
+
nc.save(); nc.filter = 'blur(2.2px)'; nc.globalAlpha = 0.85; nc.drawImage(IL, 0, 0); nc.restore();
|
|
434
|
+
// core: slightly uneven absorption
|
|
435
|
+
const CO = H.layer(W, H_), co = CO.getContext('2d');
|
|
436
|
+
co.drawImage(IL, 0, 0);
|
|
437
|
+
co.globalCompositeOperation = 'destination-out';
|
|
438
|
+
const r2 = H.rng(45);
|
|
439
|
+
for (let i = 0; i < 9000; i++) { co.fillStyle = `rgba(0,0,0,${r2.range(0.05, 0.3)})`; co.fillRect(r2.range(60, 920), r2.range(30, 700), r2.range(1, 3), r2.range(1, 3)); }
|
|
440
|
+
nc.save(); nc.globalAlpha = 0.92; nc.drawImage(CO, 0, 0); nc.restore();
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
// ---------- crumple + fold lighting ----------
|
|
444
|
+
{
|
|
445
|
+
const s = 2, gw = Math.ceil(W / s), gh = Math.ceil(H_ / s);
|
|
446
|
+
const hf = new Float32Array(gw * gh);
|
|
447
|
+
const creases = [];
|
|
448
|
+
{ const rr = H.rng(9); for (let i = 0; i < 7; i++) creases.push([rr.range(0, NW), rr.range(0, NH), rr.range(0, Math.PI), rr.range(2, 5) * (rr.chance(0.5) ? 1 : -1), rr.range(80, 260)]); }
|
|
449
|
+
for (let y = 0; y < gh; y++) for (let x = 0; x < gw; x++) {
|
|
450
|
+
const [u, v] = toLocal(x * s, y * s);
|
|
451
|
+
if (u < -10 || v < -10 || u > NW + 10 || v > NH + 10) continue;
|
|
452
|
+
let h = nz.fbm2(u * 0.009 + 3, v * 0.009, 4) * 11;
|
|
453
|
+
const r1 = 1 - Math.abs(nz.n2(u * 0.018 + 9, v * 0.018)), r2 = 1 - Math.abs(nz.n2(u * 0.042 + 5, v * 0.042 + 2));
|
|
454
|
+
h += r1 * r1 * 4.5 + r2 * r2 * 1.2;
|
|
455
|
+
const du = Math.abs(u - NW / 2 - 4), dv = Math.abs(v - NH / 2 + 6);
|
|
456
|
+
h += 8 * Math.max(0, 1 - du / 22); // vertical fold: ridge
|
|
457
|
+
h -= 7 * Math.max(0, 1 - dv / 20); // horizontal fold: valley
|
|
458
|
+
for (const [cx, cy, a, amp, len] of creases) {
|
|
459
|
+
const dx = u - cx, dy = v - cy, along = dx * Math.cos(a) + dy * Math.sin(a), across = -dx * Math.sin(a) + dy * Math.cos(a);
|
|
460
|
+
const fall = Math.max(0, 1 - Math.abs(along) / len);
|
|
461
|
+
h += amp * 0.6 * fall * Math.max(0, 1 - Math.abs(across) / 14);
|
|
462
|
+
}
|
|
463
|
+
// edges curl up a little
|
|
464
|
+
const ed = Math.min(u, v, NW - u, NH - v);
|
|
465
|
+
h += 6 * Math.max(0, 1 - ed / 40);
|
|
466
|
+
hf[y * gw + x] = h;
|
|
467
|
+
}
|
|
468
|
+
const SL = H.layer(gw, gh), sc = SL.getContext('2d'), sid = sc.createImageData(gw, gh), sd = sid.data;
|
|
469
|
+
const HLt = H.layer(gw, gh), hc = HLt.getContext('2d'), hid = hc.createImageData(gw, gh), hd = hid.data;
|
|
470
|
+
const Lx = -0.55, Ly = -0.6, Lz = 0.58;
|
|
471
|
+
for (let y = 1; y < gh - 1; y++) for (let x = 1; x < gw - 1; x++) {
|
|
472
|
+
const i = y * gw + x;
|
|
473
|
+
const gx = (hf[i + 1] - hf[i - 1]) / (2 * s), gy = (hf[i + gw] - hf[i - gw]) / (2 * s);
|
|
474
|
+
const nl = Math.hypot(gx, gy, 1), nxv = -gx / nl, nyv = -gy / nl, nzv = 1 / nl;
|
|
475
|
+
const lam = nxv * Lx + nyv * Ly + nzv * Lz, flat = Lz;
|
|
476
|
+
const dlt = (lam - flat) * 1.35;
|
|
477
|
+
const j = i * 4;
|
|
478
|
+
if (dlt < 0) { sd[j] = 70; sd[j + 1] = 64; sd[j + 2] = 58; sd[j + 3] = Math.min(255, -dlt * 255); }
|
|
479
|
+
else { hd[j] = 255; hd[j + 1] = 255; hd[j + 2] = 252; hd[j + 3] = Math.min(255, dlt * 200); }
|
|
480
|
+
}
|
|
481
|
+
sc.putImageData(sid, 0, 0); hc.putImageData(hid, 0, 0);
|
|
482
|
+
nc.save(); nc.globalCompositeOperation = 'source-atop'; nc.imageSmoothingEnabled = true;
|
|
483
|
+
nc.drawImage(SL, 0, 0, W, H_); nc.globalAlpha = 0.6; nc.drawImage(HLt, 0, 0, W, H_); nc.restore();
|
|
484
|
+
}
|
|
485
|
+
// overall soft falloff on the napkin + crisp edge
|
|
486
|
+
nc.save(); nc.globalCompositeOperation = 'source-atop';
|
|
487
|
+
const fo = nc.createRadialGradient(480, 260, 120, 560, 380, 520);
|
|
488
|
+
fo.addColorStop(0, 'rgba(255,255,255,0)'); fo.addColorStop(1, 'rgba(90,80,70,0.16)');
|
|
489
|
+
nc.fillStyle = fo; nc.fillRect(0, 0, W, H_); nc.restore();
|
|
490
|
+
ctx.drawImage(NL, 0, 0);
|
|
491
|
+
ctx.save(); setLocal(ctx); napPath(ctx); ctx.strokeStyle = 'rgba(120,110,95,0.35)'; ctx.lineWidth = 1; ctx.stroke(); ctx.restore();
|
|
492
|
+
|
|
493
|
+
// ---------- coffee cup on saucer (top right) ----------
|
|
494
|
+
{
|
|
495
|
+
const cx = 1128, cy = 150;
|
|
496
|
+
ctx.save(); ctx.filter = 'blur(14px)'; ctx.fillStyle = 'rgba(20,8,0,0.55)';
|
|
497
|
+
ctx.beginPath(); ctx.arc(cx + 18, cy + 22, 156, 0, 7); ctx.fill(); ctx.restore();
|
|
498
|
+
const sg = ctx.createRadialGradient(cx - 50, cy - 60, 20, cx, cy, 160);
|
|
499
|
+
sg.addColorStop(0, '#ffffff'); sg.addColorStop(0.7, '#ebe9e4'); sg.addColorStop(1, '#bfbab2');
|
|
500
|
+
ctx.fillStyle = sg; ctx.beginPath(); ctx.arc(cx, cy, 158, 0, 7); ctx.fill();
|
|
501
|
+
const wellG = ctx.createRadialGradient(cx + 20, cy + 20, 60, cx, cy, 110);
|
|
502
|
+
wellG.addColorStop(0, 'rgba(0,0,0,0)'); wellG.addColorStop(0.9, 'rgba(120,110,100,0.18)'); wellG.addColorStop(1, 'rgba(255,255,255,0.4)');
|
|
503
|
+
ctx.fillStyle = wellG; ctx.beginPath(); ctx.arc(cx, cy, 110, 0, 7); ctx.fill();
|
|
504
|
+
// handle
|
|
505
|
+
ctx.save(); ctx.translate(cx, cy); ctx.rotate(2.35);
|
|
506
|
+
ctx.fillStyle = 'rgba(40,20,5,0.3)'; ctx.beginPath(); ctx.roundRect(86, -8, 52, 26, 12); ctx.fill();
|
|
507
|
+
const hg = ctx.createLinearGradient(0, -14, 0, 14); hg.addColorStop(0, '#ffffff'); hg.addColorStop(1, '#c9c4bb');
|
|
508
|
+
ctx.fillStyle = hg; ctx.beginPath(); ctx.roundRect(80, -14, 52, 26, 12); ctx.fill();
|
|
509
|
+
ctx.restore();
|
|
510
|
+
// cup shadow + body
|
|
511
|
+
ctx.save(); ctx.filter = 'blur(6px)'; ctx.fillStyle = 'rgba(60,40,20,0.35)'; ctx.beginPath(); ctx.arc(cx + 10, cy + 12, 92, 0, 7); ctx.fill(); ctx.restore();
|
|
512
|
+
const cg = ctx.createRadialGradient(cx - 40, cy - 40, 10, cx, cy, 92);
|
|
513
|
+
cg.addColorStop(0, '#ffffff'); cg.addColorStop(0.8, '#efece6'); cg.addColorStop(1, '#c6c0b6');
|
|
514
|
+
ctx.fillStyle = cg; ctx.beginPath(); ctx.arc(cx, cy, 90, 0, 7); ctx.fill();
|
|
515
|
+
// coffee
|
|
516
|
+
const cf = ctx.createRadialGradient(cx - 10, cy - 10, 5, cx, cy, 76);
|
|
517
|
+
cf.addColorStop(0, '#6b3e1e'); cf.addColorStop(0.75, '#4a2810'); cf.addColorStop(0.92, '#9a6a3c'); cf.addColorStop(1, '#3a1e0a');
|
|
518
|
+
ctx.fillStyle = cf; ctx.beginPath(); ctx.arc(cx, cy, 76, 0, 7); ctx.fill();
|
|
519
|
+
// latte heart
|
|
520
|
+
ctx.save(); ctx.translate(cx + 4, cy + 4); ctx.rotate(0.4);
|
|
521
|
+
ctx.fillStyle = 'rgba(232,206,170,0.92)';
|
|
522
|
+
ctx.beginPath(); ctx.moveTo(0, 30); ctx.bezierCurveTo(-46, 0, -34, -38, 0, -16); ctx.bezierCurveTo(34, -38, 46, 0, 0, 30); ctx.fill();
|
|
523
|
+
ctx.strokeStyle = 'rgba(120,70,30,0.6)'; ctx.lineWidth = 2; ctx.beginPath(); ctx.moveTo(0, -30); ctx.lineTo(0, 36); ctx.stroke();
|
|
524
|
+
ctx.restore();
|
|
525
|
+
// rim highlight + inner shadow
|
|
526
|
+
ctx.strokeStyle = 'rgba(255,255,255,0.9)'; ctx.lineWidth = 2; ctx.beginPath(); ctx.arc(cx, cy, 82, 3.4, 5.2); ctx.stroke();
|
|
527
|
+
ctx.strokeStyle = 'rgba(60,30,10,0.35)'; ctx.lineWidth = 6; ctx.beginPath(); ctx.arc(cx + 2, cy + 2, 74, 0, 7); ctx.stroke();
|
|
528
|
+
ctx.fillStyle = 'rgba(255,255,255,0.5)'; ctx.beginPath(); ctx.ellipse(cx - 30, cy - 36, 16, 6, -0.7, 0, 7); ctx.fill();
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
// ---------- steam curling off the coffee (ambient) ----------
|
|
532
|
+
{
|
|
533
|
+
const SL = H.layer(W, H_), sc = SL.getContext('2d');
|
|
534
|
+
sc.lineCap = 'round';
|
|
535
|
+
for (let k = 0; k < 5; k++) {
|
|
536
|
+
const ph = k * 1.3, life = ((t * 0.35 + k / 5) % 1);
|
|
537
|
+
const bx = 1095 + k * 14, by = 200 - life * 150;
|
|
538
|
+
sc.strokeStyle = `rgba(255,250,240,${0.65 * Math.sin(life * Math.PI)})`; sc.lineWidth = 10 + life * 18;
|
|
539
|
+
sc.beginPath();
|
|
540
|
+
for (let j = 0; j <= 12; j++) {
|
|
541
|
+
const u = j / 12, y = by + 40 - u * 110, x = bx + Math.sin(u * 4 + t * 1.6 + ph) * (10 + 26 * u);
|
|
542
|
+
j ? sc.lineTo(x, y) : sc.moveTo(x, y);
|
|
543
|
+
}
|
|
544
|
+
sc.stroke();
|
|
545
|
+
}
|
|
546
|
+
ctx.save(); ctx.filter = 'blur(9px)'; ctx.drawImage(SL, 0, 0); ctx.restore();
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
// ---------- the marker: in hand while drawing, then set down on the table ----------
|
|
550
|
+
const hTIP = TIP && t < BUILD_END ? (() => { const [u, v] = TIP; return toCanvas(u, v); })() : null;
|
|
551
|
+
if (hTIP) {
|
|
552
|
+
const [tx, ty] = hTIP, ang = 0.9;
|
|
553
|
+
ctx.save();
|
|
554
|
+
ctx.save(); ctx.filter = 'blur(8px)'; ctx.fillStyle = 'rgba(20,8,0,0.35)'; ctx.translate(tx + 24, ty + 30); ctx.rotate(ang); ctx.beginPath(); ctx.roundRect(10, -14, 300, 28, 12); ctx.fill(); ctx.restore();
|
|
555
|
+
ctx.translate(tx, ty); ctx.rotate(ang);
|
|
556
|
+
ctx.fillStyle = '#111114'; ctx.beginPath(); ctx.ellipse(5, 0, 7, 4, 0, 0, 7); ctx.fill();
|
|
557
|
+
const ng = ctx.createLinearGradient(0, -10, 0, 10); ng.addColorStop(0, '#d8d8de'); ng.addColorStop(1, '#6a6a72');
|
|
558
|
+
ctx.fillStyle = ng; ctx.beginPath(); ctx.moveTo(8, -4); ctx.lineTo(30, -11); ctx.lineTo(30, 11); ctx.lineTo(8, 4); ctx.closePath(); ctx.fill();
|
|
559
|
+
const bg = ctx.createLinearGradient(0, -15, 0, 15); bg.addColorStop(0, '#5a5a62'); bg.addColorStop(0.3, '#2a2a30'); bg.addColorStop(1, '#0c0c10');
|
|
560
|
+
ctx.fillStyle = bg; ctx.beginPath(); ctx.roundRect(28, -15, 190, 30, 12); ctx.fill();
|
|
561
|
+
ctx.fillStyle = '#9c9ca4'; ctx.fillRect(150, -15, 14, 30);
|
|
562
|
+
ctx.fillStyle = bg; ctx.beginPath(); ctx.roundRect(210, -17, 96, 34, 14); ctx.fill(); // cap posted on the back
|
|
563
|
+
ctx.fillStyle = 'rgba(255,255,255,0.35)'; ctx.fillRect(36, -10, 170, 2.5);
|
|
564
|
+
ctx.restore();
|
|
565
|
+
}
|
|
566
|
+
if (t >= BUILD_END) {
|
|
567
|
+
const drop = H.ease.out(H.clamp((t - BUILD_END) / 0.3));
|
|
568
|
+
ctx.save(); ctx.translate(1010 + (1 - drop) * -60, 560 + (1 - drop) * -50); ctx.rotate(-0.62 + (1 - drop) * 0.5);
|
|
569
|
+
ctx.scale(1 + (1 - drop) * 0.08, 1 + (1 - drop) * 0.08);
|
|
570
|
+
ctx.save(); ctx.filter = 'blur(6px)'; ctx.fillStyle = 'rgba(20,8,0,0.5)'; ctx.beginPath(); ctx.roundRect(8, 4, 270, 34, 16); ctx.fill(); ctx.restore();
|
|
571
|
+
const bg = ctx.createLinearGradient(0, -16, 0, 16);
|
|
572
|
+
bg.addColorStop(0, '#5a5a62'); bg.addColorStop(0.3, '#2a2a30'); bg.addColorStop(1, '#0c0c10');
|
|
573
|
+
ctx.fillStyle = bg; ctx.beginPath(); ctx.roundRect(0, -15, 180, 30, 13); ctx.fill();
|
|
574
|
+
ctx.fillStyle = '#9c9ca4'; ctx.fillRect(110, -15, 14, 30);
|
|
575
|
+
const cg = ctx.createLinearGradient(0, -17, 0, 17);
|
|
576
|
+
cg.addColorStop(0, '#606068'); cg.addColorStop(0.3, '#26262c'); cg.addColorStop(1, '#09090c');
|
|
577
|
+
ctx.fillStyle = cg; ctx.beginPath(); ctx.roundRect(176, -17, 100, 34, 14); ctx.fill();
|
|
578
|
+
ctx.fillStyle = '#18181c'; ctx.beginPath(); ctx.roundRect(190, -24, 76, 10, 4); ctx.fill();
|
|
579
|
+
ctx.fillStyle = 'rgba(255,255,255,0.35)'; ctx.fillRect(14, -10, 150, 2.5); ctx.fillRect(186, -11, 80, 2.5);
|
|
580
|
+
ctx.restore();
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
H.grain(ctx, W, H_, 0.03, 8 + (Math.floor(t * 12) % 4));
|
|
584
|
+
H.vignette(ctx, W, H_, 0.35, '25,10,0');
|
|
585
|
+
},
|
|
586
|
+
// >>>EXPLAINER
|
|
587
|
+
explainerDuration: 15,
|
|
588
|
+
explainerNote: 'A cafe-table pitch: the camera starts tight on the scrawled question then pulls back to the napkin; when a napkin is full a fresh one is slapped down on top of the pile (with a red Sharpie for the wrong guess and the 97%), arrows and numbers are fast Sharpie scrawls that feather into the tissue.',
|
|
589
|
+
explainer(ctx, W, H_, t) {
|
|
590
|
+
const nz = H.makeNoise(64);
|
|
591
|
+
const D = [2560, 650];
|
|
592
|
+
const SLIDE = [[-1, -0.5, 0], [5.55, 5.95, 1], [10.25, 10.65, 2]]; // napkin k lands at [1]
|
|
593
|
+
const L = {
|
|
594
|
+
D, pT: 10.85, kT: 13.05, modelName: 'the model', titleX: 1880, titleY: 300, model2At: 6.0,
|
|
595
|
+
model: (cx, cy, adj, push, api, tt) => {
|
|
596
|
+
const g = 'M';
|
|
597
|
+
api.line(XE.rrect(cx - 150, cy - 135, 300, 290, 24), 'ink', 6, 2.5, 2.68, g);
|
|
598
|
+
api.line([[cx + 70, cy - 135], [cx + 74, cy - 180]], 'ink', 5, 2.68, 2.72, g);
|
|
599
|
+
api.line(XE.circ(cx + 75, cy - 192, 12, 12), 'ink', 5, 2.72, 2.76, g);
|
|
600
|
+
api.line(XE.circ(cx - 55, cy - 50, 22, 22), 'ink', 5, 2.76, 2.81, g);
|
|
601
|
+
api.line(XE.circ(cx + 55, cy - 50, 22, 22), 'ink', 5, 2.81, 2.86, g);
|
|
602
|
+
api.line([[cx - 50, cy + 10], [cx - 18, cy + 30], [cx + 18, cy + 30], [cx + 50, cy + 10]], 'ink', 5, 2.86, 2.9, g);
|
|
603
|
+
api.text('AI', cx - 22, cy - 82, 40, 'title', 'ink', 2.9, 2.96, { g });
|
|
604
|
+
[-1, 0, 1].forEach((k, i) => {
|
|
605
|
+
const x = cx + k * 80, y = cy + 92;
|
|
606
|
+
api.line(XE.circ(x, y, 24, 24, -1.2, 5.2), 'ink', 4.5, 2.95 + i * 0.03, 3.0 + i * 0.03, g);
|
|
607
|
+
if (tt > 3.0 + i * 0.03) {
|
|
608
|
+
const a0 = [-2.4, -0.6, -1.9][i], a1 = [-0.7, -2.2, -0.4][i], a = a0 + (a1 - a0) * adj + Math.sin(adj * Math.PI) * 0.3;
|
|
609
|
+
push({ k: 'line', pts: [[x, y], [x + Math.cos(a) * 19, y + Math.sin(a) * 19]], role: adj > 0 && adj < 1 ? 'acc2' : 'ink', w: 5, a: -1, b: 0, inst: true, g });
|
|
610
|
+
}
|
|
611
|
+
});
|
|
612
|
+
},
|
|
613
|
+
};
|
|
614
|
+
const items = XE.story(t, L);
|
|
615
|
+
const cam = XE.camAt([[0, 1880, 300, 1.45], [1.9, 1880, 305, 1.5], [2.75, 1880, 600, 0.84], [5.45, 1890, 605, 0.86], [6.1, 2550, 620, 0.86], [10.2, 2555, 625, 0.88],
|
|
616
|
+
[10.8, 2560, 690, 0.9], [12.9, 2565, 695, 0.93], [13.6, 2560, 690, 0.88], [15, 2560, 690, 0.89]], t);
|
|
617
|
+
const z = cam[2];
|
|
618
|
+
const apply = (c) => { c.translate(W / 2, H_ / 2); c.scale(z, z); c.translate(-cam[0], -cam[1]); };
|
|
619
|
+
const toS = ([x, y]) => [(x - cam[0]) * z + W / 2, (y - cam[1]) * z + H_ / 2];
|
|
620
|
+
|
|
621
|
+
// ---------- cached textures: wood table, napkin body, napkin crumple shading ----------
|
|
622
|
+
if (!XC.wood) {
|
|
623
|
+
const w2 = 1300, h2 = 760, wl = H.layer(w2, h2), wc = wl.getContext('2d'), id = wc.createImageData(w2, h2), d = id.data, rr = H.rng(3);
|
|
624
|
+
const PL = 92, tints = [0, 1, 2, 3, 4, 5, 6, 7, 8].map(() => [rr.range(-12, 12), rr.range(-0.4, 0.4)]);
|
|
625
|
+
for (let y = 0; y < h2; y++) for (let x = 0; x < w2; x++) {
|
|
626
|
+
const pi = Math.floor((y + 20) / PL), py = (y + 20) % PL, [tint, ph] = tints[pi % tints.length];
|
|
627
|
+
const warp = nz.fbm2(x * 0.0025 + pi * 7, py * 0.012 + pi, 3) * 5.5, ring = Math.sin((py * 0.07 + warp + ph * 3) * Math.PI * 2);
|
|
628
|
+
const fine = nz.n2(x * 0.012 + pi * 5, y * 0.55) * 0.6 + nz.n2(x * 0.05, y * 1.3) * 0.25;
|
|
629
|
+
const v = 0.5 + 0.16 * Math.sign(ring) * Math.pow(Math.abs(ring), 0.4) + 0.14 * fine + nz.n2(x * 0.004, y * 0.02 + pi) * 0.12;
|
|
630
|
+
let r = (118 + tint) * (0.75 + 0.5 * v), gg = (74 + tint * 0.6) * (0.75 + 0.5 * v), b = (42 + tint * 0.3) * (0.78 + 0.45 * v);
|
|
631
|
+
if (py < 2 || py > PL - 2) { r *= 0.35; gg *= 0.3; b *= 0.3; }
|
|
632
|
+
const i = (y * w2 + x) * 4; d[i] = r; d[i + 1] = gg; d[i + 2] = b; d[i + 3] = 255;
|
|
633
|
+
}
|
|
634
|
+
wc.putImageData(id, 0, 0); XC.wood = wl;
|
|
635
|
+
// napkin body (with embossed border + fibres) and its crumple shading, 1100x760
|
|
636
|
+
const NW = 1100, NH = 760, nb = H.layer(NW, NH), nc = nb.getContext('2d');
|
|
637
|
+
const out = []; const edge = (x0, y0, x1, y1, s) => { for (let i = 0; i < 60; i++) { const u = i / 60, x = x0 + (x1 - x0) * u, y = y0 + (y1 - y0) * u, o = nz.n2(u * 9 + s, s) * 2.5; const nx = -(y1 - y0), ny = x1 - x0, l = Math.hypot(nx, ny); out.push([x + nx / l * o, y + ny / l * o]); } };
|
|
638
|
+
edge(4, 3, NW - 3, 6, 1); edge(NW - 3, 4, NW - 6, NH - 3, 2); edge(NW - 4, NH - 3, 3, NH - 4, 3); edge(3, NH - 3, 6, 6, 4);
|
|
639
|
+
const path = (c) => { c.beginPath(); out.forEach(([x, y], i) => (i ? c.lineTo(x, y) : c.moveTo(x, y))); c.closePath(); };
|
|
640
|
+
path(nc); nc.fillStyle = '#f6f5f0'; nc.fill(); nc.save(); nc.clip();
|
|
641
|
+
const r2 = H.rng(21);
|
|
642
|
+
for (let i = 0; i < 3500; i++) { const x = r2.range(0, NW), y = r2.range(0, NH), a = r2.range(0, 6.28), l = r2.range(3, 10); nc.strokeStyle = r2.chance(0.5) ? 'rgba(180,175,165,0.08)' : 'rgba(255,255,255,0.35)'; nc.lineWidth = 0.7; nc.beginPath(); nc.moveTo(x, y); nc.lineTo(x + Math.cos(a) * l, y + Math.sin(a) * l); nc.stroke(); }
|
|
643
|
+
const EM = H.layer(NW, NH), ec = EM.getContext('2d'); ec.strokeStyle = '#000'; ec.fillStyle = '#000';
|
|
644
|
+
const inset = (k, lw) => { ec.lineWidth = lw; ec.beginPath(); ec.roundRect(k, k, NW - 2 * k, NH - 2 * k, 6); ec.stroke(); };
|
|
645
|
+
inset(18, 2); inset(56, 2); inset(22, 1.2);
|
|
646
|
+
const ring = (x, y) => { ec.lineWidth = 1.6; for (let k = 0; k < 4; k++) { const a = k * Math.PI / 2; ec.beginPath(); ec.ellipse(x + Math.cos(a) * 5, y + Math.sin(a) * 5, 5, 3, a, 0, 7); ec.stroke(); } };
|
|
647
|
+
for (let x = 74; x < NW - 40; x += 36) { ring(x, 37); ring(x, NH - 37); }
|
|
648
|
+
for (let y = 74; y < NH - 40; y += 36) { ring(37, y); ring(NW - 37, y); }
|
|
649
|
+
const tintL = (col, dx, dy, a) => { const tl = H.layer(NW, NH), tc = tl.getContext('2d'); tc.drawImage(EM, dx, dy); tc.globalCompositeOperation = 'source-in'; tc.fillStyle = col; tc.fillRect(0, 0, NW, NH); nc.globalAlpha = a; nc.drawImage(tl, 0, 0); nc.globalAlpha = 1; };
|
|
650
|
+
tintL('#8f8a80', 1.1, 1.3, 0.35); tintL('#ffffff', -1, -1.1, 0.9);
|
|
651
|
+
nc.restore();
|
|
652
|
+
XC.napkin = nb;
|
|
653
|
+
// crumple shading (multiply) + highlights, half-res
|
|
654
|
+
const gw = NW / 2, gh = NH / 2, hf = new Float32Array(gw * gh);
|
|
655
|
+
for (let y = 0; y < gh; y++) for (let x = 0; x < gw; x++) {
|
|
656
|
+
const u = x * 2, v = y * 2;
|
|
657
|
+
let h = nz.fbm2(u * 0.009 + 3, v * 0.009, 4) * 11;
|
|
658
|
+
const q1 = 1 - Math.abs(nz.n2(u * 0.018 + 9, v * 0.018)), q2 = 1 - Math.abs(nz.n2(u * 0.042 + 5, v * 0.042 + 2));
|
|
659
|
+
h += q1 * q1 * 4.5 + q2 * q2 * 0.6 + 8 * Math.max(0, 1 - Math.abs(u - NW / 2) / 22) - 7 * Math.max(0, 1 - Math.abs(v - NH / 2) / 20);
|
|
660
|
+
h += 6 * Math.max(0, 1 - Math.min(u, v, NW - u, NH - v) / 40);
|
|
661
|
+
hf[y * gw + x] = h;
|
|
662
|
+
}
|
|
663
|
+
// shadows (multiplied, warm grey like the hero) and tissue highlights (laid on top) as separate layers
|
|
664
|
+
const SL = H.layer(gw, gh), sc = SL.getContext('2d'), sid = sc.createImageData(gw, gh), sd = sid.data;
|
|
665
|
+
const HLl = H.layer(gw, gh), hlc = HLl.getContext('2d'), hid = hlc.createImageData(gw, gh), hd = hid.data;
|
|
666
|
+
for (let y = 1; y < gh - 1; y++) for (let x = 1; x < gw - 1; x++) {
|
|
667
|
+
const i = y * gw + x, gx = (hf[i + 1] - hf[i - 1]) / 4, gy = (hf[i + gw] - hf[i - gw]) / 4, nl = Math.hypot(gx, gy, 1);
|
|
668
|
+
const lam = (-gx * -0.55 + -gy * -0.6 + 0.58) / nl, dl = (lam - 0.58) * 1.35, j = i * 4;
|
|
669
|
+
if (dl < 0) { sd[j] = 118; sd[j + 1] = 108; sd[j + 2] = 96; sd[j + 3] = Math.min(255, -dl * 255); } else { hd[j] = 255; hd[j + 1] = 255; hd[j + 2] = 251; hd[j + 3] = Math.min(255, dl * 200); }
|
|
670
|
+
}
|
|
671
|
+
sc.putImageData(sid, 0, 0); hlc.putImageData(hid, 0, 0);
|
|
672
|
+
const up = (src) => { const o = H.layer(NW, NH), oc = o.getContext('2d'); oc.imageSmoothingEnabled = true; oc.drawImage(src, 0, 0, NW, NH); oc.globalCompositeOperation = 'destination-in'; oc.drawImage(nb, 0, 0); return o; };
|
|
673
|
+
XC.crumple = up(SL); XC.crumpleHL = up(HLl);
|
|
674
|
+
// tissue fibre mask (ink wicks along these) and an absorption speckle mask, both in napkin space
|
|
675
|
+
const FB = H.layer(NW, NH), fbc = FB.getContext('2d'), r3 = H.rng(44);
|
|
676
|
+
fbc.strokeStyle = '#000'; fbc.lineWidth = 0.9; fbc.beginPath();
|
|
677
|
+
for (let i = 0; i < 52000; i++) { const x = r3.range(0, NW), y = r3.range(0, NH), a = r3.range(0, 6.28), l = r3.range(1.5, 5); fbc.moveTo(x, y); fbc.lineTo(x + Math.cos(a) * l, y + Math.sin(a) * l); }
|
|
678
|
+
fbc.stroke(); XC.fibre = FB;
|
|
679
|
+
const SP = H.layer(NW, NH), spc = SP.getContext('2d'), r4 = H.rng(45);
|
|
680
|
+
for (let i = 0; i < 14000; i++) { spc.fillStyle = `rgba(0,0,0,${r4.range(0.05, 0.3).toFixed(3)})`; spc.fillRect(r4.range(0, NW), r4.range(0, NH), r4.range(1, 3), r4.range(1, 3)); }
|
|
681
|
+
XC.speck = SP;
|
|
682
|
+
// coffee-ring stain sprite (the hero's ring(): a double ring, one side faded where the cup tilted)
|
|
683
|
+
const RS = 300, RL = H.layer(RS, RS), rc = RL.getContext('2d');
|
|
684
|
+
const ringS = (cx, cy, R, a) => {
|
|
685
|
+
for (let k = 0; k < 3; k++) {
|
|
686
|
+
const r = R + k * 1.6, g = rc.createRadialGradient(cx, cy, r - 18, cx, cy, r + 2);
|
|
687
|
+
g.addColorStop(0, 'rgba(150,95,45,0)'); g.addColorStop(0.7, `rgba(150,95,45,${a * 0.25})`);
|
|
688
|
+
g.addColorStop(0.92, `rgba(120,70,30,${a})`); g.addColorStop(1, 'rgba(120,70,30,0)');
|
|
689
|
+
rc.fillStyle = g; rc.beginPath(); rc.arc(cx + k * 0.9, cy - k * 0.7, r + 2, 0, 7); rc.fill();
|
|
690
|
+
}
|
|
691
|
+
const g2 = rc.createRadialGradient(cx, cy, 0, cx, cy, R);
|
|
692
|
+
g2.addColorStop(0, `rgba(170,120,60,${a * 0.07})`); g2.addColorStop(1, `rgba(170,120,60,${a * 0.12})`);
|
|
693
|
+
rc.fillStyle = g2; rc.beginPath(); rc.arc(cx, cy, R - 2, 0, 7); rc.fill();
|
|
694
|
+
};
|
|
695
|
+
ringS(140, 140, 74, 0.55); ringS(168, 162, 73, 0.22);
|
|
696
|
+
rc.globalCompositeOperation = 'destination-in';
|
|
697
|
+
const cgR = rc.createConicGradient(0.6, 140, 140);
|
|
698
|
+
cgR.addColorStop(0, 'rgba(0,0,0,1)'); cgR.addColorStop(0.55, 'rgba(0,0,0,1)'); cgR.addColorStop(0.72, 'rgba(0,0,0,0.15)'); cgR.addColorStop(0.86, 'rgba(0,0,0,0.6)'); cgR.addColorStop(1, 'rgba(0,0,0,1)');
|
|
699
|
+
rc.fillStyle = cgR; rc.fillRect(0, 0, RS, RS);
|
|
700
|
+
XC.ring = RL;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
// ---------- table ----------
|
|
704
|
+
ctx.save(); apply(ctx);
|
|
705
|
+
ctx.imageSmoothingEnabled = true; ctx.drawImage(XC.wood, 700, -150, 2600, 1520);
|
|
706
|
+
ctx.restore();
|
|
707
|
+
const vig = ctx.createLinearGradient(0, 0, W, H_); vig.addColorStop(0, 'rgba(255,230,190,0.12)'); vig.addColorStop(1, 'rgba(20,8,0,0.22)');
|
|
708
|
+
ctx.fillStyle = vig; ctx.fillRect(0, 0, W, H_);
|
|
709
|
+
|
|
710
|
+
// ---------- napkins, slapped down one on top of the other ----------
|
|
711
|
+
const NAP = [[1880, 600, 1320, 840, -0.02], [2550, 620, 1100, 800, 0.035], [2560, 690, 1090, 690, -0.03]];
|
|
712
|
+
const GRP = [['A', 'B', 'M', 'F'], ['C', 'M2'], ['D', 'E']];
|
|
713
|
+
const font = (it) => `400 ${it.size * (it.font === 'label' ? 1.1 : it.font === 'num' ? 1.0 : 0.92)}px "Permanent Marker"`;
|
|
714
|
+
const measure = (it, p) => {
|
|
715
|
+
ctx.save(); ctx.font = font(it); const w = ctx.measureText(it.s).width, x0 = it.align === 'center' ? it.x - w / 2 : it.x;
|
|
716
|
+
const w2 = ctx.measureText(it.s.slice(0, Math.ceil(it.s.length * p))).width; ctx.restore(); return [x0 + w2, it.y - it.size * 0.3];
|
|
717
|
+
};
|
|
718
|
+
for (let k = 0; k < 3; k++) {
|
|
719
|
+
const [s0, s1] = SLIDE[k];
|
|
720
|
+
if (t < s0) break;
|
|
721
|
+
const u = XE.clamp((t - s0) / (s1 - s0)), e = u >= 1 ? 1 : 1 - Math.pow(1 - u, 3) * Math.cos(u * 4.5);
|
|
722
|
+
const [ncx, ncy, nw, nh, nr] = NAP[k];
|
|
723
|
+
const ox = (1 - e) * 1100, oy = (1 - e) * -700, orot = (1 - e) * 0.6, lift = (1 - XE.clamp(u * 1.1)) * 1;
|
|
724
|
+
ctx.save(); apply(ctx);
|
|
725
|
+
ctx.translate(ncx + ox, ncy + oy); ctx.rotate(nr + orot);
|
|
726
|
+
// shadow: big and soft while in the air, tight once it lands
|
|
727
|
+
ctx.save(); ctx.filter = `blur(${(8 + lift * 30).toFixed(1)}px)`; ctx.fillStyle = `rgba(25,10,0,${(0.5 - lift * 0.25).toFixed(2)})`;
|
|
728
|
+
ctx.fillRect(-nw / 2 + 8 + lift * 60, -nh / 2 + 12 + lift * 70, nw, nh); ctx.restore();
|
|
729
|
+
ctx.drawImage(XC.napkin, -nw / 2, -nh / 2, nw, nh);
|
|
730
|
+
// a coffee ring where the cup was set down on this napkin (world offsets from the napkin centre, clipped to it)
|
|
731
|
+
const RG = [[-565, -325, 0.9], [350, -230, 2.4], [-500, -300, -0.7]][k];
|
|
732
|
+
ctx.save(); ctx.beginPath(); ctx.rect(-nw / 2 + 4, -nh / 2 + 4, nw - 8, nh - 8); ctx.clip();
|
|
733
|
+
ctx.translate(RG[0], RG[1]); ctx.rotate(RG[2]); ctx.globalCompositeOperation = 'multiply'; ctx.drawImage(XC.ring, -140, -140);
|
|
734
|
+
ctx.restore();
|
|
735
|
+
ctx.restore();
|
|
736
|
+
if (u >= 1) {
|
|
737
|
+
// ink for this napkin (Sharpie, feathering)
|
|
738
|
+
const IL = H.layer(W, H_), ic = IL.getContext('2d');
|
|
739
|
+
ic.save(); apply(ic); ic.lineCap = 'round'; ic.lineJoin = 'round';
|
|
740
|
+
for (const it of items) {
|
|
741
|
+
if (!GRP[k].includes(it.g)) continue;
|
|
742
|
+
const p = it.inst ? 1 : XE.win(t, it.a, it.b);
|
|
743
|
+
if (p <= 0) continue;
|
|
744
|
+
const col = it.role === 'acc2' ? 'rgb(196,28,36)' : 'rgb(22,20,28)';
|
|
745
|
+
ic.strokeStyle = col; ic.fillStyle = col;
|
|
746
|
+
if (it.k === 'line') {
|
|
747
|
+
const seed = ((it.pts[0][0] * 13 + it.pts[0][1] * 7) | 0) + 3;
|
|
748
|
+
let P = wob(seg(it.pts, 2.5), nz, seed % 79, it.inst ? 0.5 : 1.5);
|
|
749
|
+
if (p < 1) P = P.slice(0, Math.max(2, Math.ceil(P.length * p)));
|
|
750
|
+
ic.lineWidth = Math.max(4, it.w * 1.05); ic.beginPath(); P.forEach(([x, y], i) => (i ? ic.lineTo(x, y) : ic.moveTo(x, y))); ic.stroke();
|
|
751
|
+
} else if (it.k === 'dot') { ic.beginPath(); ic.arc(it.x, it.y, it.r, 0, 7); ic.fill(); }
|
|
752
|
+
else {
|
|
753
|
+
ic.save(); ic.font = font(it); const w = ic.measureText(it.s).width;
|
|
754
|
+
ic.translate(it.align === 'center' ? it.x - w / 2 : it.x, it.y); ic.rotate(it.rot);
|
|
755
|
+
const rr = H.rng((it.s.length * 31 + (it.x | 0)) % 991), n = Math.ceil(it.s.length * p); let px = 0;
|
|
756
|
+
for (let i = 0; i < n; i++) { const cw = ic.measureText(it.s[i]).width; ic.save(); ic.translate(px, rr.range(-1.5, 1.5)); ic.rotate(rr.range(-0.05, 0.05)); ic.fillText(it.s[i], 0, 0); ic.restore(); px += cw; }
|
|
757
|
+
ic.restore();
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
ic.restore();
|
|
761
|
+
// clip ink to the napkin, feather it, then let the crumples shade it
|
|
762
|
+
ic.save(); ic.globalCompositeOperation = 'destination-in'; apply(ic); ic.translate(ncx, ncy); ic.rotate(nr); ic.drawImage(XC.napkin, -nw / 2, -nh / 2, nw, nh); ic.restore();
|
|
763
|
+
// the hero's feathering: a soft halo, a fibre-shaped bleed wicking out along the tissue, then the core
|
|
764
|
+
// with slightly uneven absorption (speckle knocked out of it)
|
|
765
|
+
const toNap = (c) => { apply(c); c.translate(ncx, ncy); c.rotate(nr); };
|
|
766
|
+
// blur at half resolution (cheap, and the upscale softens it further), reusing cached scratch layers
|
|
767
|
+
const hw = W >> 1, hh = H_ >> 1;
|
|
768
|
+
if (!XC.bl || XC.bl.width !== hw) { XC.bl = H.layer(hw, hh); XC.fb = H.layer(W, H_); }
|
|
769
|
+
const BL = XC.bl, bc = BL.getContext('2d'), FBL = XC.fb, fc = FBL.getContext('2d');
|
|
770
|
+
bc.clearRect(0, 0, hw, hh); bc.filter = `blur(${(1.5 * Math.sqrt(z)).toFixed(2)}px)`; bc.drawImage(IL, 0, 0, hw, hh); bc.filter = 'none';
|
|
771
|
+
bc.drawImage(BL, 0, 0); // doubled, so the bleed has some body
|
|
772
|
+
ctx.save(); ctx.imageSmoothingEnabled = true; ctx.globalAlpha = 0.38; ctx.drawImage(BL, 0, 0, W, H_); ctx.restore();
|
|
773
|
+
fc.clearRect(0, 0, W, H_); fc.imageSmoothingEnabled = true; fc.drawImage(BL, 0, 0, W, H_);
|
|
774
|
+
fc.save(); fc.globalCompositeOperation = 'destination-in'; toNap(fc); fc.drawImage(XC.fibre, -nw / 2, -nh / 2, nw, nh); fc.restore();
|
|
775
|
+
ctx.save(); ctx.globalAlpha = 0.75; ctx.drawImage(FBL, 0, 0); ctx.restore();
|
|
776
|
+
ic.save(); ic.globalCompositeOperation = 'destination-out'; toNap(ic); ic.drawImage(XC.speck, -nw / 2, -nh / 2, nw, nh); ic.restore();
|
|
777
|
+
ctx.save(); ctx.globalAlpha = 0.94; ctx.drawImage(IL, 0, 0); ctx.restore();
|
|
778
|
+
}
|
|
779
|
+
ctx.save(); apply(ctx); ctx.translate(ncx + ox, ncy + oy); ctx.rotate(nr + orot);
|
|
780
|
+
ctx.globalCompositeOperation = 'multiply'; ctx.globalAlpha = 0.5; ctx.drawImage(XC.crumple, -nw / 2, -nh / 2, nw, nh);
|
|
781
|
+
ctx.globalCompositeOperation = 'source-over'; ctx.globalAlpha = 0.5; ctx.drawImage(XC.crumpleHL, -nw / 2, -nh / 2, nw, nh);
|
|
782
|
+
ctx.restore();
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
// ---------- coffee cup + steam (on the table, top right) ----------
|
|
786
|
+
{
|
|
787
|
+
const [cx, cy] = toS([3170, 160]), s = z;
|
|
788
|
+
ctx.save(); ctx.translate(cx, cy); ctx.scale(s, s);
|
|
789
|
+
ctx.save(); ctx.filter = 'blur(14px)'; ctx.fillStyle = 'rgba(20,8,0,0.5)'; ctx.beginPath(); ctx.arc(18, 22, 156, 0, 7); ctx.fill(); ctx.restore();
|
|
790
|
+
const sg = ctx.createRadialGradient(-50, -60, 20, 0, 0, 160); sg.addColorStop(0, '#ffffff'); sg.addColorStop(0.7, '#ebe9e4'); sg.addColorStop(1, '#bfbab2');
|
|
791
|
+
ctx.fillStyle = sg; ctx.beginPath(); ctx.arc(0, 0, 158, 0, 7); ctx.fill();
|
|
792
|
+
const cg = ctx.createRadialGradient(-40, -40, 10, 0, 0, 92); cg.addColorStop(0, '#ffffff'); cg.addColorStop(0.8, '#efece6'); cg.addColorStop(1, '#c6c0b6');
|
|
793
|
+
ctx.fillStyle = cg; ctx.beginPath(); ctx.arc(0, 0, 90, 0, 7); ctx.fill();
|
|
794
|
+
const cf = ctx.createRadialGradient(-10, -10, 5, 0, 0, 76); cf.addColorStop(0, '#6b3e1e'); cf.addColorStop(0.75, '#4a2810'); cf.addColorStop(0.92, '#9a6a3c'); cf.addColorStop(1, '#3a1e0a');
|
|
795
|
+
ctx.fillStyle = cf; ctx.beginPath(); ctx.arc(0, 0, 76, 0, 7); ctx.fill();
|
|
796
|
+
ctx.fillStyle = 'rgba(232,206,170,0.92)'; ctx.rotate(0.4); ctx.beginPath(); ctx.moveTo(0, 30); ctx.bezierCurveTo(-46, 0, -34, -38, 0, -16); ctx.bezierCurveTo(34, -38, 46, 0, 0, 30); ctx.fill();
|
|
797
|
+
ctx.restore();
|
|
798
|
+
ctx.save(); ctx.filter = 'blur(9px)'; ctx.lineCap = 'round';
|
|
799
|
+
for (let k = 0; k < 5; k++) {
|
|
800
|
+
const life = (t * 0.35 + k / 5) % 1; ctx.strokeStyle = `rgba(255,250,240,${0.6 * Math.sin(life * Math.PI)})`; ctx.lineWidth = (10 + life * 18) * z;
|
|
801
|
+
ctx.beginPath();
|
|
802
|
+
for (let j = 0; j <= 12; j++) { const v = j / 12, y = cy + (40 - life * 150 - v * 110) * z, x = cx + (-30 + k * 14 + Math.sin(v * 4 + t * 1.6 + k * 1.3) * (10 + 26 * v)) * z; j ? ctx.lineTo(x, y) : ctx.moveTo(x, y); }
|
|
803
|
+
ctx.stroke();
|
|
804
|
+
}
|
|
805
|
+
ctx.restore();
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
// ---------- the Sharpie in hand ----------
|
|
809
|
+
const tp = XE.tipOf(items, t, measure);
|
|
810
|
+
if (tp) {
|
|
811
|
+
const [tx, ty] = toS(tp), ang = 0.9;
|
|
812
|
+
const red = (items.filter((q) => !q.inst && q.k !== 'dot' && XE.win(t, q.a, q.b) > 0 && XE.win(t, q.a, q.b) < 1).pop() || {}).role === 'acc2';
|
|
813
|
+
ctx.save();
|
|
814
|
+
ctx.save(); ctx.filter = 'blur(8px)'; ctx.fillStyle = 'rgba(20,8,0,0.35)'; ctx.translate(tx + 24, ty + 30); ctx.rotate(ang); ctx.beginPath(); ctx.roundRect(10, -14, 300, 28, 12); ctx.fill(); ctx.restore();
|
|
815
|
+
ctx.translate(tx, ty); ctx.rotate(ang);
|
|
816
|
+
ctx.fillStyle = red ? '#9a1018' : '#111114'; ctx.beginPath(); ctx.ellipse(5, 0, 7, 4, 0, 0, 7); ctx.fill();
|
|
817
|
+
const ng = ctx.createLinearGradient(0, -10, 0, 10); ng.addColorStop(0, '#d8d8de'); ng.addColorStop(1, '#6a6a72');
|
|
818
|
+
ctx.fillStyle = ng; ctx.beginPath(); ctx.moveTo(8, -4); ctx.lineTo(30, -11); ctx.lineTo(30, 11); ctx.lineTo(8, 4); ctx.closePath(); ctx.fill();
|
|
819
|
+
const bg = ctx.createLinearGradient(0, -15, 0, 15);
|
|
820
|
+
if (red) { bg.addColorStop(0, '#e05058'); bg.addColorStop(0.3, '#b8202a'); bg.addColorStop(1, '#5a0a10'); } else { bg.addColorStop(0, '#5a5a62'); bg.addColorStop(0.3, '#2a2a30'); bg.addColorStop(1, '#0c0c10'); }
|
|
821
|
+
ctx.fillStyle = bg; ctx.beginPath(); ctx.roundRect(28, -15, 190, 30, 12); ctx.fill();
|
|
822
|
+
ctx.fillStyle = '#9c9ca4'; ctx.fillRect(150, -15, 14, 30);
|
|
823
|
+
ctx.fillStyle = bg; ctx.beginPath(); ctx.roundRect(210, -17, 96, 34, 14); ctx.fill();
|
|
824
|
+
ctx.fillStyle = 'rgba(255,255,255,0.35)'; ctx.fillRect(36, -10, 170, 2.5);
|
|
825
|
+
ctx.restore();
|
|
826
|
+
}
|
|
827
|
+
H.grain(ctx, W, H_, 0.025, 8 + (Math.floor(t * 12) % 4));
|
|
828
|
+
H.vignette(ctx, W, H_, 0.3, '25,10,0');
|
|
829
|
+
},
|
|
830
|
+
// <<<EXPLAINER
|
|
831
|
+
// Sound: a Sharpie on a paper napkin on a wooden cafe table. Every draw-on is a soft, fibrous felt-tip drag with the
|
|
832
|
+
// table's dull body under it (the tip presses the tissue onto wood); the red Sharpie (acc2 items) is the same pen a
|
|
833
|
+
// little brighter; a fresh napkin is slapped down on the pile for each new part (SLIDE windows: it whips in through
|
|
834
|
+
// the air, lands flat with a soft tissue slap, and settles). Quiet room under it, a distant cup now and then.
|
|
835
|
+
// Times mirror explainer()/XE.story (pT 10.85, kT 13.05, model2At 6.0, SLIDE, model timings from explainer()).
|
|
836
|
+
explainerSound(k) {
|
|
837
|
+
const pT = 10.85, kT = 13.05, M2 = 6.0 - 2.5; // the model is drawn again on napkin 2, shifted by model2At - 2.5
|
|
838
|
+
const SLIDE = [[5.55, 5.95], [10.25, 10.65]];
|
|
839
|
+
// first time XE.eio(win(t, t0, t1)) reaches u (the knob needles' eased turn)
|
|
840
|
+
const when = (t0, t1, u) => { for (let i = 0; i <= 400; i++) if (XE.eio(i / 400) >= u - 1e-6) return t0 + (t1 - t0) * i / 400; return t1; };
|
|
841
|
+
// one Sharpie line: felt tip lands (soft press into tissue over wood), fibrous drag for the draw-on, table body under it
|
|
842
|
+
const LV = 0.45; // drawing sits well under the hits
|
|
843
|
+
const sh = (a, b, g = 1, pan = 0, minor = true, red = false) => {
|
|
844
|
+
const d = Math.max(0.03, b - a); g *= LV;
|
|
845
|
+
k.noise(a, { dur: 0.03, filter: 'bandpass', f: 700, q: 1, gain: 0.16 * g, a: 0.002, pan, minor });
|
|
846
|
+
k.tone(a, { f: 120, dur: 0.05, gain: 0.07 * g, pan, minor });
|
|
847
|
+
k.play('stroke', a, { material: 'sharpie', dur: d, gain: (red ? 0.5 : 0.42) * g, pan, minor });
|
|
848
|
+
k.noise(a, { dur: d + 0.04, color: 'pink', filter: 'lowpass', f: 520, gain: 0.07 * g, a: 0.015, hold: d * 0.6, pan, minor });
|
|
849
|
+
};
|
|
850
|
+
// scrawled words: one stroke per word, timed by character position like the explainer's per-letter reveal
|
|
851
|
+
const write = (s, a, b, g = 0.9, pan = 0, red = false, minor = true) => {
|
|
852
|
+
const n = s.length, re = /\S+/g; let m;
|
|
853
|
+
while ((m = re.exec(s))) sh(a + (b - a) * m.index / n, a + (b - a) * (m.index + m[0].length) / n, g, pan, minor, red);
|
|
854
|
+
};
|
|
855
|
+
const dab = (t, g = 1) => k.noise(t, { dur: 0.025, filter: 'bandpass', f: 900, q: 1.2, gain: 0.22 * g, a: 0.002, minor: true }); // a felt-tip dot
|
|
856
|
+
// a fresh napkin: whips in from the top right, first reaches its spot at u = pi/9 of the eased slide
|
|
857
|
+
// (e = 1 - (1-u)^3 cos 4.5u), slaps down flat, shadow tightens as it settles by the end of the window
|
|
858
|
+
const napkin = (s0, s1) => {
|
|
859
|
+
const land = s0 + (s1 - s0) * Math.PI / 9;
|
|
860
|
+
k.noise(s0, { dur: land - s0 + 0.03, color: 'pink', filter: 'bandpass', f: [[0, 260], [land - s0, 800]], q: 0.7, gain: 0.2, a: (land - s0) * 0.8, pan: 0.5 }); // air under the sheet
|
|
861
|
+
k.play('slap', land, { gain: 0.7, pan: 0.1 });
|
|
862
|
+
k.play('thud', land, { f: 85, gain: 0.4, pan: 0.1 }); // the pile on the table
|
|
863
|
+
k.play('paper', land + 0.01, { dur: 0.16, gain: 0.35, pan: 0.1 }); // tissue crinkles as it lands
|
|
864
|
+
k.noise(land + 0.12, { dur: s1 - land, color: 'pink', filter: 'bandpass', f: 1100, q: 0.6, gain: 0.04, a: 0.08, pan: 0.1, minor: true }); // settling
|
|
865
|
+
};
|
|
866
|
+
const clink = (t, f, pan) => { k.tone(t, { f, dur: 0.5, gain: 0.025, verb: 0.6, pan, minor: true }); k.tone(t, { f: f * 2.41, dur: 0.2, gain: 0.008, verb: 0.6, pan, minor: true }); };
|
|
867
|
+
|
|
868
|
+
k.bed('room', 0, 15, { gain: 0.7 });
|
|
869
|
+
clink(1.8, 1560, -0.7); clink(14.45, 1720, 0.75); // a cup set down somewhere across the cafe
|
|
870
|
+
|
|
871
|
+
// 1 HOOK (tight on the napkin)
|
|
872
|
+
k.play('pop', 0.03, { f: 300, gain: 0.45, minor: true }); // cap off
|
|
873
|
+
write('How does AI learn?', 0.15, 1.3, 1.0);
|
|
874
|
+
sh(1.3, 1.55, 1.25, 0, false); // underline: a fast confident swipe
|
|
875
|
+
|
|
876
|
+
// 2 DATA: robot (box, antenna, eyes, smile, "AI", knobs), then six cards
|
|
877
|
+
sh(2.5, 2.68, 1.05, 0.1, false); // robot head: first mark in the new scene
|
|
878
|
+
sh(2.68, 2.76, 0.7, 0.15); sh(2.76, 2.86, 0.7, 0.1); sh(2.86, 2.9, 0.6, 0.1); // antenna, eyes, smile
|
|
879
|
+
write('AI', 2.9, 2.96, 0.6, 0.05);
|
|
880
|
+
for (let i = 0; i < 6; i++) { const a = 3.0 + i * 0.17; sh(a, a + (i < 5 ? 0.15 : 0.21), 0.85, (i % 3 - 1) * 0.15); }
|
|
881
|
+
sh(4.15, 4.45, 1.0); sh(4.46, 4.55, 0.85); // flow arrow + head
|
|
882
|
+
write('examples', 4.55, 4.8, 0.35);
|
|
883
|
+
for (let f = 55; f < 63; f++) k.play('count', f / 12, { gain: 1.5, f: 2000 + (f - 55) * 100, minor: true }); // numbers re-scrawled on the 12 fps grid
|
|
884
|
+
k.play('tock', 63 / 12, { f: 470, gain: 0.45 }); // 1,000,000 lands
|
|
885
|
+
|
|
886
|
+
// napkin 2 slaps down
|
|
887
|
+
napkin(SLIDE[0][0], SLIDE[0][1]);
|
|
888
|
+
|
|
889
|
+
// 3 GUESS -> CHECK -> ADJUST (the robot is redrawn on the new napkin while the new photo goes up)
|
|
890
|
+
sh(2.5 + M2, 2.68 + M2, 0.95, 0.1, false); sh(2.68 + M2, 2.9 + M2, 0.6, 0.1); // robot again: head, then face
|
|
891
|
+
sh(6.4, 6.53, 0.9, 0, true, true); // red frame of the new photo
|
|
892
|
+
sh(6.55, 6.7, 0.85); dab(6.7, 0.9); // cat + eyes
|
|
893
|
+
write('new!', 6.67, 6.8, 0.6, 0.2, true);
|
|
894
|
+
sh(6.8, 6.94, 0.9); sh(6.96, 7.02, 0.8); // arrow down into the model
|
|
895
|
+
sh(7.02, 7.15, 0.9); // guess arrow out
|
|
896
|
+
write('Guess', 7.15, 7.4, 0.6);
|
|
897
|
+
sh(7.3, 7.47, 0.85); sh(7.48, 7.53, 0.75); // speech bubble + tail
|
|
898
|
+
write('dog?', 7.54, 7.75, 1.0);
|
|
899
|
+
write('Check', 7.86, 8.0, 0.6, 0, true);
|
|
900
|
+
// the wrong guess: two hard red slashes + a low "nope"
|
|
901
|
+
sh(8.0, 8.08, 1.8, 0.1, false, true); sh(8.08, 8.16, 1.8, 0.1, false, true);
|
|
902
|
+
k.play('error', 8.0, { f: 'F3', gain: 0.55 });
|
|
903
|
+
sh(8.16, 8.45, 1.1, 0, true, true); // red ring
|
|
904
|
+
sh(8.45, 8.8, 1.0, -0.1, true, true); // long arrow back to the knobs
|
|
905
|
+
write('Adjust', 8.8, 9.05, 0.6, -0.1, true);
|
|
906
|
+
// knob needles swing (eio 8.95..9.5): a soft detent click every 1/7 of the turn, slowing as they settle
|
|
907
|
+
for (let j = 1; j <= 7; j++) k.play('click', when(8.95, 9.5, j / 7), { f: 950, gain: 0.5, pan: -0.15, minor: true });
|
|
908
|
+
sh(9.5, 9.62, 1.1); // strike through "dog?"
|
|
909
|
+
write('cat', 9.62, 9.85, 1.0);
|
|
910
|
+
sh(9.85, 10.05, 1.15, 0, false); // check mark
|
|
911
|
+
k.play('success', 9.98, { f: 'A5', gain: 0.6 });
|
|
912
|
+
|
|
913
|
+
// napkin 3 slaps down
|
|
914
|
+
napkin(SLIDE[1][0], SLIDE[1][1]);
|
|
915
|
+
|
|
916
|
+
// 4 PROGRESS
|
|
917
|
+
sh(pT, pT + 0.3, 1.0, 0, false); // axes
|
|
918
|
+
write('training rounds', pT + 0.3, pT + 0.55, 0.5);
|
|
919
|
+
write('accuracy', pT + 0.45, pT + 0.7, 0.55, 0.3);
|
|
920
|
+
sh(pT + 0.7, pT + 1.7, 0.3); // the rising curve
|
|
921
|
+
{ // % counter: a tick whenever the shown number changes (12 fps grid), slowing as it settles.
|
|
922
|
+
// The numbers stay black, so the hit lands on the frame 97% is first scrawled.
|
|
923
|
+
let last = -1;
|
|
924
|
+
for (let f = Math.ceil((pT + 0.6) * 12); f < 160; f++) {
|
|
925
|
+
const u = Math.min(1, (f / 12 - (pT + 0.6)) / 1.1), v = Math.round(61 + 36 * (1 - Math.pow(1 - u, 2.2)));
|
|
926
|
+
if (v === 97) { // 97% lands: the biggest hit
|
|
927
|
+
k.play('impact', f / 12, { gain: 1.2, pan: 0.2 });
|
|
928
|
+
k.play('ding', f / 12 + 0.01, { f: 'D6', gain: 0.42, pan: 0.2 });
|
|
929
|
+
break;
|
|
930
|
+
}
|
|
931
|
+
if (v !== last) { k.play('tick', f / 12, { gain: 1.5, f: 3200 + (v - 61) * 22, pan: 0.25, minor: true }); last = v; }
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
sh(pT + 1.75, pT + 2.05, 1.25, 0.25, false, true); // red ring round the 97%
|
|
935
|
+
|
|
936
|
+
// 5 TAKEAWAY
|
|
937
|
+
write('More examples → better guesses', kT, kT + 0.75, 0.9);
|
|
938
|
+
k.play('success', kT + 0.75, { f: 'G5', gain: 0.7 }); // resolving landing
|
|
939
|
+
sh(kT + 0.75, kT + 0.95, 1.15, 0, false);
|
|
940
|
+
k.play('click', kT + 1.15, { f: 700, gain: 1.0, minor: true }); // cap back on
|
|
941
|
+
},
|
|
942
|
+
});
|
|
943
|
+
}
|