@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,989 @@
|
|
|
1
|
+
// Ballpoint Notebook — blue Bic doodle on college-ruled paper.
|
|
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.0, freq = 0.02) => {
|
|
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 bez = (p0, p1, p2, p3, n = 40) => {
|
|
32
|
+
const out = [];
|
|
33
|
+
for (let i = 0; i <= n; i++) {
|
|
34
|
+
const t = i / n, m = 1 - t;
|
|
35
|
+
out.push([m * m * m * p0[0] + 3 * m * m * t * p1[0] + 3 * m * t * t * p2[0] + t * t * t * p3[0],
|
|
36
|
+
m * m * m * p0[1] + 3 * m * m * t * p1[1] + 3 * m * t * t * p2[1] + t * t * t * p3[1]]);
|
|
37
|
+
}
|
|
38
|
+
return out;
|
|
39
|
+
};
|
|
40
|
+
const INK = [30, 46, 150];
|
|
41
|
+
|
|
42
|
+
// >>>XE-ENGINE
|
|
43
|
+
// ===================== explainer story engine (shared script: "How does AI learn?") =====================
|
|
44
|
+
// Builds the diagram as timed world-space strokes/texts; each style renders them with its own medium.
|
|
45
|
+
const XC = {}; // cache for static textures (output still depends only on t)
|
|
46
|
+
const XE = (() => {
|
|
47
|
+
const clamp = (v, a = 0, b = 1) => Math.max(a, Math.min(b, v));
|
|
48
|
+
const win = (t, a, b) => clamp((t - a) / (b - a));
|
|
49
|
+
const eio = (x) => (x < 0.5 ? 4 * x * x * x : 1 - Math.pow(-2 * x + 2, 3) / 2);
|
|
50
|
+
const camAt = (keys, t) => {
|
|
51
|
+
if (t <= keys[0][0]) return keys[0].slice(1);
|
|
52
|
+
for (let i = 0; i < keys.length - 1; i++) {
|
|
53
|
+
const a = keys[i], b = keys[i + 1];
|
|
54
|
+
if (t <= b[0]) {
|
|
55
|
+
const u = eio((t - a[0]) / Math.max(1e-6, b[0] - a[0]));
|
|
56
|
+
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)];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return keys[keys.length - 1].slice(1);
|
|
60
|
+
};
|
|
61
|
+
const circ = (x, y, rx, ry, a0 = 0, a1 = Math.PI * 2, n = 0) => {
|
|
62
|
+
n = n || Math.max(12, Math.ceil(Math.abs(a1 - a0) * Math.max(rx, ry) / 6)); const o = [];
|
|
63
|
+
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]); }
|
|
64
|
+
return o;
|
|
65
|
+
};
|
|
66
|
+
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; };
|
|
67
|
+
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; };
|
|
68
|
+
const rrect = (x, y, w, h, r) => {
|
|
69
|
+
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));
|
|
70
|
+
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));
|
|
71
|
+
o.push([x + r, y + h]); o.push(...circ(x + r, y + h - r, r, r, Math.PI / 2, Math.PI, 5).slice(1));
|
|
72
|
+
o.push([x, y + r]); o.push(...circ(x + r, y + r, r, r, Math.PI, Math.PI * 1.5, 5).slice(1));
|
|
73
|
+
o.push([x + r + 6, y - 1]); return o;
|
|
74
|
+
};
|
|
75
|
+
const head = (P, len = 20, spread = 0.5) => {
|
|
76
|
+
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]);
|
|
77
|
+
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]];
|
|
78
|
+
};
|
|
79
|
+
const cat = (x, y, s) => [
|
|
80
|
+
circ(x, y + 0.06 * s, 0.3 * s, 0.27 * s, -1.2, 5.1),
|
|
81
|
+
[[x - 0.27 * s, y - 0.02 * s], [x - 0.24 * s, y - 0.34 * s], [x - 0.07 * s, y - 0.2 * s]],
|
|
82
|
+
[[x + 0.07 * s, y - 0.2 * s], [x + 0.24 * s, y - 0.34 * s], [x + 0.27 * s, y - 0.02 * s]],
|
|
83
|
+
[[x - 0.03 * s, y + 0.1 * s], [x, y + 0.13 * s], [x + 0.03 * s, y + 0.1 * s]],
|
|
84
|
+
[[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]],
|
|
85
|
+
[[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]],
|
|
86
|
+
];
|
|
87
|
+
const dog = (x, y, s) => [
|
|
88
|
+
circ(x, y + 0.04 * s, 0.26 * s, 0.28 * s, -1.4, 4.9),
|
|
89
|
+
circ(x - 0.29 * s, y + 0.04 * s, 0.09 * s, 0.2 * s, 0, 6.4),
|
|
90
|
+
circ(x + 0.29 * s, y + 0.04 * s, 0.09 * s, 0.2 * s, 0, 6.4),
|
|
91
|
+
circ(x, y + 0.15 * s, 0.07 * s, 0.045 * s, 0, 6.4),
|
|
92
|
+
[[x - 0.08 * s, y + 0.23 * s], [x, y + 0.26 * s], [x + 0.08 * s, y + 0.23 * s]],
|
|
93
|
+
];
|
|
94
|
+
const eyes = (x, y, s, dy = 0.02) => [[x - 0.1 * s, y + dy * s], [x + 0.1 * s, y + dy * s]];
|
|
95
|
+
const fmt = (n) => Math.round(n).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
96
|
+
|
|
97
|
+
// L: layout options. mode: 'same' (progress drawn where the loop was) | 'below' | 'right'
|
|
98
|
+
// model(cx, cy, adj, add): style supplies its model drawing; adj 0..1 = how far the knobs have been adjusted.
|
|
99
|
+
const story = (t, L) => {
|
|
100
|
+
const items = [];
|
|
101
|
+
const line = (pts, role, w, a, b, g) => items.push({ k: 'line', pts, role, w, a, b, g });
|
|
102
|
+
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 });
|
|
103
|
+
const dot = (x, y, r, role, a, g) => items.push({ k: 'dot', x, y, r, role, a, b: a + 0.05, g });
|
|
104
|
+
const S = L.s || 1;
|
|
105
|
+
// ---- 1 HOOK ----
|
|
106
|
+
const TX = L.titleX ?? 640, TY = L.titleY ?? 350;
|
|
107
|
+
text('How does AI learn?', TX, TY, 84 * S, 'title', 'ink', 0.15, 1.3, { align: 'center', rot: -0.015, g: 'A' });
|
|
108
|
+
line([[TX - 330 * S, TY + 32 * S], [TX + 330 * S, TY + 24 * S]], 'acc1', 7, 1.3, 1.55, 'A');
|
|
109
|
+
// ---- 2 DATA ----
|
|
110
|
+
const MX = L.modelX ?? 2250, MY = L.modelY ?? 640;
|
|
111
|
+
const mAdj = eio(win(t, 8.95, 9.5));
|
|
112
|
+
L.model(MX, MY, mAdj, (it) => { it.g = it.g || 'M'; items.push(it); }, { line, text, dot }, t);
|
|
113
|
+
text(L.modelName || 'model', MX, MY + 228, 38, 'label', 'ink', 3.15, 3.4, { align: 'center', g: 'M' });
|
|
114
|
+
const CS = 118, cx0 = MX - 870, cy0 = MY - 175;
|
|
115
|
+
for (let i = 0; i < 6; i++) {
|
|
116
|
+
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];
|
|
117
|
+
const a = 3.0 + i * 0.17;
|
|
118
|
+
line(rrect(x - CS / 2, y - CS / 2, CS, CS, 12), 'ink', 4, a, a + 0.12, 'B');
|
|
119
|
+
(isCat ? cat : dog)(x, y - 6, CS * 0.82).forEach((p) => line(p, 'ink', 3.2, a + 0.1, a + 0.22, 'B'));
|
|
120
|
+
eyes(x, y - 6, CS * 0.82).forEach(([ex, ey]) => dot(ex, ey, 3.2, 'ink', a + 0.22, 'B'));
|
|
121
|
+
// label tag hanging off the card
|
|
122
|
+
const tx = x + 18, ty = y + CS / 2 - 4;
|
|
123
|
+
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');
|
|
124
|
+
text(isCat ? 'cat' : 'dog', tx + 8, ty + 30, 31, 'label', isCat ? 'acc1' : 'acc3', a + 0.28, a + 0.36, { g: 'B' });
|
|
125
|
+
}
|
|
126
|
+
// flow arrow into the model
|
|
127
|
+
const fa = cubic([cx0 + 370, MY - 10], [cx0 + 470, MY - 60], [MX - 260, MY - 40], [MX - 165, MY - 10]);
|
|
128
|
+
line(fa, 'ink', 5, 4.15, 4.45, 'B'); line(head(fa, 24), 'ink', 5, 4.45, 4.55, 'B');
|
|
129
|
+
// little example cards streaming along the arrow
|
|
130
|
+
if (t > 4.5 && t < 6.2) {
|
|
131
|
+
for (let k = 0; k < 9; k++) {
|
|
132
|
+
const u = ((t - 4.5) * 0.9 + k / 9) % 1, ix = Math.min(fa.length - 1, Math.floor(u * fa.length));
|
|
133
|
+
const [px, py] = fa[ix], sz = 26 * (1 - 0.5 * u);
|
|
134
|
+
if (t - 4.5 < k / 9 / 0.9) continue;
|
|
135
|
+
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 });
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// counter (numerals redrawn on twos)
|
|
139
|
+
if (t > 4.5) {
|
|
140
|
+
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;
|
|
141
|
+
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 });
|
|
142
|
+
text('examples', cx0 + 150, cy0 + 472, 36, 'label', 'ink', 4.55, 4.8, { align: 'center', g: 'B' });
|
|
143
|
+
}
|
|
144
|
+
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));
|
|
145
|
+
// ---- 3 GUESS -> CHECK -> ADJUST ----
|
|
146
|
+
const qx = MX, qy = MY - 300;
|
|
147
|
+
line(rrect(qx - 62, qy - 62, 124, 124, 12), 'acc2', 4, 6.4, 6.55, 'C');
|
|
148
|
+
cat(qx, qy - 4, 100).forEach((p) => line(p, 'ink', 3.2, 6.5, 6.7, 'C'));
|
|
149
|
+
eyes(qx, qy - 4, 100).forEach(([ex, ey]) => dot(ex, ey, 3, 'ink', 6.7, 'C'));
|
|
150
|
+
text('new!', qx + 72, qy - 30, 30, 'label', 'acc2', 6.65, 6.8, { g: 'C' });
|
|
151
|
+
const dn = [[qx, qy + 70], [qx + 2, MY - 170]];
|
|
152
|
+
line(dn, 'ink', 5, 6.8, 6.95, 'C'); line(head(dn, 18), 'ink', 5, 6.95, 7.02, 'C');
|
|
153
|
+
const gA = [[MX + 175, MY - 10], [MX + 300, MY - 14], [MX + 400, MY - 8]];
|
|
154
|
+
line(gA, 'ink', 5, 7.02, 7.2, 'C'); line(head(gA, 20), 'ink', 5, 7.2, 7.26, 'C');
|
|
155
|
+
text('Guess', MX + 290, MY - 40, 38, 'label', 'ink', 7.15, 7.4, { align: 'center', g: 'C' });
|
|
156
|
+
const BX = MX + 540, BY = MY - 10;
|
|
157
|
+
line(rrect(BX - 120, BY - 55, 240, 110, 40), 'ink', 5, 7.3, 7.5, 'C');
|
|
158
|
+
line([[BX - 70, BY + 52], [BX - 96, BY + 92], [BX - 40, BY + 54]], 'ink', 5, 7.48, 7.55, 'C');
|
|
159
|
+
text('dog?', BX, BY + 18, 52, 'title', 'ink', 7.52, 7.75, { align: 'center', g: 'C' });
|
|
160
|
+
text('Check', BX, BY - 82, 38, 'label', 'acc2', 7.85, 8.05, { align: 'center', g: 'C' });
|
|
161
|
+
line([[BX + 140, BY - 40], [BX + 200, BY + 30]], 'acc2', 8, 8.0, 8.08, 'C');
|
|
162
|
+
line([[BX + 200, BY - 40], [BX + 140, BY + 30]], 'acc2', 8, 8.08, 8.16, 'C');
|
|
163
|
+
line(circ(BX + 4, BY + 2, 150, 82, -2.2, 4.4), 'acc2', 5, 8.15, 8.45, 'C'); // emphasis ring
|
|
164
|
+
const back = cubic([BX - 60, BY + 70], [BX - 80, BY + 290], [MX + 290, MY + 300], [MX + 155, MY + 190]);
|
|
165
|
+
line(back, 'acc2', 6, 8.45, 8.95, 'C'); line(head(back, 22), 'acc2', 6, 8.95, 9.02, 'C');
|
|
166
|
+
text('Adjust', (BX + MX) / 2 - 10, MY + 315, 40, 'label', 'acc2', 8.8, 9.05, { align: 'center', g: 'C' });
|
|
167
|
+
if (t > 8.95 && t < 9.4) { // error signal travelling back
|
|
168
|
+
const u = win(t, 8.95, 9.35), p = back[Math.min(back.length - 1, Math.floor((1 - u) * (back.length - 1)))];
|
|
169
|
+
items.push({ k: 'dot', x: p[0], y: p[1], r: 13, role: 'acc2', a: -1, b: 0, g: 'C', inst: true });
|
|
170
|
+
}
|
|
171
|
+
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
|
|
172
|
+
text('cat', BX + 30, BY + 118, 52, 'title', 'acc3', 9.62, 9.85, { align: 'center', g: 'C' });
|
|
173
|
+
line([[BX + 92, BY + 96], [BX + 112, BY + 122], [BX + 156, BY + 66]], 'acc3', 8, 9.85, 10.05, 'C');
|
|
174
|
+
if (L.bridge) { // a connector the hand draws while the camera travels to the next part
|
|
175
|
+
const B = L.bridge;
|
|
176
|
+
line(B.pts, 'acc1', 5, B.a, B.b, 'D'); line(head(B.pts, 22), 'acc1', 5, B.b, B.b + 0.06, 'D');
|
|
177
|
+
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' });
|
|
178
|
+
}
|
|
179
|
+
// ---- 4 PROGRESS ----
|
|
180
|
+
const D = L.D;
|
|
181
|
+
const ox = D[0] - 380, oy = D[1] + 150, cw = 560, ch = 330;
|
|
182
|
+
line([[ox, oy - ch], [ox, oy], [ox + cw, oy]], 'ink', 5, L.pT, L.pT + 0.35, 'D');
|
|
183
|
+
line(head([[ox, oy], [ox, oy - ch]], 16), 'ink', 5, L.pT + 0.35, L.pT + 0.4, 'D');
|
|
184
|
+
line(head([[ox, oy], [ox + cw, oy]], 16), 'ink', 5, L.pT + 0.4, L.pT + 0.45, 'D');
|
|
185
|
+
text('training rounds', ox + cw / 2, oy + 48, 34, 'label', 'ink', L.pT + 0.3, L.pT + 0.55, { align: 'center', g: 'D' });
|
|
186
|
+
const cpts = [];
|
|
187
|
+
for (let i = 0; i <= 40; i++) {
|
|
188
|
+
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);
|
|
189
|
+
cpts.push([ox + 20 + u * (cw - 50), oy - (acc - 50) / 50 * ch]);
|
|
190
|
+
}
|
|
191
|
+
line(cpts, 'acc1', 6, L.pT + 0.5, L.pT + 1.7, 'D');
|
|
192
|
+
text('accuracy', D[0] + 330, D[1] - 120, 40, 'label', 'ink', L.pT + 0.45, L.pT + 0.7, { align: 'center', g: 'D' });
|
|
193
|
+
if (t > L.pT + 0.55) {
|
|
194
|
+
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));
|
|
195
|
+
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 });
|
|
196
|
+
}
|
|
197
|
+
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');
|
|
198
|
+
// ---- 5 TAKEAWAY ----
|
|
199
|
+
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' });
|
|
200
|
+
line([[D[0] - 450, D[1] + 316], [D[0] + 455, D[1] + 308]], 'acc1', 6, L.kT + 0.75, L.kT + 0.95, 'E');
|
|
201
|
+
return items;
|
|
202
|
+
};
|
|
203
|
+
// the 'tip' of whatever is currently being drawn (for the hand/tool)
|
|
204
|
+
const tipOf = (items, t, measure) => {
|
|
205
|
+
let tip = null;
|
|
206
|
+
for (const it of items) {
|
|
207
|
+
if (it.inst || it.k === 'dot') continue;
|
|
208
|
+
const p = win(t, it.a, it.b);
|
|
209
|
+
if (p > 0 && p < 1) {
|
|
210
|
+
if (it.k === 'line') { const P = it.pts; tip = P[Math.min(P.length - 1, Math.floor(p * (P.length - 1)))]; }
|
|
211
|
+
else tip = measure ? measure(it, p) : [it.x, it.y];
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return tip;
|
|
215
|
+
};
|
|
216
|
+
return { clamp, win, eio, camAt, circ, quad, cubic, rrect, head, cat, dog, story, tipOf, fmt };
|
|
217
|
+
})();
|
|
218
|
+
// <<<XE-ENGINE
|
|
219
|
+
registerStyle({
|
|
220
|
+
id: 'ballpoint-notebook',
|
|
221
|
+
name: 'Ballpoint Notebook',
|
|
222
|
+
category: 'Hand-Drawn',
|
|
223
|
+
description: 'A blue Bic doodle in the back of a college-ruled notebook: dense crosshatching for darks, pressure-varied lines with ink blobs where strokes start, bubble lettering with a hatched drop shadow and compulsive margin doodles.',
|
|
224
|
+
motion: 'Lines scratch on stroke by stroke, then layers of crosshatching build up the shadows pass by pass, while the margin doodles get traced over and over.',
|
|
225
|
+
fonts: ['700 92px "Fredoka"', '400 28px "Gloria Hallelujah"'],
|
|
226
|
+
frameT: 5.9,
|
|
227
|
+
duration: 6,
|
|
228
|
+
readsPixels: true,
|
|
229
|
+
draw(ctx, W, H_, t) {
|
|
230
|
+
const nz = H.makeNoise(57);
|
|
231
|
+
const MX = 168; // red margin x
|
|
232
|
+
const RULE0 = 104, RS = 30;
|
|
233
|
+
|
|
234
|
+
// ---------- paper ----------
|
|
235
|
+
H.paper(ctx, W, H_, '#fbfaf5', 12, 0.012);
|
|
236
|
+
const light = ctx.createLinearGradient(0, 0, W, H_);
|
|
237
|
+
light.addColorStop(0, 'rgba(255,255,255,0.0)'); light.addColorStop(1, 'rgba(120,110,90,0.10)');
|
|
238
|
+
ctx.fillStyle = light; ctx.fillRect(0, 0, W, H_);
|
|
239
|
+
// rules
|
|
240
|
+
for (let y = RULE0; y < H_; y += RS) {
|
|
241
|
+
ctx.fillStyle = 'rgba(110,160,215,0.75)'; ctx.fillRect(0, y, W, 1.2);
|
|
242
|
+
ctx.fillStyle = 'rgba(110,160,215,0.18)'; ctx.fillRect(0, y + 1.2, W, 0.8);
|
|
243
|
+
}
|
|
244
|
+
ctx.fillStyle = 'rgba(225,95,105,0.8)'; ctx.fillRect(MX, 0, 1.6, H_);
|
|
245
|
+
ctx.fillStyle = 'rgba(225,95,105,0.3)'; ctx.fillRect(MX + 1.6, 0, 1, H_);
|
|
246
|
+
|
|
247
|
+
// ---------- tone map (what the hatching reads) ----------
|
|
248
|
+
const TM = H.layer(W, H_), tm = TM.getContext('2d');
|
|
249
|
+
tm.fillStyle = '#000'; tm.fillRect(0, 0, W, H_);
|
|
250
|
+
const gray = (v) => `rgb(${(v * 255) | 0},0,0)`;
|
|
251
|
+
|
|
252
|
+
// rocket frame
|
|
253
|
+
const RX = 760, RY = 400, RA = 0.52, SC = 0.86;
|
|
254
|
+
const toW = ([x, y]) => {
|
|
255
|
+
const c = Math.cos(RA), s = Math.sin(RA);
|
|
256
|
+
return [RX + (x * c - y * s) * SC, RY + (x * s + y * c) * SC];
|
|
257
|
+
};
|
|
258
|
+
const local = (fn) => { tm.save(); tm.translate(RX, RY); tm.rotate(RA); tm.scale(SC, SC); fn(); tm.restore(); };
|
|
259
|
+
|
|
260
|
+
// smoke clouds (world coords), back to front
|
|
261
|
+
const clouds = [];
|
|
262
|
+
{
|
|
263
|
+
const rr = H.rng(4);
|
|
264
|
+
const base = [[420, 640, 70], [330, 610, 58], [520, 668, 64], [260, 670, 54], [450, 560, 52], [600, 640, 46], [370, 690, 60], [520, 600, 40], [300, 560, 38]];
|
|
265
|
+
base.forEach(([x, y, r]) => clouds.push([x + rr.range(-6, 6), y + rr.range(-6, 6), r]));
|
|
266
|
+
}
|
|
267
|
+
// flame direction: rocket local +y
|
|
268
|
+
const fl0 = toW([0, 190]), fl1 = toW([0, 330]);
|
|
269
|
+
clouds.forEach(([x, y, r]) => {
|
|
270
|
+
const g = tm.createRadialGradient(x - r * 0.35, y - r * 0.45, r * 0.1, x, y, r);
|
|
271
|
+
g.addColorStop(0, gray(0.0)); g.addColorStop(0.55, gray(0.22)); g.addColorStop(0.85, gray(0.55)); g.addColorStop(1, gray(0.7));
|
|
272
|
+
tm.fillStyle = g; tm.beginPath(); tm.arc(x, y, r, 0, 7); tm.fill();
|
|
273
|
+
});
|
|
274
|
+
local(() => {
|
|
275
|
+
// body
|
|
276
|
+
const bg = tm.createLinearGradient(-62, 0, 62, 0);
|
|
277
|
+
bg.addColorStop(0, gray(0.3)); bg.addColorStop(0.18, gray(0.06)); bg.addColorStop(0.42, gray(0.12)); bg.addColorStop(0.75, gray(0.6)); bg.addColorStop(0.93, gray(0.9)); bg.addColorStop(1, gray(0.72));
|
|
278
|
+
tm.fillStyle = bg;
|
|
279
|
+
tm.beginPath(); tm.moveTo(-62, -150); tm.bezierCurveTo(-62, -230, -30, -280, 0, -300); tm.bezierCurveTo(30, -280, 62, -230, 62, -150);
|
|
280
|
+
tm.lineTo(60, 130); tm.lineTo(-60, 130); tm.closePath(); tm.fill();
|
|
281
|
+
// painted band + nose cap
|
|
282
|
+
tm.save(); tm.clip();
|
|
283
|
+
const bg2 = tm.createLinearGradient(-62, 0, 62, 0);
|
|
284
|
+
bg2.addColorStop(0, gray(0.65)); bg2.addColorStop(0.2, gray(0.5)); bg2.addColorStop(0.75, gray(0.85)); bg2.addColorStop(1, gray(0.95));
|
|
285
|
+
tm.fillStyle = bg2; tm.fillRect(-70, -310, 140, 92); tm.fillRect(-70, 54, 140, 30);
|
|
286
|
+
tm.restore();
|
|
287
|
+
// fins
|
|
288
|
+
tm.fillStyle = gray(0.55);
|
|
289
|
+
tm.beginPath(); tm.moveTo(-60, 20); tm.quadraticCurveTo(-120, 80, -126, 186); tm.lineTo(-60, 136); tm.closePath(); tm.fill();
|
|
290
|
+
tm.fillStyle = gray(0.92);
|
|
291
|
+
tm.beginPath(); tm.moveTo(60, 20); tm.quadraticCurveTo(120, 80, 126, 186); tm.lineTo(60, 136); tm.closePath(); tm.fill();
|
|
292
|
+
tm.fillStyle = gray(0.8); tm.fillRect(-7, 60, 14, 140);
|
|
293
|
+
// nozzle
|
|
294
|
+
const ng = tm.createLinearGradient(-44, 0, 44, 0); ng.addColorStop(0, gray(0.6)); ng.addColorStop(1, gray(0.97));
|
|
295
|
+
tm.fillStyle = ng; tm.beginPath(); tm.moveTo(-34, 130); tm.lineTo(34, 130); tm.lineTo(46, 172); tm.lineTo(-46, 172); tm.closePath(); tm.fill();
|
|
296
|
+
// window
|
|
297
|
+
tm.fillStyle = gray(0.5); tm.beginPath(); tm.arc(0, -60, 34, 0, 7); tm.fill();
|
|
298
|
+
tm.fillStyle = gray(0.95); tm.beginPath(); tm.arc(0, -60, 25, 0, 7); tm.fill();
|
|
299
|
+
tm.fillStyle = gray(0.0); tm.beginPath(); tm.ellipse(-9, -70, 9, 5, -0.6, 0, 7); tm.fill();
|
|
300
|
+
// flame: lightly hatched outer glow only
|
|
301
|
+
tm.fillStyle = gray(0.0); tm.beginPath(); tm.moveTo(-40, 176); tm.quadraticCurveTo(-46, 260, 0, 350); tm.quadraticCurveTo(46, 260, 40, 176); tm.closePath(); tm.fill();
|
|
302
|
+
});
|
|
303
|
+
// moon
|
|
304
|
+
const MXc = 1120, MYc = 150, MR = 74;
|
|
305
|
+
{
|
|
306
|
+
const g = tm.createRadialGradient(MXc - 30, MYc - 30, 10, MXc, MYc, MR);
|
|
307
|
+
g.addColorStop(0, gray(0.05)); g.addColorStop(0.6, gray(0.3)); g.addColorStop(1, gray(0.75));
|
|
308
|
+
tm.fillStyle = g; tm.beginPath(); tm.arc(MXc, MYc, MR, 0, 7); tm.fill();
|
|
309
|
+
[[MXc + 22, MYc - 18, 16], [MXc - 26, MYc + 26, 12], [MXc + 30, MYc + 34, 9], [MXc - 10, MYc - 36, 7]].forEach(([x, y, r]) => {
|
|
310
|
+
tm.fillStyle = gray(0.72); tm.beginPath(); tm.arc(x, y, r, 0, 7); tm.fill();
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
const tmd = tm.getImageData(0, 0, W, H_).data;
|
|
314
|
+
const tone = (x, y) => {
|
|
315
|
+
x |= 0; y |= 0; if (x < 0 || y < 0 || x >= W || y >= H_) return 0;
|
|
316
|
+
return tmd[(y * W + x) * 4] / 255;
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
// ---------- ballpoint primitives ----------
|
|
320
|
+
ctx.save();
|
|
321
|
+
ctx.globalCompositeOperation = 'multiply';
|
|
322
|
+
ctx.lineCap = 'round'; ctx.lineJoin = 'round';
|
|
323
|
+
const win = (a, b) => H.clamp((t - a) / (b - a));
|
|
324
|
+
let PH = null, TIP = null;
|
|
325
|
+
const seq = (t0, dt, dur) => { PH = { t0, dt, dur: dur || dt * 2, k: 0 }; };
|
|
326
|
+
const bp = (pts, seed, w = 1.3, a = 0.85, blob = true) => {
|
|
327
|
+
if (pts.length < 2) return;
|
|
328
|
+
if (PH) {
|
|
329
|
+
const k = PH.k++, gate = H.clamp((t - (PH.t0 + k * PH.dt)) / PH.dur);
|
|
330
|
+
if (gate <= 0) return;
|
|
331
|
+
if (gate < 1) { pts = pts.slice(0, Math.max(2, Math.ceil(pts.length * gate))); TIP = pts[pts.length - 1]; }
|
|
332
|
+
}
|
|
333
|
+
const n = pts.length;
|
|
334
|
+
const rr = H.rng(seed);
|
|
335
|
+
let skip = rr.chance(0.25) ? Math.floor(rr.range(0.2, 0.8) * n) : -1;
|
|
336
|
+
for (let i = 0; i < n - 1; i += 2) {
|
|
337
|
+
if (skip >= 0 && i >= skip && i < skip + 3) continue; // ink skipped
|
|
338
|
+
const u = i / (n - 1);
|
|
339
|
+
const pr = 0.62 + 0.38 * (0.5 + 0.5 * nz.n2(i * 0.05 + seed * 0.3, seed * 0.11));
|
|
340
|
+
const taper = Math.min(1, (1 - u) * 6 + 0.35);
|
|
341
|
+
ctx.strokeStyle = H.rgba(INK, a * pr * taper); ctx.lineWidth = w * (0.75 + 0.35 * pr);
|
|
342
|
+
ctx.beginPath(); ctx.moveTo(pts[i][0], pts[i][1]); ctx.lineTo(pts[i + 1][0], pts[i + 1][1]);
|
|
343
|
+
if (pts[i + 2]) ctx.lineTo(pts[i + 2][0], pts[i + 2][1]);
|
|
344
|
+
ctx.stroke();
|
|
345
|
+
}
|
|
346
|
+
if (blob && rr.chance(0.6)) {
|
|
347
|
+
ctx.fillStyle = H.rgba(INK, 0.9); ctx.beginPath(); ctx.arc(pts[0][0] + 0.3, pts[0][1], w * rr.range(1.0, 1.8), 0, 7); ctx.fill();
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
const line = (pts, seed, w = 1.4, a = 0.9, amp = 0.8, passes = 1) => {
|
|
351
|
+
for (let k = 0; k < passes; k++) bp(wob(seg(pts), nz, seed + k * 13, amp + k * 0.4), seed + k * 7, w, a);
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
// ---------- hatching from tone map ----------
|
|
355
|
+
const hatch = (ang, sp, thr, seed, a, t0, t1, region = [0, 0, W, H_]) => {
|
|
356
|
+
const rr = H.rng(seed), ca = Math.cos(ang), sa = Math.sin(ang);
|
|
357
|
+
const [x0, y0, x1, y1] = region, mx = (x0 + x1) / 2, my = (y0 + y1) / 2, ext = Math.hypot(x1 - x0, y1 - y0) / 2;
|
|
358
|
+
const pr = win(t0, t1); if (pr <= 0) return;
|
|
359
|
+
const oMax = -ext + 2 * ext * pr;
|
|
360
|
+
for (let o = -ext; o < ext; o += sp * (0.85 + rr() * 0.3)) {
|
|
361
|
+
if (o > oMax) break;
|
|
362
|
+
const ox = mx - sa * o, oy = my + ca * o;
|
|
363
|
+
let run = [];
|
|
364
|
+
const flush = () => {
|
|
365
|
+
let i = 0;
|
|
366
|
+
while (i < run.length - 3) {
|
|
367
|
+
const len = Math.floor(rr.range(8, 24));
|
|
368
|
+
const part = run.slice(i, i + len);
|
|
369
|
+
if (part.length > 2) {
|
|
370
|
+
const jx = rr.range(-0.8, 0.8), jy = rr.range(-0.8, 0.8);
|
|
371
|
+
bp(part.map(([x, y]) => [x + jx, y + jy]), seed * 31 + i + (o | 0) * 7, rr.range(0.9, 1.25), a * rr.range(0.75, 1.1), rr.chance(0.1));
|
|
372
|
+
if (pr < 1) TIP = part[part.length - 1];
|
|
373
|
+
}
|
|
374
|
+
i += len - Math.floor(rr.range(-1, 2));
|
|
375
|
+
}
|
|
376
|
+
run = [];
|
|
377
|
+
};
|
|
378
|
+
for (let s = -ext; s < ext; s += 2.5) {
|
|
379
|
+
const x = ox + ca * s, y = oy + sa * s;
|
|
380
|
+
if (x < x0 || x > x1 || y < y0 || y > y1) { flush(); continue; }
|
|
381
|
+
const v = tone(x, y) + nz.n2(x * 0.03, y * 0.03) * 0.05;
|
|
382
|
+
if (v > thr) run.push([x, y]); else flush();
|
|
383
|
+
}
|
|
384
|
+
flush();
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
hatch(-0.85, 5.0, 0.16, 1, 0.7, 2.3, 3.1);
|
|
388
|
+
hatch(0.72, 4.8, 0.4, 2, 0.7, 2.8, 3.5);
|
|
389
|
+
hatch(-0.12, 4.2, 0.58, 3, 0.75, 3.2, 3.8);
|
|
390
|
+
hatch(1.32, 3.8, 0.74, 4, 0.8, 3.5, 4.0);
|
|
391
|
+
hatch(-0.5, 3.2, 0.84, 5, 0.85, 3.75, 4.2);
|
|
392
|
+
hatch(0.25, 2.8, 0.9, 6, 0.9, 3.95, 4.35);
|
|
393
|
+
|
|
394
|
+
// ---------- contours ----------
|
|
395
|
+
const L = (pts) => pts.map(toW);
|
|
396
|
+
seq(1.0, 0.04);
|
|
397
|
+
// rocket outline (double-traced like a real pen doodle)
|
|
398
|
+
line(L(bez([-62, -150], [-62, -230], [-30, -280], [0, -300])), 10, 1.6, 0.95, 0.6, 2);
|
|
399
|
+
line(L(bez([0, -300], [30, -280], [62, -230], [62, -150])), 11, 1.6, 0.95, 0.6, 2);
|
|
400
|
+
line(L([[-62, -150], [-60, 130]]), 12, 1.6, 0.95, 0.8, 2);
|
|
401
|
+
line(L([[62, -150], [60, 130]]), 13, 1.7, 0.95, 0.8, 2);
|
|
402
|
+
line(L(ell(0, -218, 54, 9, 0.05, Math.PI - 0.05)), 14, 1.3, 0.9, 0.4);
|
|
403
|
+
line(L(ell(0, -150, 62, 11, 0.02, Math.PI - 0.02)), 15, 1.4, 0.9, 0.4);
|
|
404
|
+
line(L(ell(0, 54, 61, 11, 0.02, Math.PI - 0.02)), 16, 1.3, 0.9, 0.4);
|
|
405
|
+
line(L(ell(0, 84, 61, 11, 0.02, Math.PI - 0.02)), 17, 1.3, 0.9, 0.4);
|
|
406
|
+
line(L(ell(0, 130, 60, 10, 0.02, Math.PI - 0.02)), 18, 1.5, 0.95, 0.4);
|
|
407
|
+
line(L(ell(0, -60, 34, 34)), 19, 1.5, 0.95, 0.5, 2);
|
|
408
|
+
line(L(ell(0, -60, 25, 25)), 20, 1.3, 0.9, 0.4);
|
|
409
|
+
// rivets
|
|
410
|
+
for (let k = -4; k <= (t > 1.6 ? 4 : -5); k++) {
|
|
411
|
+
const p = toW([k * 13, -134 + Math.cos(k * 0.35) * 8]);
|
|
412
|
+
ctx.fillStyle = H.rgba(INK, 0.9); ctx.beginPath(); ctx.arc(p[0], p[1], 1.6, 0, 7); ctx.fill();
|
|
413
|
+
}
|
|
414
|
+
line(L([[-60, 20], [-92, 52], [-118, 110], [-126, 186], [-60, 136]]), 21, 1.6, 0.95, 0.6, 2);
|
|
415
|
+
line(L([[60, 20], [92, 52], [118, 110], [126, 186], [60, 136]]), 22, 1.6, 0.95, 0.6, 2);
|
|
416
|
+
line(L([[-7, 62], [-7, 200], [7, 200], [7, 62]]), 23, 1.4, 0.9, 0.4);
|
|
417
|
+
line(L([[-34, 132], [-46, 172], [46, 172], [34, 132]]), 24, 1.5, 0.95, 0.5, 2);
|
|
418
|
+
// flame
|
|
419
|
+
line(L(bez([-40, 176], [-50, 250], [-20, 300], [0, 352])), 25, 1.4, 0.9, 1.2);
|
|
420
|
+
line(L(bez([0, 352], [20, 300], [50, 250], [40, 176])), 26, 1.4, 0.9, 1.2);
|
|
421
|
+
line(L(bez([-22, 178], [-26, 230], [-8, 262], [0, 292])), 27, 1.2, 0.85, 1);
|
|
422
|
+
line(L(bez([0, 292], [8, 262], [26, 230], [22, 178])), 28, 1.2, 0.85, 1);
|
|
423
|
+
line(L([[-14, 204], [-10, 240]]), 29, 1, 0.7);
|
|
424
|
+
line(L([[10, 210], [6, 236]]), 30, 1, 0.7);
|
|
425
|
+
|
|
426
|
+
seq(2.2, 0.025);
|
|
427
|
+
// clouds: draw each puff's visible arc (not hidden by puffs in front)
|
|
428
|
+
clouds.forEach(([x, y, r], i) => {
|
|
429
|
+
const pts = [];
|
|
430
|
+
let runs = [], cur = [];
|
|
431
|
+
for (let k = 0; k <= 120; k++) {
|
|
432
|
+
const a = k / 120 * Math.PI * 2, rw = r * (1 + 0.035 * Math.sin(a * (5 + (i % 4)) + i * 2) + 0.05 * nz.n2(a * 1.5 + i, i * 3.1)), px = x + Math.cos(a) * rw, py = y + Math.sin(a) * rw;
|
|
433
|
+
let hidden = false;
|
|
434
|
+
for (let j = i + 1; j < clouds.length; j++) { const c = clouds[j]; if (Math.hypot(px - c[0], py - c[1]) < c[2] - 1) { hidden = true; break; } }
|
|
435
|
+
// also hidden behind the flame
|
|
436
|
+
if (!hidden) cur.push([px, py]); else if (cur.length) { runs.push(cur); cur = []; }
|
|
437
|
+
}
|
|
438
|
+
if (cur.length) runs.push(cur);
|
|
439
|
+
runs.forEach((rn, k) => { if (rn.length > 2 && rn[0][1] < H_ + 20) line(rn, 200 + i * 10 + k, 1.4, 0.9, 1.0); });
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
// moon
|
|
443
|
+
seq(2.6, 0.045);
|
|
444
|
+
line(ell(MXc, MYc, MR, MR, -1, 5.4), 300, 1.5, 0.95, 0.8, 2);
|
|
445
|
+
[[MXc + 22, MYc - 18, 16], [MXc - 26, MYc + 26, 12], [MXc + 30, MYc + 34, 9], [MXc - 10, MYc - 36, 7]].forEach(([x, y, r], i) => line(ell(x, y, r, r * 0.9, 0.3, 6.9), 310 + i, 1.2, 0.9, 0.4));
|
|
446
|
+
// little flag on the moon
|
|
447
|
+
line([[MXc - 40, MYc - 60], [MXc - 52, MYc - 116]], 320, 1.4, 0.95, 0.4);
|
|
448
|
+
line([[MXc - 52, MYc - 116], [MXc - 18, MYc - 112], [MXc - 26, MYc - 98], [MXc - 46, MYc - 92]], 321, 1.3, 0.9, 0.5);
|
|
449
|
+
|
|
450
|
+
// speed lines + sparkles
|
|
451
|
+
seq(2.95, 0.02);
|
|
452
|
+
[[-150, -70, 40], [-170, 0, 90], [-120, -190, -110], [150, -100, 0], [170, 10, 80]].forEach(([x, y0, y1], i) => line(L([[x, y0], [x, y1]]), 400 + i, 1.2, 0.85, 0.5));
|
|
453
|
+
const sparkle = (x, y, s, seed) => {
|
|
454
|
+
line([[x - s, y], [x + s, y]], seed, 1.2, 0.9, 0.3); line([[x, y - s], [x, y + s]], seed + 1, 1.2, 0.9, 0.3);
|
|
455
|
+
line([[x - s * 0.5, y - s * 0.5], [x + s * 0.5, y + s * 0.5]], seed + 2, 1, 0.7, 0.2);
|
|
456
|
+
line([[x - s * 0.5, y + s * 0.5], [x + s * 0.5, y - s * 0.5]], seed + 3, 1, 0.7, 0.2);
|
|
457
|
+
};
|
|
458
|
+
sparkle(960, 300, 12, 500); sparkle(1180, 330, 9, 504); sparkle(1010, 120, 8, 508); sparkle(920, 470, 7, 512); sparkle(1220, 520, 10, 516);
|
|
459
|
+
[[1050, 400], [1150, 440], [880, 160], [1230, 260], [990, 560]].forEach(([x, y], i) => { if (t < 3.3 + i * 0.05) return; ctx.fillStyle = H.rgba(INK, 0.9); ctx.beginPath(); ctx.arc(x, y, 2 + (i % 2), 0, 7); ctx.fill(); });
|
|
460
|
+
|
|
461
|
+
// ---------- margin doodles ----------
|
|
462
|
+
// star traced over and over
|
|
463
|
+
const star = (x, y, R, seed, passes) => {
|
|
464
|
+
const pts = [];
|
|
465
|
+
for (let k = 0; k <= 5; k++) { const a = -Math.PI / 2 + k * Math.PI * 4 / 5; pts.push([x + Math.cos(a) * R, y + Math.sin(a) * R]); }
|
|
466
|
+
line(pts, seed, 1.4, 0.9, 1.2, passes);
|
|
467
|
+
};
|
|
468
|
+
const tipBefore = TIP;
|
|
469
|
+
seq(0.3, 1.15, 0.35); star(118, 236, 30, 600, 5);
|
|
470
|
+
seq(1.9, 1.2, 0.3); star(94, 690, 16, 610, 4);
|
|
471
|
+
seq(0.6, 0.05, 0.12);
|
|
472
|
+
// Necker cube with a hatched face
|
|
473
|
+
{
|
|
474
|
+
const x = 90, y = 410, s = 46, d = 22;
|
|
475
|
+
const F = [[x, y], [x + s, y], [x + s, y + s], [x, y + s], [x, y]], B = F.map(([a, b]) => [a + d, b - d]);
|
|
476
|
+
line(F, 620, 1.4, 0.9, 0.6, 2); line(B, 621, 1.4, 0.9, 0.6, 2);
|
|
477
|
+
for (let k = 0; k < 4; k++) line([F[k], B[k]], 622 + k, 1.3, 0.9, 0.4);
|
|
478
|
+
for (let k = 3; k < d; k += 3.2) line([[x + s + k, y - k + 2], [x + s + k, y + s - k - 2]], 630 + k * 3, 1.1, 0.8, 0.3);
|
|
479
|
+
}
|
|
480
|
+
// spirals
|
|
481
|
+
const spiral = (x, y, R, turns, seed) => {
|
|
482
|
+
const pts = [];
|
|
483
|
+
for (let k = 0; k <= turns * 60; k++) { const a = k / 60 * Math.PI * 2, rad = R * k / (turns * 60); pts.push([x + Math.cos(a) * rad, y + Math.sin(a) * rad]); }
|
|
484
|
+
line(pts, seed, 1.3, 0.9, 0.5);
|
|
485
|
+
};
|
|
486
|
+
seq(1.3, 0.1, 0.45); spiral(112, 560, 30, 4, 640);
|
|
487
|
+
seq(4.4, 0.1, 0.4); spiral(1210, 650, 22, 3, 641);
|
|
488
|
+
// zigzag arrow
|
|
489
|
+
seq(1.85, 0.1, 0.25); line([[88, 320], [104, 304], [120, 322], [136, 306], [150, 322]], 650, 1.3, 0.9, 0.4);
|
|
490
|
+
PH = null; if (tipBefore) TIP = tipBefore;
|
|
491
|
+
// ---------- bubble lettering ----------
|
|
492
|
+
ctx.restore();
|
|
493
|
+
{
|
|
494
|
+
const TX = 200, TY = 160, txt = 'TO THE MOON';
|
|
495
|
+
const font = '700 92px "Fredoka"';
|
|
496
|
+
const M = H.layer(W, H_), mc = M.getContext('2d');
|
|
497
|
+
mc.font = font;
|
|
498
|
+
const glyphs = []; { let px = 0; const rj = H.rng(71); for (const ch of txt) { glyphs.push([ch, px, rj.range(-3, 3), rj.range(-0.05, 0.05)]); px += mc.measureText(ch).width + (ch === ' ' ? -4 : 7); } }
|
|
499
|
+
const gT = (i) => 0.1 + i * 0.075;
|
|
500
|
+
const drawGlyphs = (c, fn, lag = 0) => glyphs.forEach(([ch, px, dy, rot], i) => { if (ch === ' ' || t < gT(i) + lag) return; c.save(); c.translate(px, dy); c.rotate(rot); fn(ch); c.restore(); });
|
|
501
|
+
mc.font = font; mc.fillStyle = '#000';
|
|
502
|
+
mc.save(); mc.translate(TX + 8, TY + 8); mc.rotate(-0.03); drawGlyphs(mc, (ch) => mc.fillText(ch, 0, 0)); mc.restore();
|
|
503
|
+
mc.globalCompositeOperation = 'destination-out';
|
|
504
|
+
mc.save(); mc.translate(TX, TY); mc.rotate(-0.03); mc.lineWidth = 3; drawGlyphs(mc, (ch) => { mc.fillText(ch, 0, 0); mc.strokeText(ch, 0, 0); }); mc.restore();
|
|
505
|
+
const HL = H.layer(W, H_), hc = HL.getContext('2d'), rr = H.rng(70);
|
|
506
|
+
hc.strokeStyle = H.rgba(INK, 0.85); hc.lineCap = 'round';
|
|
507
|
+
for (let o = -200; o < 900; o += 3.4) {
|
|
508
|
+
hc.lineWidth = rr.range(0.9, 1.4); hc.globalAlpha = rr.range(0.7, 1);
|
|
509
|
+
hc.beginPath(); hc.moveTo(TX + o, TY + 20); hc.lineTo(TX + o + 110, TY - 100); hc.stroke();
|
|
510
|
+
}
|
|
511
|
+
hc.globalAlpha = 1; hc.globalCompositeOperation = 'destination-in'; hc.drawImage(M, 0, 0);
|
|
512
|
+
{ const sw = TX - 20 + 760 * win(1.0, 1.6); hc.globalCompositeOperation = 'destination-out'; hc.fillRect(sw, 0, W, H_); if (t > 1.0 && t < 1.6) TIP = [sw, TY - 10]; }
|
|
513
|
+
ctx.save(); ctx.globalCompositeOperation = 'multiply'; ctx.drawImage(HL, 0, 0); ctx.restore();
|
|
514
|
+
// outlines traced twice
|
|
515
|
+
ctx.save(); ctx.globalCompositeOperation = 'multiply'; ctx.font = font;
|
|
516
|
+
[[0, 0, 2.0, 1.0, 0], [0.8, -0.6, 1.3, 0.85, 0.12], [-0.5, 0.4, 1.0, 0.6, 0.6]].forEach(([dx, dy, w, a, lag]) => {
|
|
517
|
+
ctx.save(); ctx.translate(TX + dx, TY + dy); ctx.rotate(-0.03);
|
|
518
|
+
ctx.strokeStyle = H.rgba(INK, a); ctx.lineWidth = w; ctx.lineJoin = 'round'; drawGlyphs(ctx, (ch) => ctx.strokeText(ch, 0, 0), lag); ctx.restore();
|
|
519
|
+
});
|
|
520
|
+
const gi = glyphs.findIndex((_, i) => t < gT(i));
|
|
521
|
+
if (gi > 0 && t < gT(glyphs.length - 1) + 0.08) TIP = [TX + glyphs[gi - 1][1] + 40, TY - 20];
|
|
522
|
+
ctx.restore();
|
|
523
|
+
}
|
|
524
|
+
// handwritten note on the rules
|
|
525
|
+
ctx.save(); ctx.globalCompositeOperation = 'multiply';
|
|
526
|
+
ctx.font = '400 28px "Gloria Hallelujah"'; ctx.fillStyle = H.rgba(INK, 0.88);
|
|
527
|
+
{ const note = 'v1.0 ships friday!!', nc = Math.ceil(note.length * win(4.2, 4.75)), part = note.slice(0, nc);
|
|
528
|
+
ctx.save(); ctx.translate(890, RULE0 + RS * 17 - 6); ctx.rotate(-0.012); ctx.fillText(part, 0, 0);
|
|
529
|
+
if (nc > 0 && nc < note.length) TIP = [890 + ctx.measureText(part).width, RULE0 + RS * 17 - 14];
|
|
530
|
+
ctx.restore(); }
|
|
531
|
+
ctx.restore();
|
|
532
|
+
|
|
533
|
+
// ---------- hole punches (desk shows through) ----------
|
|
534
|
+
[120, 360, 600].forEach((y) => {
|
|
535
|
+
const x = 54, r = 17;
|
|
536
|
+
ctx.save();
|
|
537
|
+
ctx.beginPath(); ctx.arc(x, y, r, 0, 7); ctx.clip();
|
|
538
|
+
const dg = ctx.createLinearGradient(0, y - r, 0, y + r);
|
|
539
|
+
dg.addColorStop(0, '#5a3e2a'); dg.addColorStop(1, '#7a5638');
|
|
540
|
+
ctx.fillStyle = dg; ctx.fillRect(x - r, y - r, r * 2, r * 2);
|
|
541
|
+
// paper thickness shadow inside top-left
|
|
542
|
+
ctx.strokeStyle = 'rgba(0,0,0,0.35)'; ctx.lineWidth = 6; ctx.beginPath(); ctx.arc(x + 2, y + 3, r, 0, 7); ctx.stroke();
|
|
543
|
+
ctx.restore();
|
|
544
|
+
ctx.strokeStyle = 'rgba(255,255,255,0.8)'; ctx.lineWidth = 1; ctx.beginPath(); ctx.arc(x, y, r + 0.5, 0.2, 2.6); ctx.stroke();
|
|
545
|
+
ctx.strokeStyle = 'rgba(120,110,95,0.25)'; ctx.lineWidth = 1; ctx.beginPath(); ctx.arc(x, y, r + 1.5, 3.4, 5.9); ctx.stroke();
|
|
546
|
+
});
|
|
547
|
+
|
|
548
|
+
// ---------- the ballpoint pen while drawing ----------
|
|
549
|
+
if (TIP && t < 4.85) {
|
|
550
|
+
const [tx, ty] = TIP, ang = 0.85, len = 280;
|
|
551
|
+
ctx.save();
|
|
552
|
+
ctx.save(); ctx.filter = 'blur(6px)'; ctx.fillStyle = 'rgba(40,40,60,0.25)'; ctx.translate(tx + 18, ty + 22); ctx.rotate(ang + 0.04); ctx.beginPath(); ctx.roundRect(20, -7, len, 14, 6); ctx.fill(); ctx.restore();
|
|
553
|
+
ctx.translate(tx, ty); ctx.rotate(ang);
|
|
554
|
+
ctx.fillStyle = '#b8b8b0'; ctx.beginPath(); ctx.arc(0.5, 0, 1.4, 0, 7); ctx.fill();
|
|
555
|
+
const cg = ctx.createLinearGradient(0, -6, 0, 6); cg.addColorStop(0, '#ffffff'); cg.addColorStop(1, '#c9c9c2');
|
|
556
|
+
ctx.fillStyle = cg; ctx.beginPath(); ctx.moveTo(1.5, -1.5); ctx.lineTo(26, -6.5); ctx.lineTo(26, 6.5); ctx.lineTo(1.5, 1.5); ctx.closePath(); ctx.fill();
|
|
557
|
+
const bgr = ctx.createLinearGradient(0, -8, 0, 8); bgr.addColorStop(0, 'rgba(250,252,255,0.95)'); bgr.addColorStop(0.5, 'rgba(215,222,232,0.92)'); bgr.addColorStop(1, 'rgba(160,170,185,0.95)');
|
|
558
|
+
ctx.fillStyle = bgr; ctx.fillRect(26, -8, len - 50, 16);
|
|
559
|
+
ctx.fillStyle = 'rgba(30,46,150,0.85)'; ctx.fillRect(30, -1.8, len - 70, 3.6);
|
|
560
|
+
ctx.fillStyle = 'rgba(255,255,255,0.8)'; ctx.fillRect(30, -6, len - 60, 1.5);
|
|
561
|
+
ctx.fillStyle = '#2c3fa8'; ctx.beginPath(); ctx.roundRect(len - 26, -7, 26, 14, 4); ctx.fill();
|
|
562
|
+
ctx.restore();
|
|
563
|
+
}
|
|
564
|
+
H.grain(ctx, W, H_, 0.025, 4 + (Math.floor(t * 12) % 4));
|
|
565
|
+
H.vignette(ctx, W, H_, 0.12, '60,50,40');
|
|
566
|
+
},
|
|
567
|
+
// >>>EXPLAINER
|
|
568
|
+
explainerDuration: 15,
|
|
569
|
+
explainerNote: 'Doodled down one long college-ruled page: the pen draws while the camera scrolls along and then down the page, headings are bubble letters with crosshatched shadows, boxes get hatched drop-shadows, a red pen marks the wrong guess, and counters are re-inked in bubble numerals.',
|
|
570
|
+
explainer(ctx, W, H_, t) {
|
|
571
|
+
const nz = H.makeNoise(57);
|
|
572
|
+
const BLUE = [30, 46, 150], RED = [178, 28, 38];
|
|
573
|
+
const D = [2560, 1520];
|
|
574
|
+
const L = {
|
|
575
|
+
D, pT: 10.95, kT: 13.05, modelName: 'robot brain',
|
|
576
|
+
bridge: { pts: XE.cubic([2760, 1000], [2900, 1120], [2860, 1250], [2700, 1330]), a: 10.15, b: 10.6, label: 'repeat x1000', lx: 2960, ly: 1300 },
|
|
577
|
+
model: (cx, cy, adj, push, api, tt) => {
|
|
578
|
+
const g = 'M';
|
|
579
|
+
api.line(XE.rrect(cx - 150, cy - 140, 300, 280, 26), 'ink', 5, 2.5, 2.8, g);
|
|
580
|
+
api.line([[cx + 90, cy - 140], [cx + 96, cy - 185]], 'ink', 4, 2.8, 2.85, g);
|
|
581
|
+
api.line(XE.circ(cx + 97, cy - 197, 12, 12), 'ink', 4, 2.85, 2.92, g);
|
|
582
|
+
[-1, 1].forEach((s, i) => {
|
|
583
|
+
api.line(XE.circ(cx + s * 62, cy - 55, 32, 32, -1.4, 5.0), 'ink', 4.5, 2.9 + i * 0.06, 2.98 + i * 0.06, g);
|
|
584
|
+
api.dot(cx + s * 62 + 8, cy - 50, 9, 'ink', 3.0, g);
|
|
585
|
+
api.line(XE.rrect(cx + s * 150 - (s > 0 ? 0 : 16), cy - 50, 16, 70, 5), 'ink', 4, 3.0 + i * 0.04, 3.06 + i * 0.04, g);
|
|
586
|
+
});
|
|
587
|
+
api.line(XE.rrect(cx - 70, cy + 6, 140, 34, 8), 'ink', 4, 3.05, 3.12, g);
|
|
588
|
+
for (let k = 1; k < 6; k++) api.line([[cx - 70 + k * 23, cy + 8], [cx - 70 + k * 23, cy + 38]], 'ink', 3, 3.12 + k * 0.01, 3.14 + k * 0.01, g);
|
|
589
|
+
[-1, 0, 1].forEach((k, i) => {
|
|
590
|
+
const x = cx + k * 70, y = cy + 92;
|
|
591
|
+
api.line(XE.circ(x, y, 22, 22, -1.2, 5.2), 'ink', 4, 3.12 + i * 0.04, 3.2 + i * 0.04, g);
|
|
592
|
+
if (tt > 3.2 + i * 0.04) {
|
|
593
|
+
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;
|
|
594
|
+
push({ k: 'line', pts: [[x, y], [x + Math.cos(a) * 18, y + Math.sin(a) * 18]], role: adj > 0 && adj < 1 ? 'acc2' : 'ink', w: 5, a: -1, b: 0, inst: true, g });
|
|
595
|
+
}
|
|
596
|
+
});
|
|
597
|
+
},
|
|
598
|
+
};
|
|
599
|
+
const items = XE.story(t, L);
|
|
600
|
+
const cam = XE.camAt([[0, 640, 360, 1.0], [2.0, 650, 362, 1.05], [2.8, 1830, 610, 0.95], [5.95, 1860, 620, 0.97], [6.55, 2580, 640, 0.9], [10.3, 2600, 660, 0.93],
|
|
601
|
+
[11.0, 2560, 1540, 0.92], [12.9, 2570, 1550, 0.95], [13.6, 2560, 1640, 0.88], [15, 2560, 1640, 0.9]], t);
|
|
602
|
+
const z = cam[2];
|
|
603
|
+
const apply = (c) => { c.translate(W / 2, H_ / 2); c.scale(z, z); c.translate(-cam[0], -cam[1]); };
|
|
604
|
+
const toS = ([x, y]) => [(x - cam[0]) * z + W / 2, (y - cam[1]) * z + H_ / 2];
|
|
605
|
+
const vx0 = cam[0] - W / 2 / z, vx1 = cam[0] + W / 2 / z, vy0 = cam[1] - H_ / 2 / z, vy1 = cam[1] + H_ / 2 / z;
|
|
606
|
+
|
|
607
|
+
// ---------- the page ----------
|
|
608
|
+
if (!XC.paper) { const pl = H.layer(1000, 600), pc = pl.getContext('2d'); H.paper(pc, 1000, 600, '#fbfaf5', 12, 0.014); XC.paper = pl; }
|
|
609
|
+
if (!XC.tooth) {
|
|
610
|
+
// tileable paper tooth at 1:1 world scale: horizontal fibre streaks (like H.paper's n2(x*.15, y*.04)) + per-pixel speckle
|
|
611
|
+
const TS = 512, tl = H.layer(TS, TS), tc = tl.getContext('2d'), img = tc.createImageData(TS, TS), d = img.data, rr = H.rng(907);
|
|
612
|
+
const vnoise = (cx, cy, seed) => { // periodic value noise, cx x cy lattice over the tile
|
|
613
|
+
const L = new Float32Array(cx * cy), r2 = H.rng(seed); for (let i = 0; i < L.length; i++) L[i] = r2() * 2 - 1;
|
|
614
|
+
return (x, y) => { const fx = x / TS * cx, fy = y / TS * cy, ix = Math.floor(fx), iy = Math.floor(fy), u = fx - ix, v = fy - iy;
|
|
615
|
+
const su = u * u * (3 - 2 * u), sv = v * v * (3 - 2 * v), x0 = ix % cx, x1 = (ix + 1) % cx, y0 = iy % cy, y1 = (iy + 1) % cy;
|
|
616
|
+
const a = L[y0 * cx + x0], b = L[y0 * cx + x1], c = L[y1 * cx + x0], e = L[y1 * cx + x1];
|
|
617
|
+
return a + (b - a) * su + (c - a + (a - b - c + e) * su) * sv; };
|
|
618
|
+
};
|
|
619
|
+
const fib = vnoise(80, 20, 31), fib2 = vnoise(160, 48, 32), mot = vnoise(8, 8, 33);
|
|
620
|
+
for (let y = 0; y < TS; y++) for (let x = 0; x < TS; x++) {
|
|
621
|
+
const v = fib(x, y) * 0.5 + fib2(x, y) * 0.35 + mot(x, y) * 0.12 + (rr() - 0.5) * 0.8;
|
|
622
|
+
const i = (y * TS + x) * 4; // transparent warm-grey tooth over the base paper (source-over is cheap)
|
|
623
|
+
d[i] = 120; d[i + 1] = 108; d[i + 2] = 88; d[i + 3] = Math.max(0, Math.min(255, (0.016 + v * 0.018) * 255));
|
|
624
|
+
}
|
|
625
|
+
tc.putImageData(img, 0, 0);
|
|
626
|
+
// a few stray paper fibres
|
|
627
|
+
tc.lineCap = 'round';
|
|
628
|
+
for (let i = 0; i < 70; i++) {
|
|
629
|
+
const x = rr() * TS, y = rr() * TS, a = rr.range(-0.4, 0.4) + (rr.chance(0.5) ? 0 : Math.PI / 2) * 0.2, l = rr.range(6, 22);
|
|
630
|
+
tc.strokeStyle = `rgba(150,140,120,${rr.range(0.08, 0.2)})`; tc.lineWidth = rr.range(0.5, 1);
|
|
631
|
+
for (const [ox, oy] of [[0, 0], [-TS, 0], [0, -TS], [-TS, -TS], [TS, 0], [0, TS]]) { tc.beginPath(); tc.moveTo(x + ox, y + oy); tc.quadraticCurveTo(x + ox + Math.cos(a) * l * 0.5 + 2, y + oy + Math.sin(a) * l * 0.5 - 1.5, x + ox + Math.cos(a) * l, y + oy + Math.sin(a) * l); tc.stroke(); }
|
|
632
|
+
}
|
|
633
|
+
XC.tooth = tl;
|
|
634
|
+
}
|
|
635
|
+
ctx.save(); apply(ctx);
|
|
636
|
+
ctx.drawImage(XC.paper, -300, -300, 4000, 2400);
|
|
637
|
+
ctx.fillStyle = ctx.createPattern(XC.tooth, 'repeat'); ctx.fillRect(vx0 - 4, vy0 - 4, vx1 - vx0 + 8, vy1 - vy0 + 8);
|
|
638
|
+
for (let y = Math.ceil((vy0 - 104) / 30) * 30 + 104; y < vy1; y += 30) {
|
|
639
|
+
ctx.fillStyle = 'rgba(110,160,215,0.75)'; ctx.fillRect(vx0, y, vx1 - vx0, 1.3);
|
|
640
|
+
ctx.fillStyle = 'rgba(110,160,215,0.18)'; ctx.fillRect(vx0, y + 1.3, vx1 - vx0, 0.9);
|
|
641
|
+
}
|
|
642
|
+
ctx.fillStyle = 'rgba(225,95,105,0.8)'; ctx.fillRect(168, -400, 1.8, 3000);
|
|
643
|
+
ctx.fillStyle = 'rgba(225,95,105,0.3)'; ctx.fillRect(169.8, -400, 1, 3000);
|
|
644
|
+
// hole punches: the desk shows through, with the paper's cut edge catching light (as in the still)
|
|
645
|
+
[120, 360, 600, 840].forEach((y) => {
|
|
646
|
+
const x = 54, r = 17;
|
|
647
|
+
if (y + r < vy0 - 10 || y - r > vy1 + 10) return;
|
|
648
|
+
ctx.save(); ctx.beginPath(); ctx.arc(x, y, r, 0, 7); ctx.clip();
|
|
649
|
+
const dg = ctx.createLinearGradient(0, y - r, 0, y + r); dg.addColorStop(0, '#5a3e2a'); dg.addColorStop(1, '#7a5638');
|
|
650
|
+
ctx.fillStyle = dg; ctx.fillRect(x - r, y - r, r * 2, r * 2);
|
|
651
|
+
ctx.strokeStyle = 'rgba(0,0,0,0.35)'; ctx.lineWidth = 6; ctx.beginPath(); ctx.arc(x + 2, y + 3, r, 0, 7); ctx.stroke();
|
|
652
|
+
ctx.restore();
|
|
653
|
+
ctx.strokeStyle = 'rgba(255,255,255,0.8)'; ctx.lineWidth = 1; ctx.beginPath(); ctx.arc(x, y, r + 0.5, 0.2, 2.6); ctx.stroke();
|
|
654
|
+
ctx.strokeStyle = 'rgba(120,110,95,0.25)'; ctx.lineWidth = 1; ctx.beginPath(); ctx.arc(x, y, r + 1.5, 3.4, 5.9); ctx.stroke();
|
|
655
|
+
});
|
|
656
|
+
ctx.restore();
|
|
657
|
+
// the still's warm diagonal light falloff (screen space, under the ink)
|
|
658
|
+
{
|
|
659
|
+
const light = ctx.createLinearGradient(0, 0, W, H_);
|
|
660
|
+
light.addColorStop(0, 'rgba(255,255,255,0.0)'); light.addColorStop(1, 'rgba(120,110,90,0.10)');
|
|
661
|
+
ctx.fillStyle = light; ctx.fillRect(0, 0, W, H_);
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
// ---------- ballpoint ----------
|
|
665
|
+
ctx.save(); apply(ctx);
|
|
666
|
+
ctx.globalCompositeOperation = 'multiply'; ctx.lineCap = 'round'; ctx.lineJoin = 'round';
|
|
667
|
+
const bpl = (pts, seed, w, a, rgb, done = true) => {
|
|
668
|
+
const n = pts.length; if (n < 2) return;
|
|
669
|
+
const rr = H.rng(seed);
|
|
670
|
+
const skip = rr.chance(0.25) ? Math.floor(rr.range(0.2, 0.8) * n) : -1;
|
|
671
|
+
for (let i = 0; i < n - 1; i += 2) {
|
|
672
|
+
if (skip >= 0 && i >= skip && i < skip + 2) continue;
|
|
673
|
+
// pressure: slow swell + faster wobble, so long strokes visibly fade and darken like a real Bic
|
|
674
|
+
const nv = 0.5 + 0.5 * (0.75 * nz.n2(i * 0.022 + seed * 0.3, seed * 0.11) + 0.25 * Math.sin(i * 0.19 + seed * 1.7));
|
|
675
|
+
const pr = 0.55 + 0.45 * nv;
|
|
676
|
+
ctx.strokeStyle = H.rgba(rgb, a * pr); ctx.lineWidth = w * (0.7 + 0.42 * pr);
|
|
677
|
+
ctx.beginPath(); ctx.moveTo(pts[i][0], pts[i][1]); ctx.lineTo(pts[i + 1][0], pts[i + 1][1]);
|
|
678
|
+
if (pts[i + 2]) ctx.lineTo(pts[i + 2][0], pts[i + 2][1]);
|
|
679
|
+
ctx.stroke();
|
|
680
|
+
}
|
|
681
|
+
// ink gloops: the ball dumps a blob where it lands, and sometimes where it lifts
|
|
682
|
+
if (rr.chance(0.8)) { const r0 = w * rr.range(1.0, 1.7); ctx.fillStyle = H.rgba(rgb, 0.9); ctx.beginPath(); ctx.ellipse(pts[0][0] + 0.3, pts[0][1], r0, r0 * 0.85, rr() * 3, 0, 7); ctx.fill(); }
|
|
683
|
+
if (done && rr.chance(0.4)) { const q = pts[n - 1]; ctx.fillStyle = H.rgba(rgb, 0.8); ctx.beginPath(); ctx.arc(q[0], q[1], w * 1.2 * rr.range(0.7, 1), 0, 7); ctx.fill(); }
|
|
684
|
+
};
|
|
685
|
+
// interior tonal hatching (the still's tone-map shading, lit from the top-left): a sparse 45deg layer over the
|
|
686
|
+
// lit-to-shadow half, a cross layer on the shadow side, and a third short layer deep in the shadow corner.
|
|
687
|
+
// holes: closed sub-shapes / words inside the shape are left as bare paper, the way a doodler hatches around them.
|
|
688
|
+
const hatchFill = (pts, holes, p, rgb) => {
|
|
689
|
+
if (p <= 0) return;
|
|
690
|
+
let x0 = 1e9, x1 = -1e9, y0 = 1e9, y1 = -1e9; pts.forEach(([x, y]) => { x0 = Math.min(x0, x); x1 = Math.max(x1, x); y0 = Math.min(y0, y); y1 = Math.max(y1, y); });
|
|
691
|
+
const w = x1 - x0, h = y1 - y0, rr = H.rng(((x0 * 11 + y0 * 3) | 0) + 17);
|
|
692
|
+
ctx.save();
|
|
693
|
+
ctx.beginPath(); pts.forEach(([x, y], i) => (i ? ctx.lineTo(x, y) : ctx.moveTo(x, y))); ctx.closePath();
|
|
694
|
+
holes.forEach((hp) => { if (hp.rect) { const [hx, hy, hw, hh] = hp.rect, r = hh / 2; ctx.moveTo(hx + r, hy); ctx.arc(hx + r, hy + r, r, -Math.PI / 2, -Math.PI * 1.5, true); ctx.lineTo(hx + hw - r, hy + hh); ctx.arc(hx + hw - r, hy + r, r, Math.PI / 2, -Math.PI / 2, true); ctx.closePath(); } else { hp.forEach(([x, y], i) => (i ? ctx.lineTo(x, y) : ctx.moveTo(x, y))); ctx.closePath(); } });
|
|
695
|
+
ctx.clip('evenodd');
|
|
696
|
+
// u: 0 at the lit top-left corner .. 1 at the shadow bottom-right corner (lines of constant u run at 45deg)
|
|
697
|
+
const L = w + h, uAt = (x, y) => ((x - x0) + (y - y0)) / L;
|
|
698
|
+
const layer = (dir, uMin, sp, al, lw, pp) => {
|
|
699
|
+
if (pp <= 0) return;
|
|
700
|
+
const groups = [[], [], []];
|
|
701
|
+
if (dir === 0) { // 45deg strokes (constant u), revealed in u order
|
|
702
|
+
for (let o = uMin * L; o < L * (uMin + (1 - uMin) * pp); o += sp * (0.85 + rr() * 0.3)) {
|
|
703
|
+
const c = x0 + y0 + o; // x + y = c
|
|
704
|
+
const ax = Math.max(x0 - 4, c - y1 - 4), bx = Math.min(x1 + 4, c - y0 + 4);
|
|
705
|
+
if (bx - ax < 2) continue;
|
|
706
|
+
let sx = ax; while (sx < bx) { const len = rr.range(26, 70), ex = Math.min(bx, sx + len), j = rr.range(-0.9, 0.9);
|
|
707
|
+
groups[(rr() * 3) | 0].push([sx + j, c - sx, ex + j, c - ex]); sx = ex + rr.range(-3, 1.5); }
|
|
708
|
+
}
|
|
709
|
+
} else { // cross strokes at -45deg (along u), only beyond uMin, revealed from the shadow corner inward
|
|
710
|
+
const cut = x0 + y0 + uMin * L; // clip half-plane x + y > cut
|
|
711
|
+
for (let o = -h; o < w; o += sp * (0.85 + rr() * 0.3)) {
|
|
712
|
+
// line: x - y = x0 - y0 + o
|
|
713
|
+
const k = x0 - y0 + o;
|
|
714
|
+
const sxa = Math.max(x0 - 4, y0 - 4 + k, (cut + k) / 2), sxb = Math.min(x1 + 4, y1 + 4 + k);
|
|
715
|
+
const span = sxb - sxa; if (span < 3) continue;
|
|
716
|
+
const ex = sxa + span * Math.min(1, pp * 1.3);
|
|
717
|
+
let sx = sxa; while (sx < ex) { const len = rr.range(22, 60), e2 = Math.min(ex, sx + len), j = rr.range(-0.9, 0.9);
|
|
718
|
+
groups[(rr() * 3) | 0].push([sx, sx - k + j, e2, e2 - k + j]); sx = e2 + rr.range(-3, 1.5); }
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
ctx.lineWidth = lw;
|
|
722
|
+
groups.forEach((g, gi) => { if (!g.length) return; ctx.strokeStyle = H.rgba(rgb, al * [0.75, 0.95, 1.15][gi]); ctx.beginPath(); g.forEach(([ax, ay, bx, by]) => { ctx.moveTo(ax, ay); ctx.lineTo(bx, by); }); ctx.stroke(); });
|
|
723
|
+
};
|
|
724
|
+
layer(0, 0.22, 6.0, 0.34, 1.0, XE.win(p, 0, 0.6));
|
|
725
|
+
layer(1, 0.55, 6.4, 0.34, 1.0, XE.win(p, 0.35, 0.85));
|
|
726
|
+
if (Math.min(w, h) > 60) { // a darker horizontal-ish layer tucked in the shadow corner of the big shapes
|
|
727
|
+
const cut = x0 + y0 + 0.78 * L, pp = XE.win(p, 0.65, 1);
|
|
728
|
+
if (pp > 0) {
|
|
729
|
+
ctx.beginPath(); ctx.moveTo(cut - y1 + 0, y1 + 4); ctx.lineTo(x1 + 4, y1 + 4); ctx.lineTo(x1 + 4, cut - x1 - 4); ctx.closePath(); ctx.clip();
|
|
730
|
+
ctx.strokeStyle = H.rgba(rgb, 0.28); ctx.lineWidth = 1.0; ctx.beginPath();
|
|
731
|
+
for (let yy = y1 + 2; yy > y1 - (h * 0.6) * pp; yy -= 4.6 + rr() * 1.2) { const j = rr.range(-1, 1); ctx.moveTo(x0 + w * 0.3, yy + j); ctx.lineTo(x1 + 4, yy - 3 + j); }
|
|
732
|
+
ctx.stroke();
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
ctx.restore();
|
|
736
|
+
};
|
|
737
|
+
// hatched drop-shadow behind a closed shape (classic notebook doodle shading)
|
|
738
|
+
const hatchShadow = (pts, dx, dy, p) => {
|
|
739
|
+
if (p <= 0) return;
|
|
740
|
+
ctx.save();
|
|
741
|
+
ctx.beginPath(); pts.forEach(([x, y], i) => (i ? ctx.lineTo(x + dx, y + dy) : ctx.moveTo(x + dx, y + dy))); ctx.closePath(); ctx.clip();
|
|
742
|
+
ctx.beginPath(); ctx.rect(vx0 - 50, vy0 - 50, vx1 - vx0 + 100, vy1 - vy0 + 100);
|
|
743
|
+
pts.forEach(([x, y], i) => (i ? ctx.lineTo(x, y) : ctx.moveTo(x, y))); ctx.closePath();
|
|
744
|
+
ctx.clip('evenodd');
|
|
745
|
+
let x0 = 1e9, x1 = -1e9, y0 = 1e9, y1 = -1e9; pts.forEach(([x, y]) => { x0 = Math.min(x0, x); x1 = Math.max(x1, x); y0 = Math.min(y0, y); y1 = Math.max(y1, y); });
|
|
746
|
+
const rr = H.rng((x0 * 7) | 0), span = (x1 - x0 + y1 - y0 + 2 * (dx + dy)) * p;
|
|
747
|
+
ctx.strokeStyle = H.rgba(BLUE, 0.62); ctx.lineWidth = 1.25; ctx.beginPath();
|
|
748
|
+
for (let o = 0; o < span; o += 4.4) {
|
|
749
|
+
const j = rr.range(-1, 1);
|
|
750
|
+
ctx.moveTo(x0 + o - (y1 - y0) - dy + j, y1 + dy + 4); ctx.lineTo(x0 + o + 4 + j, y0 - 4);
|
|
751
|
+
}
|
|
752
|
+
ctx.stroke();
|
|
753
|
+
ctx.restore();
|
|
754
|
+
};
|
|
755
|
+
// bubble lettering with crosshatched shadow
|
|
756
|
+
const bubble = (it, p) => {
|
|
757
|
+
const font = `700 ${it.size}px "Fredoka"`;
|
|
758
|
+
ctx.save(); ctx.font = font;
|
|
759
|
+
const w = ctx.measureText(it.s).width + (it.s.length - 1) * it.size * 0.06, x0 = it.align === 'center' ? it.x - w / 2 : it.x;
|
|
760
|
+
const n = Math.ceil(it.s.length * p);
|
|
761
|
+
const pos = []; let px = 0;
|
|
762
|
+
for (let i = 0; i < it.s.length; i++) { pos.push(px); px += ctx.measureText(it.s[i]).width + it.size * 0.06; }
|
|
763
|
+
const rgb = it.role === 'acc2' ? RED : BLUE;
|
|
764
|
+
// shadow: layer mask of offset glyphs minus glyphs, then hatch through it
|
|
765
|
+
// (a layer only as big as the text's own screen box: same pixels as a full-frame layer, far less fill)
|
|
766
|
+
const T = ctx.getTransform();
|
|
767
|
+
const off = it.size * 0.08;
|
|
768
|
+
let bx0 = 1e9, by0 = 1e9, bx1 = -1e9, by1 = -1e9;
|
|
769
|
+
{ const cr = Math.cos(it.rot || 0), sr = Math.sin(it.rot || 0);
|
|
770
|
+
[[-12, -it.size * 1.05], [w + off + 12, -it.size * 1.05], [-12, it.size * 0.4 + off], [w + off + 12, it.size * 0.4 + off]].forEach(([lx, ly]) => {
|
|
771
|
+
const wx = x0 + lx * cr - ly * sr, wy = it.y + lx * sr + ly * cr, dx = T.a * wx + T.c * wy + T.e, dy = T.b * wx + T.d * wy + T.f;
|
|
772
|
+
bx0 = Math.min(bx0, dx); bx1 = Math.max(bx1, dx); by0 = Math.min(by0, dy); by1 = Math.max(by1, dy); }); }
|
|
773
|
+
bx0 = Math.max(0, Math.floor(bx0) - 4); by0 = Math.max(0, Math.floor(by0) - 4); bx1 = Math.min(W, Math.ceil(bx1) + 4); by1 = Math.min(H_, Math.ceil(by1) + 4);
|
|
774
|
+
if (bx1 > bx0 && by1 > by0) {
|
|
775
|
+
const M = H.layer(bx1 - bx0, by1 - by0), mc = M.getContext('2d');
|
|
776
|
+
mc.setTransform(T.a, T.b, T.c, T.d, T.e - bx0, T.f - by0); mc.font = font; mc.fillStyle = '#000';
|
|
777
|
+
mc.translate(x0, it.y); mc.rotate(it.rot);
|
|
778
|
+
for (let i = 0; i < n; i++) if (it.s[i] !== ' ') mc.fillText(it.s[i], pos[i] + off, off);
|
|
779
|
+
mc.globalCompositeOperation = 'destination-out'; mc.lineWidth = 3;
|
|
780
|
+
for (let i = 0; i < n; i++) if (it.s[i] !== ' ') { mc.fillText(it.s[i], pos[i], 0); mc.strokeText(it.s[i], pos[i], 0); }
|
|
781
|
+
mc.globalCompositeOperation = 'source-in'; mc.setTransform(1, 0, 0, 1, -bx0, -by0);
|
|
782
|
+
mc.strokeStyle = H.rgba(rgb, 0.85); mc.lineWidth = 1.1;
|
|
783
|
+
const oA = bx0 - (H_ - by0) * 0.9 - 6, oB = bx1 - (H_ - by1) * 0.9 + 6;
|
|
784
|
+
mc.beginPath(); for (let o = -800; o < W + 800; o += 3.6) { if (o < oA || o > oB) continue; mc.moveTo(o, H_); mc.lineTo(o + H_ * 0.9, 0); } mc.stroke();
|
|
785
|
+
ctx.save(); ctx.setTransform(1, 0, 0, 1, 0, 0); ctx.drawImage(M, bx0, by0); ctx.restore();
|
|
786
|
+
}
|
|
787
|
+
ctx.translate(x0, it.y); ctx.rotate(it.rot); ctx.lineJoin = 'round';
|
|
788
|
+
[[0, 0, 2.0, 1.0], [0.8, -0.6, 1.2, 0.8]].forEach(([dx, dy, lw, a]) => {
|
|
789
|
+
ctx.strokeStyle = H.rgba(rgb, a); ctx.lineWidth = lw;
|
|
790
|
+
for (let i = 0; i < n; i++) if (it.s[i] !== ' ') ctx.strokeText(it.s[i], pos[i] + dx, dy);
|
|
791
|
+
});
|
|
792
|
+
ctx.restore();
|
|
793
|
+
return [x0 + (pos[Math.min(n, pos.length - 1)] || 0), it.y - it.size * 0.4];
|
|
794
|
+
};
|
|
795
|
+
const measure = (it, p) => {
|
|
796
|
+
ctx.save(); ctx.font = it.font === 'label' ? `400 ${it.size}px "Gloria Hallelujah"` : `700 ${it.size}px "Fredoka"`;
|
|
797
|
+
const w = ctx.measureText(it.s).width, x0 = it.align === 'center' ? it.x - w / 2 : it.x;
|
|
798
|
+
const w2 = ctx.measureText(it.s.slice(0, Math.ceil(it.s.length * p))).width; ctx.restore();
|
|
799
|
+
return [x0 + w2, it.y - it.size * 0.3];
|
|
800
|
+
};
|
|
801
|
+
const offscreen = (it) => {
|
|
802
|
+
if (it.k === 'line') { let a0 = 1e9, a1 = -1e9, b0 = 1e9, b1 = -1e9; for (const [x, y] of it.pts) { if (x < a0) a0 = x; if (x > a1) a1 = x; if (y < b0) b0 = y; if (y > b1) b1 = y; } return a1 < vx0 - 30 || a0 > vx1 + 30 || b1 < vy0 - 30 || b0 > vy1 + 30; }
|
|
803
|
+
if (it.k === 'dot') return it.x < vx0 - 20 || it.x > vx1 + 20 || it.y < vy0 - 20 || it.y > vy1 + 20;
|
|
804
|
+
const hw = it.s.length * it.size * 0.6; return it.x + hw < vx0 || it.x - hw > vx1 || it.y + it.size < vy0 || it.y - it.size > vy1;
|
|
805
|
+
};
|
|
806
|
+
// closed shapes in the diagram (for interior hatching and its paper holes)
|
|
807
|
+
const isClosed = (it) => it.k === 'line' && !it.inst && it.pts.length > 8 && Math.hypot(it.pts[0][0] - it.pts[it.pts.length - 1][0], it.pts[0][1] - it.pts[it.pts.length - 1][1]) < 20;
|
|
808
|
+
const bbox = (P) => { let a0 = 1e9, a1 = -1e9, b0 = 1e9, b1 = -1e9; for (const [x, y] of P) { if (x < a0) a0 = x; if (x > a1) a1 = x; if (y < b0) b0 = y; if (y > b1) b1 = y; } return [a0, b0, a1, b1]; };
|
|
809
|
+
const closedItems = items.filter((it) => isClosed(it) && it.role !== 'acc2').map((it) => ({ it, bb: bbox(it.pts) }));
|
|
810
|
+
const titleTexts = items.filter((it) => it.k === 'text' && it.font === 'title' && !it.inst);
|
|
811
|
+
const holesFor = (it) => {
|
|
812
|
+
const [a0, b0, a1, b1] = bbox(it.pts), hs = [];
|
|
813
|
+
closedItems.forEach((c) => { if (c.it !== it && c.bb[0] > a0 && c.bb[2] < a1 && c.bb[1] > b0 && c.bb[3] < b1) hs.push(c.it.pts); });
|
|
814
|
+
titleTexts.forEach((tx) => {
|
|
815
|
+
if (tx.x < a0 || tx.x > a1 || tx.y < b0 || tx.y > b1 + tx.size * 0.3) return;
|
|
816
|
+
ctx.save(); ctx.font = `700 ${tx.size}px "Fredoka"`; const tw = ctx.measureText(tx.s).width + tx.s.length * tx.size * 0.06; ctx.restore();
|
|
817
|
+
const lx = tx.align === 'center' ? tx.x - tw / 2 : tx.x;
|
|
818
|
+
hs.push({ rect: [lx - 10, tx.y - tx.size * 0.85, tw + 22, tx.size * 1.15] });
|
|
819
|
+
});
|
|
820
|
+
return hs;
|
|
821
|
+
};
|
|
822
|
+
for (const it of items) {
|
|
823
|
+
const p = it.inst ? 1 : XE.win(t, it.a, it.b);
|
|
824
|
+
if (p <= 0 || offscreen(it)) continue;
|
|
825
|
+
const rgb = it.role === 'acc2' ? RED : BLUE;
|
|
826
|
+
if (it.k === 'line') {
|
|
827
|
+
const seed = ((it.pts[0][0] * 13 + it.pts[0][1] * 7) | 0) + 5;
|
|
828
|
+
let P = wob(seg(it.pts, 2.5), nz, seed % 83, it.inst ? 0.4 : 0.9);
|
|
829
|
+
if (p < 1) P = P.slice(0, Math.max(2, Math.ceil(P.length * p)));
|
|
830
|
+
const closed = it.pts.length > 8 && Math.hypot(it.pts[0][0] - it.pts[it.pts.length - 1][0], it.pts[0][1] - it.pts[it.pts.length - 1][1]) < 20;
|
|
831
|
+
if (closed && it.role === 'ink' && it.w >= 4 && !it.inst) {
|
|
832
|
+
const hp = XE.win(t, it.b, it.b + 0.35);
|
|
833
|
+
hatchShadow(it.pts, 9, 9, hp);
|
|
834
|
+
hatchFill(it.pts, holesFor(it), hp, rgb);
|
|
835
|
+
}
|
|
836
|
+
if (it.g === 'D' && it.role === 'acc1' && it.w === 6 && it.pts.length === 41) { // the accuracy curve: hatch the area under it as it is drawn
|
|
837
|
+
const C = it.pts, n = Math.max(2, Math.ceil(C.length * p)), base = L.D[1] + 150 - 4, xe = C[n - 1][0];
|
|
838
|
+
ctx.save(); ctx.beginPath(); ctx.moveTo(C[0][0], base); for (let i = 0; i < n; i++) ctx.lineTo(C[i][0], C[i][1] + 5); ctx.lineTo(xe, base); ctx.closePath(); ctx.clip();
|
|
839
|
+
const rr = H.rng(4242), top = C[C.length - 1][1];
|
|
840
|
+
ctx.lineWidth = 1.0;
|
|
841
|
+
for (let gi = 0; gi < 3; gi++) {
|
|
842
|
+
ctx.strokeStyle = H.rgba(BLUE, [0.2, 0.26, 0.32][gi]); ctx.beginPath();
|
|
843
|
+
for (let o = C[0][0] - (base - top); o < xe; o += 6.4) { const j = rr.range(-0.9, 0.9); if (((o * 0.37) | 0) % 3 !== gi) continue; ctx.moveTo(o + j, base + 2); ctx.lineTo(o + j + (base - top) + 8, top - 8); }
|
|
844
|
+
ctx.stroke();
|
|
845
|
+
}
|
|
846
|
+
ctx.restore();
|
|
847
|
+
}
|
|
848
|
+
bpl(P, seed, Math.max(1.5, it.w * 0.45), 0.95, rgb, p >= 1);
|
|
849
|
+
if (it.w >= 5 && !it.inst) bpl(wob(seg(it.pts, 2.5), nz, (seed + 7) % 83, 1.2).slice(0, P.length), seed + 1, Math.max(1, it.w * 0.24), 0.6, rgb, false); // retraced
|
|
850
|
+
} else if (it.k === 'dot') {
|
|
851
|
+
ctx.fillStyle = H.rgba(rgb, 0.9); ctx.beginPath(); ctx.arc(it.x, it.y, it.r * 0.8, 0, 7); ctx.fill();
|
|
852
|
+
} else if (it.font === 'label') {
|
|
853
|
+
ctx.save(); ctx.font = `400 ${it.size * 1.0}px "Gloria Hallelujah"`; ctx.fillStyle = H.rgba(rgb, 0.9);
|
|
854
|
+
const s = it.s.slice(0, Math.ceil(it.s.length * p)), w = ctx.measureText(it.s).width;
|
|
855
|
+
ctx.translate(it.align === 'center' ? it.x - w / 2 : it.x, it.y); ctx.rotate(it.rot); ctx.fillText(s, 0, 0); ctx.restore();
|
|
856
|
+
} else bubble(it, p);
|
|
857
|
+
}
|
|
858
|
+
ctx.restore();
|
|
859
|
+
|
|
860
|
+
// ---------- pen ----------
|
|
861
|
+
const tp = XE.tipOf(items, t, measure);
|
|
862
|
+
if (tp) {
|
|
863
|
+
const [tx, ty] = toS(tp), ang = 0.85, len = 280;
|
|
864
|
+
ctx.save();
|
|
865
|
+
ctx.save(); ctx.filter = 'blur(6px)'; ctx.fillStyle = 'rgba(40,40,60,0.25)'; ctx.translate(tx + 18, ty + 22); ctx.rotate(ang + 0.04); ctx.beginPath(); ctx.roundRect(20, -7, len, 14, 6); ctx.fill(); ctx.restore();
|
|
866
|
+
ctx.translate(tx, ty); ctx.rotate(ang);
|
|
867
|
+
ctx.fillStyle = '#b8b8b0'; ctx.beginPath(); ctx.arc(0.5, 0, 1.4, 0, 7); ctx.fill();
|
|
868
|
+
const cg = ctx.createLinearGradient(0, -6, 0, 6); cg.addColorStop(0, '#ffffff'); cg.addColorStop(1, '#c9c9c2');
|
|
869
|
+
ctx.fillStyle = cg; ctx.beginPath(); ctx.moveTo(1.5, -1.5); ctx.lineTo(26, -6.5); ctx.lineTo(26, 6.5); ctx.lineTo(1.5, 1.5); ctx.closePath(); ctx.fill();
|
|
870
|
+
const bgr = ctx.createLinearGradient(0, -8, 0, 8); bgr.addColorStop(0, 'rgba(250,252,255,0.95)'); bgr.addColorStop(0.5, 'rgba(215,222,232,0.92)'); bgr.addColorStop(1, 'rgba(160,170,185,0.95)');
|
|
871
|
+
ctx.fillStyle = bgr; ctx.fillRect(26, -8, len - 50, 16);
|
|
872
|
+
const inkRgb = (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' ? RED : BLUE;
|
|
873
|
+
ctx.fillStyle = H.rgba(inkRgb, 0.85); ctx.fillRect(30, -1.8, len - 70, 3.6);
|
|
874
|
+
ctx.fillStyle = 'rgba(255,255,255,0.8)'; ctx.fillRect(30, -6, len - 60, 1.5);
|
|
875
|
+
ctx.fillStyle = H.rgba(H.mix(inkRgb, '#ffffff', 0.1)); ctx.beginPath(); ctx.roundRect(len - 26, -7, 26, 14, 4); ctx.fill();
|
|
876
|
+
ctx.restore();
|
|
877
|
+
}
|
|
878
|
+
H.grain(ctx, W, H_, 0.022, 4 + (Math.floor(t * 12) % 4));
|
|
879
|
+
H.vignette(ctx, W, H_, 0.12, '60,50,40');
|
|
880
|
+
},
|
|
881
|
+
// <<<EXPLAINER
|
|
882
|
+
// Sound: a cheap ballpoint on a college-ruled pad. Every draw-on is a thin rolling scratch with the pad's soft body
|
|
883
|
+
// under it and a tiny tick where the ball lands; the red pen (acc2 items) sits a little lower; the hatched shadows
|
|
884
|
+
// that fill in behind closed shapes and bubble letters are fast back-and-forth flicks. The "repeat x1000" leader
|
|
885
|
+
// carries the scroll down the page. Times mirror explainer()/XE.story (pT 10.95, kT 13.05, bridge 10.15-10.6,
|
|
886
|
+
// model timings from explainer(); hatch shadows run it.b .. it.b + 0.35).
|
|
887
|
+
explainerSound(k) {
|
|
888
|
+
const pT = 10.95, kT = 13.05;
|
|
889
|
+
const rnd = (i) => { const x = Math.sin(i * 12.9898 + 78.233) * 43758.5453; return x - Math.floor(x); };
|
|
890
|
+
// first time XE.eio(win(t, t0, t1)) reaches u (the knob needles' eased turn)
|
|
891
|
+
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; };
|
|
892
|
+
// one ballpoint line: the ball lands (tick + a little knock through the pad), rolls and scratches, pad body under it
|
|
893
|
+
const LV = 0.45; // drawing sits well under the hits
|
|
894
|
+
const bp = (a, b, g = 1, pan = 0, minor = true, red = false) => {
|
|
895
|
+
const d = Math.max(0.03, b - a); g *= LV;
|
|
896
|
+
k.noise(a, { dur: 0.016, filter: 'bandpass', f: red ? 1700 : 2100, q: 1.8, gain: 0.34 * g, a: 0.001, pan, minor });
|
|
897
|
+
k.tone(a, { f: red ? 170 : 210, dur: 0.03, gain: 0.05 * g, pan, minor });
|
|
898
|
+
k.play('stroke', a, { material: 'pen', dur: d, gain: 1.5 * g, pan, minor });
|
|
899
|
+
k.noise(a, { dur: d + 0.03, color: 'pink', filter: 'bandpass', f: red ? 800 : 950, q: 0.9, gain: 0.07 * g, a: 0.012, hold: d * 0.6, pan, minor });
|
|
900
|
+
};
|
|
901
|
+
// handwriting: one stroke per word, timed by character position like the explainer's per-letter reveal
|
|
902
|
+
const write = (s, a, b, g = 0.9, pan = 0, red = false, minor = true) => {
|
|
903
|
+
const n = s.length, re = /\S+/g; let m;
|
|
904
|
+
while ((m = re.exec(s))) bp(a + (b - a) * m.index / n, a + (b - a) * (m.index + m[0].length) / n, g, pan, minor, red);
|
|
905
|
+
};
|
|
906
|
+
// doodle hatching: quick parallel flicks (shadows behind boxes and bubble letters), always minor texture
|
|
907
|
+
const hatch = (a, b, g = 1, seed = 1, pan = 0) => {
|
|
908
|
+
let i = 0;
|
|
909
|
+
for (let x = a; x < b; x += 0.036 + rnd(seed + i) * 0.014, i++) {
|
|
910
|
+
k.noise(x, { dur: 0.028, filter: 'bandpass', f: 3300 + rnd(seed + i + 40) * 700, q: 1.3, gain: 0.06 * LV * g * (1 - 0.4 * (x - a) / (b - a)), a: 0.004, pan: pan + (i % 2 ? 0.06 : -0.06), minor: true });
|
|
911
|
+
}
|
|
912
|
+
};
|
|
913
|
+
// bubble letters: outline per word plus the crosshatched shadow filling in alongside
|
|
914
|
+
const bubble = (s, a, b, g = 1, pan = 0, red = false, minor = true) => { write(s, a, b, g, pan, red, minor); hatch(a + 0.03, b, 0.8 * g, (a * 100) | 0, pan); };
|
|
915
|
+
const dotTap = (t, g = 1) => k.noise(t, { dur: 0.015, filter: 'bandpass', f: 2000, q: 1.6, gain: 0.22 * g, a: 0.001, minor: true });
|
|
916
|
+
|
|
917
|
+
k.bed('room', 0, 15, { gain: 0.45 });
|
|
918
|
+
|
|
919
|
+
// 1 HOOK: bubble-letter title, then the underline
|
|
920
|
+
bubble('How does AI learn?', 0.15, 1.3, 1.0);
|
|
921
|
+
bp(1.3, 1.55, 1.25, 0, false);
|
|
922
|
+
|
|
923
|
+
// 2 DATA: robot brain (box, antenna, eyes, ears, mouth, knobs), six cards; hatched shadows follow the boxes
|
|
924
|
+
bp(2.5, 2.8, 1.05, 0.1, false); // head box: first mark in the new scene
|
|
925
|
+
bp(2.8, 2.92, 0.7, 0.15); // antenna + ball
|
|
926
|
+
bp(2.92, 3.04, 0.7, 0.1); dotTap(3.0, 0.8); // eyes + pupils
|
|
927
|
+
bp(3.05, 3.12, 0.6, 0.1); // mouth
|
|
928
|
+
for (let i = 0; i < 6; i++) { const a = 3.0 + i * 0.17; bp(a, a + (i < 5 ? 0.15 : 0.21), 0.85, (i % 3 - 1) * 0.15); }
|
|
929
|
+
hatch(2.8, 4.4, 0.9, 7); // shadows behind the head box, mouth, knobs and each card in turn
|
|
930
|
+
bp(4.15, 4.45, 1.0); bp(4.46, 4.55, 0.85); // flow arrow + head
|
|
931
|
+
write('examples', 4.55, 4.8, 0.35);
|
|
932
|
+
for (let f = 55; f < 63; f++) k.play('count', f / 12, { gain: 1.5, f: 2500 + (f - 55) * 120, minor: true }); // bubble numerals re-inked on the 12 fps grid
|
|
933
|
+
k.play('tock', 63 / 12, { f: 560, gain: 0.45 }); // 1,000,000 lands
|
|
934
|
+
|
|
935
|
+
// 3 GUESS -> CHECK -> ADJUST
|
|
936
|
+
bp(6.4, 6.53, 0.9, 0, true, true); // red frame of the new photo
|
|
937
|
+
bp(6.55, 6.7, 0.85); dotTap(6.7, 0.9); // cat + eyes
|
|
938
|
+
write('new!', 6.67, 6.8, 0.65, 0.2, true);
|
|
939
|
+
bp(6.8, 6.94, 0.9); bp(6.96, 7.02, 0.8); // arrow down into the model
|
|
940
|
+
bp(7.02, 7.15, 0.9); // guess arrow out
|
|
941
|
+
write('Guess', 7.15, 7.4, 0.65);
|
|
942
|
+
bp(7.3, 7.47, 0.85); bp(7.48, 7.53, 0.75); // speech bubble + tail
|
|
943
|
+
hatch(7.5, 7.85, 0.7, 21);
|
|
944
|
+
bubble('dog?', 7.54, 7.75, 1.0);
|
|
945
|
+
write('Check', 7.86, 8.0, 0.65, 0, true);
|
|
946
|
+
// the wrong guess: two hard red slashes + a low "nope"
|
|
947
|
+
bp(8.0, 8.08, 1.9, 0.1, false, true); bp(8.08, 8.16, 1.9, 0.1, false, true);
|
|
948
|
+
k.play('error', 8.0, { f: 'F3', gain: 0.55 });
|
|
949
|
+
bp(8.16, 8.45, 1.1, 0, true, true); // red ring
|
|
950
|
+
bp(8.45, 8.8, 1.0, -0.1, true, true); // long arrow back to the knobs
|
|
951
|
+
write('Adjust', 8.8, 9.05, 0.65, -0.1, true);
|
|
952
|
+
// knob needles swing (eio 8.95..9.5): a soft detent click every 1/7 of the turn, slowing as they settle
|
|
953
|
+
for (let j = 1; j <= 7; j++) k.play('click', when(8.95, 9.5, j / 7), { f: 1000, gain: 0.5, pan: -0.15, minor: true });
|
|
954
|
+
bp(9.5, 9.62, 1.1); // strike through "dog?"
|
|
955
|
+
bubble('cat', 9.62, 9.85, 1.0);
|
|
956
|
+
bp(9.85, 10.05, 1.15, 0, false); // check mark
|
|
957
|
+
k.play('success', 9.98, { f: 'A5', gain: 0.6 });
|
|
958
|
+
|
|
959
|
+
// bridge: the "repeat x1000" leader is drawn as the camera scrolls down the page to the chart
|
|
960
|
+
bp(10.15, 10.6, 1.6, 0.2, false); bp(10.6, 10.66, 1.1, 0.2);
|
|
961
|
+
write('repeat x1000', 10.66, 10.9, 0.75, 0.3);
|
|
962
|
+
|
|
963
|
+
// 4 PROGRESS
|
|
964
|
+
bp(pT, pT + 0.3, 1.0, 0, false); // axes
|
|
965
|
+
write('training rounds', pT + 0.3, pT + 0.55, 0.5);
|
|
966
|
+
write('accuracy', pT + 0.45, pT + 0.7, 0.55, 0.3);
|
|
967
|
+
bp(pT + 0.7, pT + 1.7, 0.45); // the rising curve
|
|
968
|
+
{ // % counter: a tick whenever the shown number changes (12 fps grid), slowing as it settles.
|
|
969
|
+
// The numerals stay blue, so the hit lands on the frame 97% is first inked.
|
|
970
|
+
let last = -1;
|
|
971
|
+
for (let f = Math.ceil((pT + 0.6) * 12); f < 160; f++) {
|
|
972
|
+
const u = Math.min(1, (f / 12 - (pT + 0.6)) / 1.1), v = Math.round(61 + 36 * (1 - Math.pow(1 - u, 2.2)));
|
|
973
|
+
if (v === 97) { // 97% lands: the biggest hit
|
|
974
|
+
k.play('impact', f / 12, { gain: 1.0, pan: 0.2 });
|
|
975
|
+
k.play('ding', f / 12 + 0.01, { f: 'D6', gain: 0.42, pan: 0.2 });
|
|
976
|
+
break;
|
|
977
|
+
}
|
|
978
|
+
if (v !== last) { k.play('tick', f / 12, { gain: 1.1, f: 2500 + (v - 61) * 25, pan: 0.25, minor: true }); last = v; }
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
bp(pT + 1.75, pT + 2.05, 1.25, 0.25, false, true); // red ring round the 97%
|
|
982
|
+
|
|
983
|
+
// 5 TAKEAWAY
|
|
984
|
+
bubble('More examples → better guesses', kT, kT + 0.75, 0.9);
|
|
985
|
+
k.play('success', kT + 0.75, { f: 'G5', gain: 0.7 }); // resolving landing
|
|
986
|
+
bp(kT + 0.75, kT + 0.95, 1.15, 0, false);
|
|
987
|
+
},
|
|
988
|
+
});
|
|
989
|
+
}
|