@zonsh/ui 0.0.0 → 0.2.0
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/LICENSE +21 -0
- package/README.md +75 -1
- package/assets/illustrations/drawing/bracket-construction-dark.svg +77 -0
- package/assets/illustrations/drawing/bracket-construction-filled-dark.svg +50 -0
- package/assets/illustrations/drawing/bracket-construction-filled.svg +50 -0
- package/assets/illustrations/drawing/bracket-construction.svg +77 -0
- package/assets/illustrations/drawing/crescent-dark.svg +28 -0
- package/assets/illustrations/drawing/crescent-guides-dark.svg +33 -0
- package/assets/illustrations/drawing/crescent-guides.svg +33 -0
- package/assets/illustrations/drawing/crescent.svg +28 -0
- package/assets/illustrations/drawing/eclipse-dark.svg +187 -0
- package/assets/illustrations/drawing/eclipse-guides-dark.svg +191 -0
- package/assets/illustrations/drawing/eclipse-guides.svg +191 -0
- package/assets/illustrations/drawing/eclipse.svg +187 -0
- package/assets/illustrations/drawing/elevation-guides-dark.svg +31 -0
- package/assets/illustrations/drawing/elevation-guides-plain-dark.svg +9 -0
- package/assets/illustrations/drawing/elevation-guides-plain.svg +9 -0
- package/assets/illustrations/drawing/elevation-guides.svg +31 -0
- package/assets/illustrations/drawing/horizon-dark.svg +30 -0
- package/assets/illustrations/drawing/horizon.svg +30 -0
- package/assets/illustrations/drawing/nib-study-dark.svg +107 -0
- package/assets/illustrations/drawing/nib-study-plain-dark.svg +93 -0
- package/assets/illustrations/drawing/nib-study-plain.svg +93 -0
- package/assets/illustrations/drawing/nib-study.svg +107 -0
- package/assets/illustrations/editorial/assistant-640.webp +0 -0
- package/assets/illustrations/editorial/assistant.webp +0 -0
- package/assets/illustrations/editorial/automation-640.webp +0 -0
- package/assets/illustrations/editorial/automation.webp +0 -0
- package/assets/illustrations/editorial/bracket-left-640.webp +0 -0
- package/assets/illustrations/editorial/bracket-left.webp +0 -0
- package/assets/illustrations/editorial/bracket-right-640.webp +0 -0
- package/assets/illustrations/editorial/bracket-right.webp +0 -0
- package/assets/illustrations/editorial/custom-software-640.webp +0 -0
- package/assets/illustrations/editorial/custom-software.webp +0 -0
- package/assets/illustrations/editorial/digitalization-640.webp +0 -0
- package/assets/illustrations/editorial/digitalization.webp +0 -0
- package/assets/illustrations/editorial/integration-640.webp +0 -0
- package/assets/illustrations/editorial/integration.webp +0 -0
- package/assets/illustrations/editorial/problem-640.webp +0 -0
- package/assets/illustrations/editorial/problem.webp +0 -0
- package/assets/illustrations/editorial/process-analysis-640.webp +0 -0
- package/assets/illustrations/editorial/process-analysis.webp +0 -0
- package/assets/illustrations/editorial/process-concept-640.webp +0 -0
- package/assets/illustrations/editorial/process-concept.webp +0 -0
- package/assets/illustrations/editorial/process-development-640.webp +0 -0
- package/assets/illustrations/editorial/process-development.webp +0 -0
- package/assets/illustrations/editorial/process-discovery-640.webp +0 -0
- package/assets/illustrations/editorial/process-discovery.webp +0 -0
- package/assets/illustrations/editorial/process-maintenance-640.webp +0 -0
- package/assets/illustrations/editorial/process-maintenance.webp +0 -0
- package/assets/illustrations/editorial/process-prototype-640.webp +0 -0
- package/assets/illustrations/editorial/process-prototype.webp +0 -0
- package/assets/illustrations/editorial/process-testing-640.webp +0 -0
- package/assets/illustrations/editorial/process-testing.webp +0 -0
- package/assets/illustrations/iso/automation-dark.svg +6 -0
- package/assets/illustrations/iso/automation.svg +6 -0
- package/assets/illustrations/iso/bar-chart-dark.svg +6 -0
- package/assets/illustrations/iso/bar-chart.svg +6 -0
- package/assets/illustrations/iso/brackets-classic-dark.svg +6 -0
- package/assets/illustrations/iso/brackets-classic.svg +6 -0
- package/assets/illustrations/iso/brackets-dark.svg +6 -0
- package/assets/illustrations/iso/brackets.svg +6 -0
- package/assets/illustrations/iso/city-dark.svg +6 -0
- package/assets/illustrations/iso/city.svg +6 -0
- package/assets/illustrations/iso/conveyor-dark.svg +6 -0
- package/assets/illustrations/iso/conveyor.svg +6 -0
- package/assets/illustrations/iso/database-dark.svg +6 -0
- package/assets/illustrations/iso/database.svg +6 -0
- package/assets/illustrations/iso/documents-dark.svg +6 -0
- package/assets/illustrations/iso/documents.svg +6 -0
- package/assets/illustrations/iso/inbox-dark.svg +6 -0
- package/assets/illustrations/iso/inbox.svg +6 -0
- package/assets/illustrations/iso/laptop-dark.svg +6 -0
- package/assets/illustrations/iso/laptop.svg +6 -0
- package/assets/illustrations/iso/monitor-dark.svg +6 -0
- package/assets/illustrations/iso/monitor.svg +6 -0
- package/assets/illustrations/iso/pipeline-dark.svg +6 -0
- package/assets/illustrations/iso/pipeline.svg +6 -0
- package/assets/illustrations/iso/platform-dark.svg +6 -0
- package/assets/illustrations/iso/platform.svg +6 -0
- package/assets/illustrations/iso/server-dark.svg +6 -0
- package/assets/illustrations/iso/server.svg +6 -0
- package/assets/illustrations/iso/spreadsheet-dark.svg +6 -0
- package/assets/illustrations/iso/spreadsheet.svg +6 -0
- package/assets/illustrations/iso/timeline-dark.svg +6 -0
- package/assets/illustrations/iso/timeline.svg +6 -0
- package/assets/illustrations/sheet/construction.svg +115 -0
- package/assets/illustrations/sheet/crescent.svg +40 -0
- package/assets/illustrations/sheet/limb.svg +42 -0
- package/assets/illustrations/sheet/stress-axis.svg +119 -0
- package/assets/illustrations/sheet/totality.svg +215 -0
- package/assets/illustrations/sheet/vertical-metrics.svg +43 -0
- package/assets/logo-left.svg +1 -0
- package/assets/logo-right.svg +1 -0
- package/assets/logo.svg +1 -0
- package/dist/components/_overlay.d.ts +47 -0
- package/dist/components/_overlay.js +59 -0
- package/dist/components/accordion.d.ts +32 -0
- package/dist/components/accordion.js +39 -0
- package/dist/components/alert-dialog.d.ts +45 -0
- package/dist/components/alert-dialog.js +56 -0
- package/dist/components/alert.d.ts +35 -0
- package/dist/components/alert.js +42 -0
- package/dist/components/ascii-field.d.ts +34 -0
- package/dist/components/ascii-field.js +410 -0
- package/dist/components/aspect-ratio.d.ts +14 -0
- package/dist/components/aspect-ratio.js +17 -0
- package/dist/components/avatar.d.ts +42 -0
- package/dist/components/avatar.js +55 -0
- package/dist/components/badge.d.ts +70 -0
- package/dist/components/badge.js +62 -0
- package/dist/components/breadcrumb.d.ts +22 -0
- package/dist/components/breadcrumb.js +32 -0
- package/dist/components/button-group.d.ts +30 -0
- package/dist/components/button-group.js +47 -0
- package/dist/components/button.d.ts +53 -0
- package/dist/components/button.js +130 -0
- package/dist/components/calendar.d.ts +26 -0
- package/dist/components/calendar.js +164 -0
- package/dist/components/card.d.ts +42 -0
- package/dist/components/card.js +76 -0
- package/dist/components/carousel.d.ts +90 -0
- package/dist/components/carousel.js +213 -0
- package/dist/components/chart.d.ts +180 -0
- package/dist/components/chart.js +286 -0
- package/dist/components/checkbox.d.ts +23 -0
- package/dist/components/checkbox.js +43 -0
- package/dist/components/code-block.d.ts +45 -0
- package/dist/components/code-block.js +58 -0
- package/dist/components/code-highlight.d.ts +13 -0
- package/dist/components/code-highlight.js +107 -0
- package/dist/components/collapsible.d.ts +20 -0
- package/dist/components/collapsible.js +32 -0
- package/dist/components/color-picker.d.ts +85 -0
- package/dist/components/color-picker.js +407 -0
- package/dist/components/combobox.d.ts +81 -0
- package/dist/components/combobox.js +100 -0
- package/dist/components/command.d.ts +112 -0
- package/dist/components/command.js +212 -0
- package/dist/components/context-menu.d.ts +29 -0
- package/dist/components/context-menu.js +35 -0
- package/dist/components/conversation.d.ts +27 -0
- package/dist/components/conversation.js +293 -0
- package/dist/components/copy-button.d.ts +46 -0
- package/dist/components/copy-button.js +118 -0
- package/dist/components/data-table.d.ts +175 -0
- package/dist/components/data-table.js +302 -0
- package/dist/components/date-picker.d.ts +91 -0
- package/dist/components/date-picker.js +207 -0
- package/dist/components/dialog.d.ts +48 -0
- package/dist/components/dialog.js +92 -0
- package/dist/components/direction.d.ts +16 -0
- package/dist/components/direction.js +18 -0
- package/dist/components/drawer.d.ts +60 -0
- package/dist/components/drawer.js +76 -0
- package/dist/components/empty.d.ts +31 -0
- package/dist/components/empty.js +50 -0
- package/dist/components/feature-list.d.ts +54 -0
- package/dist/components/feature-list.js +43 -0
- package/dist/components/field.d.ts +15 -0
- package/dist/components/field.js +36 -0
- package/dist/components/file-drop.d.ts +55 -0
- package/dist/components/file-drop.js +197 -0
- package/dist/components/filter-bar.d.ts +106 -0
- package/dist/components/filter-bar.js +296 -0
- package/dist/components/form.d.ts +33 -0
- package/dist/components/form.js +34 -0
- package/dist/components/graph.d.ts +105 -0
- package/dist/components/graph.js +786 -0
- package/dist/components/illustration.d.ts +85 -0
- package/dist/components/illustration.js +165 -0
- package/dist/components/input-group.d.ts +127 -0
- package/dist/components/input-group.js +292 -0
- package/dist/components/input.d.ts +16 -0
- package/dist/components/input.js +25 -0
- package/dist/components/item.d.ts +64 -0
- package/dist/components/item.js +116 -0
- package/dist/components/kbd.d.ts +33 -0
- package/dist/components/kbd.js +38 -0
- package/dist/components/label.d.ts +12 -0
- package/dist/components/label.js +24 -0
- package/dist/components/layout.d.ts +136 -0
- package/dist/components/layout.js +162 -0
- package/dist/components/logo.d.ts +54 -0
- package/dist/components/logo.js +96 -0
- package/dist/components/menu.d.ts +60 -0
- package/dist/components/menu.js +138 -0
- package/dist/components/menubar.d.ts +62 -0
- package/dist/components/menubar.js +223 -0
- package/dist/components/message.d.ts +42 -0
- package/dist/components/message.js +56 -0
- package/dist/components/meter.d.ts +31 -0
- package/dist/components/meter.js +25 -0
- package/dist/components/native-select.d.ts +26 -0
- package/dist/components/native-select.js +35 -0
- package/dist/components/navigation-menu.d.ts +42 -0
- package/dist/components/navigation-menu.js +97 -0
- package/dist/components/number-field.d.ts +36 -0
- package/dist/components/number-field.js +153 -0
- package/dist/components/otp-field.d.ts +35 -0
- package/dist/components/otp-field.js +94 -0
- package/dist/components/pagination.d.ts +31 -0
- package/dist/components/pagination.js +70 -0
- package/dist/components/pdf-viewer.d.ts +69 -0
- package/dist/components/pdf-viewer.js +929 -0
- package/dist/components/popover.d.ts +33 -0
- package/dist/components/popover.js +48 -0
- package/dist/components/preview-card.d.ts +25 -0
- package/dist/components/preview-card.js +22 -0
- package/dist/components/progress.d.ts +27 -0
- package/dist/components/progress.js +23 -0
- package/dist/components/prompt-input.d.ts +131 -0
- package/dist/components/prompt-input.js +403 -0
- package/dist/components/quote.d.ts +22 -0
- package/dist/components/quote.js +15 -0
- package/dist/components/radio-group.d.ts +18 -0
- package/dist/components/radio-group.js +34 -0
- package/dist/components/reasoning.d.ts +31 -0
- package/dist/components/reasoning.js +70 -0
- package/dist/components/resizable.d.ts +38 -0
- package/dist/components/resizable.js +41 -0
- package/dist/components/response.d.ts +30 -0
- package/dist/components/response.js +538 -0
- package/dist/components/scroll-area.d.ts +33 -0
- package/dist/components/scroll-area.js +31 -0
- package/dist/components/select.d.ts +35 -0
- package/dist/components/select.js +60 -0
- package/dist/components/separator.d.ts +14 -0
- package/dist/components/separator.js +17 -0
- package/dist/components/sidebar.d.ts +147 -0
- package/dist/components/sidebar.js +489 -0
- package/dist/components/site-header.d.ts +59 -0
- package/dist/components/site-header.js +67 -0
- package/dist/components/skeleton.d.ts +31 -0
- package/dist/components/skeleton.js +29 -0
- package/dist/components/slider.d.ts +24 -0
- package/dist/components/slider.js +129 -0
- package/dist/components/sources.d.ts +25 -0
- package/dist/components/sources.js +35 -0
- package/dist/components/spinner.d.ts +36 -0
- package/dist/components/spinner.js +72 -0
- package/dist/components/suggestions.d.ts +20 -0
- package/dist/components/suggestions.js +18 -0
- package/dist/components/switch.d.ts +14 -0
- package/dist/components/switch.js +26 -0
- package/dist/components/table.d.ts +162 -0
- package/dist/components/table.js +758 -0
- package/dist/components/tabs.d.ts +25 -0
- package/dist/components/tabs.js +162 -0
- package/dist/components/tag.d.ts +41 -0
- package/dist/components/tag.js +88 -0
- package/dist/components/tags-input.d.ts +40 -0
- package/dist/components/tags-input.js +239 -0
- package/dist/components/textarea.d.ts +13 -0
- package/dist/components/textarea.js +16 -0
- package/dist/components/theme.d.ts +41 -0
- package/dist/components/theme.js +112 -0
- package/dist/components/time-field.d.ts +51 -0
- package/dist/components/time-field.js +437 -0
- package/dist/components/timeline.d.ts +76 -0
- package/dist/components/timeline.js +99 -0
- package/dist/components/toast.d.ts +72 -0
- package/dist/components/toast.js +196 -0
- package/dist/components/toggle-group.d.ts +41 -0
- package/dist/components/toggle-group.js +140 -0
- package/dist/components/toggle.d.ts +23 -0
- package/dist/components/toggle.js +35 -0
- package/dist/components/tool-call.d.ts +52 -0
- package/dist/components/tool-call.js +57 -0
- package/dist/components/toolbar.d.ts +17 -0
- package/dist/components/toolbar.js +34 -0
- package/dist/components/tooltip.d.ts +42 -0
- package/dist/components/tooltip.js +47 -0
- package/dist/components/tree.d.ts +75 -0
- package/dist/components/tree.js +636 -0
- package/dist/components/typography.d.ts +134 -0
- package/dist/components/typography.js +176 -0
- package/dist/components/video-player.d.ts +276 -0
- package/dist/components/video-player.js +1352 -0
- package/dist/components/whiteboard.d.ts +80 -0
- package/dist/components/whiteboard.js +389 -0
- package/dist/index.d.ts +85 -0
- package/dist/index.js +86 -0
- package/dist/lib/cn.d.ts +20 -0
- package/dist/lib/cn.js +38 -0
- package/dist/lib/code-highlight.d.ts +31 -0
- package/dist/lib/code-highlight.js +24 -0
- package/dist/lib/code-theme.d.ts +19 -0
- package/dist/lib/code-theme.js +140 -0
- package/dist/lib/collapse-row.d.ts +9 -0
- package/dist/lib/collapse-row.js +129 -0
- package/dist/lib/digit-roll.d.ts +21 -0
- package/dist/lib/digit-roll.js +31 -0
- package/dist/lib/editorial-assets.d.ts +16 -0
- package/dist/lib/editorial-assets.js +56 -0
- package/dist/lib/figure/catalog.d.ts +127 -0
- package/dist/lib/figure/catalog.js +130 -0
- package/dist/lib/figure/figures/automation.d.ts +7 -0
- package/dist/lib/figure/figures/automation.js +143 -0
- package/dist/lib/figure/figures/bar-chart.d.ts +7 -0
- package/dist/lib/figure/figures/bar-chart.js +99 -0
- package/dist/lib/figure/figures/brackets-classic.d.ts +11 -0
- package/dist/lib/figure/figures/brackets-classic.js +170 -0
- package/dist/lib/figure/figures/brackets.d.ts +8 -0
- package/dist/lib/figure/figures/brackets.js +84 -0
- package/dist/lib/figure/figures/city.d.ts +7 -0
- package/dist/lib/figure/figures/city.js +93 -0
- package/dist/lib/figure/figures/conveyor.d.ts +7 -0
- package/dist/lib/figure/figures/conveyor.js +97 -0
- package/dist/lib/figure/figures/database.d.ts +7 -0
- package/dist/lib/figure/figures/database.js +65 -0
- package/dist/lib/figure/figures/documents.d.ts +7 -0
- package/dist/lib/figure/figures/documents.js +83 -0
- package/dist/lib/figure/figures/inbox.d.ts +7 -0
- package/dist/lib/figure/figures/inbox.js +92 -0
- package/dist/lib/figure/figures/laptop.d.ts +7 -0
- package/dist/lib/figure/figures/laptop.js +67 -0
- package/dist/lib/figure/figures/monitor.d.ts +7 -0
- package/dist/lib/figure/figures/monitor.js +59 -0
- package/dist/lib/figure/figures/pipeline.d.ts +8 -0
- package/dist/lib/figure/figures/pipeline.js +117 -0
- package/dist/lib/figure/figures/platform.d.ts +7 -0
- package/dist/lib/figure/figures/platform.js +117 -0
- package/dist/lib/figure/figures/server.d.ts +7 -0
- package/dist/lib/figure/figures/server.js +115 -0
- package/dist/lib/figure/figures/spreadsheet.d.ts +7 -0
- package/dist/lib/figure/figures/spreadsheet.js +87 -0
- package/dist/lib/figure/figures/timeline.d.ts +7 -0
- package/dist/lib/figure/figures/timeline.js +65 -0
- package/dist/lib/figure/kernel.d.ts +152 -0
- package/dist/lib/figure/kernel.js +576 -0
- package/dist/lib/figure/parts.d.ts +42 -0
- package/dist/lib/figure/parts.js +126 -0
- package/dist/lib/form-reset.d.ts +11 -0
- package/dist/lib/form-reset.js +22 -0
- package/dist/lib/glide.d.ts +53 -0
- package/dist/lib/glide.js +138 -0
- package/dist/lib/graph-layout.d.ts +58 -0
- package/dist/lib/graph-layout.js +200 -0
- package/dist/lib/illustration-drawings.d.ts +89 -0
- package/dist/lib/illustration-drawings.js +539 -0
- package/dist/lib/illustration-info.d.ts +37 -0
- package/dist/lib/illustration-info.js +22 -0
- package/dist/lib/illustration-library.d.ts +87 -0
- package/dist/lib/illustration-library.js +352 -0
- package/dist/lib/logo-geometry.d.ts +29 -0
- package/dist/lib/logo-geometry.js +67 -0
- package/dist/lib/markdown-guard.d.ts +16 -0
- package/dist/lib/markdown-guard.js +123 -0
- package/dist/lib/merge-refs.d.ts +10 -0
- package/dist/lib/merge-refs.js +26 -0
- package/dist/lib/motion.d.ts +6 -0
- package/dist/lib/motion.js +12 -0
- package/dist/lib/pdf-worker.d.ts +1 -0
- package/dist/lib/pdf-worker.js +6 -0
- package/dist/lib/pdf.d.ts +19 -0
- package/dist/lib/pdf.js +58 -0
- package/dist/lib/platform.d.ts +33 -0
- package/dist/lib/platform.js +68 -0
- package/dist/lib/room.d.ts +25 -0
- package/dist/lib/room.js +46 -0
- package/dist/lib/table-fit.d.ts +143 -0
- package/dist/lib/table-fit.js +577 -0
- package/dist/lib/theme-script.d.ts +18 -0
- package/dist/lib/theme-script.js +29 -0
- package/dist/styles/expressive.css +188 -0
- package/dist/styles/fonts.css +145 -0
- package/dist/styles/index.css +206 -0
- package/dist/styles/material.css +313 -0
- package/dist/styles/parts/ai.css +360 -0
- package/dist/styles/parts/brand.css +75 -0
- package/dist/styles/parts/controls.css +725 -0
- package/dist/styles/parts/data.css +222 -0
- package/dist/styles/parts/editorial.css +120 -0
- package/dist/styles/parts/feedback.css +273 -0
- package/dist/styles/parts/foundations.css +166 -0
- package/dist/styles/parts/graph.css +214 -0
- package/dist/styles/parts/inputs.css +261 -0
- package/dist/styles/parts/isometric.css +124 -0
- package/dist/styles/parts/navigation.css +232 -0
- package/dist/styles/parts/overlays.css +250 -0
- package/dist/styles/parts/pdf.css +154 -0
- package/dist/styles/parts/react-flow.css +519 -0
- package/dist/styles/parts/whiteboard.css +855 -0
- package/dist/styles/tokens.css +290 -0
- package/dist/vite.d.ts +116 -0
- package/dist/vite.js +129 -0
- package/package.json +188 -5
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brackets, classic — the first iso mark, kept as it was: solid faces in true 30° isometric, ink
|
|
3
|
+
* brackets on a white plinth. When the pointer is on it, the brackets open apart like the website
|
|
4
|
+
* logo; they close again when it leaves.
|
|
5
|
+
*
|
|
6
|
+
* It does not follow the hairline rules on purpose — it is the solid drawing, with its own
|
|
7
|
+
* projection and tones (the `so-*` classes in isometric.css).
|
|
8
|
+
*/
|
|
9
|
+
import { Spring, VIEW } from "../kernel.js";
|
|
10
|
+
/* The exact logo geometry, in stroke units (one unit = the width of a bracket stroke). */
|
|
11
|
+
const STROKE = 36.773437;
|
|
12
|
+
const u = (n) => n / STROKE;
|
|
13
|
+
const H = 264.53125 / STROKE;
|
|
14
|
+
const MARK_W = u(262.46875);
|
|
15
|
+
const LEFT = (() => {
|
|
16
|
+
const sx = u(56.4375);
|
|
17
|
+
const armTop = H - u(56.355469);
|
|
18
|
+
return [
|
|
19
|
+
[sx, 0],
|
|
20
|
+
[sx + 1, 0],
|
|
21
|
+
[sx + 1, H],
|
|
22
|
+
[sx, H],
|
|
23
|
+
[sx, armTop],
|
|
24
|
+
[0, armTop],
|
|
25
|
+
[0, armTop - 1],
|
|
26
|
+
[sx, armTop - 1],
|
|
27
|
+
];
|
|
28
|
+
})();
|
|
29
|
+
const RIGHT = (() => {
|
|
30
|
+
const sx = u(169.339844);
|
|
31
|
+
const zBottom = H - u(262.378906);
|
|
32
|
+
const armX = u(169.257813 + 93.210937);
|
|
33
|
+
const armTop = H - u(112.808594);
|
|
34
|
+
return [
|
|
35
|
+
[sx, zBottom],
|
|
36
|
+
[sx + 1, zBottom],
|
|
37
|
+
[sx + 1, armTop - 1],
|
|
38
|
+
[armX, armTop - 1],
|
|
39
|
+
[armX, armTop],
|
|
40
|
+
[sx + 1, armTop],
|
|
41
|
+
[sx + 1, H],
|
|
42
|
+
[sx, H],
|
|
43
|
+
];
|
|
44
|
+
})();
|
|
45
|
+
/** True isometric: x to the lower right, y to the lower left, z up. */
|
|
46
|
+
const COS = Math.cos(Math.PI / 6);
|
|
47
|
+
const iso = (x, y, z) => [(x - y) * COS, (x + y) * 0.5 - z];
|
|
48
|
+
const PAD = 1.1;
|
|
49
|
+
const OPEN = 0.75;
|
|
50
|
+
const [Y0, DEPTH] = [0.6, 1.4];
|
|
51
|
+
/** The faces of an outline in the x–z plane, extruded along y: sides back to front, then the front. */
|
|
52
|
+
function prism(outline) {
|
|
53
|
+
const n = outline.length;
|
|
54
|
+
const Y = Y0 + DEPTH;
|
|
55
|
+
let area = 0;
|
|
56
|
+
for (let i = 0; i < n; i++) {
|
|
57
|
+
const [ax, az] = outline[i];
|
|
58
|
+
const [bx, bz] = outline[(i + 1) % n];
|
|
59
|
+
area += ax * bz - bx * az;
|
|
60
|
+
}
|
|
61
|
+
const sides = [];
|
|
62
|
+
for (let i = 0; i < n; i++) {
|
|
63
|
+
const [ax, az] = outline[i];
|
|
64
|
+
const [bx, bz] = outline[(i + 1) % n];
|
|
65
|
+
const nx = area > 0 ? bz - az : az - bz;
|
|
66
|
+
const nz = area > 0 ? ax - bx : bx - ax;
|
|
67
|
+
if (nx <= 0 && nz <= 0)
|
|
68
|
+
continue;
|
|
69
|
+
sides.push({
|
|
70
|
+
pts: [
|
|
71
|
+
[ax, Y0, az],
|
|
72
|
+
[bx, Y0, bz],
|
|
73
|
+
[bx, Y, bz],
|
|
74
|
+
[ax, Y, az],
|
|
75
|
+
],
|
|
76
|
+
tone: nz > 0 ? "ink-top" : "ink-right",
|
|
77
|
+
// By the face's nearest point: a tall side's middle sits low.
|
|
78
|
+
key: Math.max(ax + az, bx + bz),
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
sides.sort((a, b) => a.key - b.key);
|
|
82
|
+
return [...sides, { pts: outline.map(([x, z]) => [x, Y, z]), tone: "ink-left" }];
|
|
83
|
+
}
|
|
84
|
+
const figure = {
|
|
85
|
+
mount(ctx) {
|
|
86
|
+
const [x0, x1, y0, y1, z0] = [-PAD, MARK_W + PAD, -0.4, 3.0, -1];
|
|
87
|
+
const plinth = [
|
|
88
|
+
{
|
|
89
|
+
pts: [
|
|
90
|
+
[x0 - 0.5, y0 - 0.5, z0],
|
|
91
|
+
[x1 + 0.5, y0 - 0.5, z0],
|
|
92
|
+
[x1 + 0.5, y1 + 0.5, z0],
|
|
93
|
+
[x0 - 0.5, y1 + 0.5, z0],
|
|
94
|
+
],
|
|
95
|
+
tone: "shadow",
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
pts: [
|
|
99
|
+
[x1, y0, z0],
|
|
100
|
+
[x1, y1, z0],
|
|
101
|
+
[x1, y1, 0],
|
|
102
|
+
[x1, y0, 0],
|
|
103
|
+
],
|
|
104
|
+
tone: "right",
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
pts: [
|
|
108
|
+
[x0, y1, z0],
|
|
109
|
+
[x1, y1, z0],
|
|
110
|
+
[x1, y1, 0],
|
|
111
|
+
[x0, y1, 0],
|
|
112
|
+
],
|
|
113
|
+
tone: "left",
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
pts: [
|
|
117
|
+
[x0, y0, 0],
|
|
118
|
+
[x1, y0, 0],
|
|
119
|
+
[x1, y1, 0],
|
|
120
|
+
[x0, y1, 0],
|
|
121
|
+
],
|
|
122
|
+
tone: "top",
|
|
123
|
+
},
|
|
124
|
+
];
|
|
125
|
+
const left = prism(LEFT);
|
|
126
|
+
const right = prism(RIGHT);
|
|
127
|
+
// Fit every point of the open pose in the frame.
|
|
128
|
+
const all = [
|
|
129
|
+
...plinth.flatMap((f) => f.pts),
|
|
130
|
+
...left.flatMap((f) => f.pts.map(([x, y, z]) => [x - OPEN, y, z])),
|
|
131
|
+
...right.flatMap((f) => f.pts.map(([x, y, z]) => [x + OPEN, y, z])),
|
|
132
|
+
].map(([x, y, z]) => iso(x, y, z));
|
|
133
|
+
const xs = all.map((p) => p[0]);
|
|
134
|
+
const ys = all.map((p) => p[1]);
|
|
135
|
+
const [minX, maxX, minY, maxY] = [Math.min(...xs), Math.max(...xs), Math.min(...ys), Math.max(...ys)];
|
|
136
|
+
const S = Math.min((VIEW.w - 56) / (maxX - minX), (VIEW.h - 56) / (maxY - minY));
|
|
137
|
+
const ox = VIEW.cx - (S * (minX + maxX)) / 2;
|
|
138
|
+
const oy = VIEW.cy - (S * (minY + maxY)) / 2;
|
|
139
|
+
const P = (x, y, z, dx = 0) => {
|
|
140
|
+
const [sx, sy] = iso(x + dx, y, z);
|
|
141
|
+
return `${(ox + S * sx).toFixed(2)},${(oy + S * sy).toFixed(2)}`;
|
|
142
|
+
};
|
|
143
|
+
const d = (pts, dx = 0) => `M${pts.map(([x, y, z]) => P(x, y, z, dx)).join("L")}Z`;
|
|
144
|
+
for (const f of plinth)
|
|
145
|
+
ctx.path(`so-${f.tone}`).attr("d", d(f.pts));
|
|
146
|
+
// The engraved line along the plinth's front.
|
|
147
|
+
ctx.path("so-detail").attr("d", `M${P(x0 + 0.5, y1, z0 + 0.5)}L${P(x1 - 0.5, y1, z0 + 0.5)}`);
|
|
148
|
+
const parts = (faces) => {
|
|
149
|
+
const g = ctx.g();
|
|
150
|
+
return faces.map((f) => ({ f, node: ctx.path(`so-${f.tone}`, g) }));
|
|
151
|
+
};
|
|
152
|
+
const l = parts(left);
|
|
153
|
+
const r = parts(right);
|
|
154
|
+
const gap = new Spring(0, 170, 22);
|
|
155
|
+
const draw = () => {
|
|
156
|
+
for (const { f, node } of l)
|
|
157
|
+
node.attr("d", d(f.pts, -gap.x));
|
|
158
|
+
for (const { f, node } of r)
|
|
159
|
+
node.attr("d", d(f.pts, gap.x));
|
|
160
|
+
};
|
|
161
|
+
ctx.loop((dt) => {
|
|
162
|
+
gap.t = ctx.pointer.over ? OPEN : 0;
|
|
163
|
+
const moving = gap.step(dt, ctx.reduced);
|
|
164
|
+
draw();
|
|
165
|
+
return moving;
|
|
166
|
+
});
|
|
167
|
+
draw();
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
export default figure;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brackets — the zon mark on a plinth, built from its own two brackets. As the pointer comes
|
|
3
|
+
* near, each bracket lets go of its arm: the arms drop onto the plinth and land with a small bounce,
|
|
4
|
+
* the right one a beat after the left. When the pointer leaves they rise back into place.
|
|
5
|
+
*/
|
|
6
|
+
import { type Figure } from "../kernel.js";
|
|
7
|
+
declare const figure: Figure;
|
|
8
|
+
export default figure;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brackets — the zon mark on a plinth, built from its own two brackets. As the pointer comes
|
|
3
|
+
* near, each bracket lets go of its arm: the arms drop onto the plinth and land with a small bounce,
|
|
4
|
+
* the right one a beat after the left. When the pointer leaves they rise back into place.
|
|
5
|
+
*/
|
|
6
|
+
import { Spring, fit } from "../kernel.js";
|
|
7
|
+
import { BRACKETS, MARK_H, MARK_W } from "../parts.js";
|
|
8
|
+
const figure = {
|
|
9
|
+
mount(ctx) {
|
|
10
|
+
const pad = 1.2;
|
|
11
|
+
const [y0, y1] = [0.6, 2.0];
|
|
12
|
+
const cam = fit([
|
|
13
|
+
[-pad, -0.6, -1],
|
|
14
|
+
[MARK_W + pad, 3.2, MARK_H + 0.3],
|
|
15
|
+
], 34);
|
|
16
|
+
ctx.box(-pad, -0.6, MARK_W + pad, 3.2, -1, 0, { r: 0.7, b: 0.4 }).draw(cam);
|
|
17
|
+
// Where each arm lands: a dim mark on the plinth, under it.
|
|
18
|
+
const marks = ctx.path("guide");
|
|
19
|
+
marks.attr("d", [BRACKETS.left.arm, BRACKETS.right.arm]
|
|
20
|
+
.map(([x0, x1]) => {
|
|
21
|
+
const pts = [cam.P(x0, y1 + 0.3, 0), cam.P(x1, y1 + 0.3, 0)];
|
|
22
|
+
return `M${pts[0].join(" ")}L${pts[1].join(" ")}`;
|
|
23
|
+
})
|
|
24
|
+
.join(""));
|
|
25
|
+
const box = (b) => ctx.box(b[0], y0, b[1], y1, b[2], b[3], { r: 0.14, b: 0.14 });
|
|
26
|
+
// Left: the arm behind its stem; right: the stem behind its arm — each joint hides itself.
|
|
27
|
+
const leftArm = box(BRACKETS.left.arm);
|
|
28
|
+
const leftStem = box(BRACKETS.left.stem);
|
|
29
|
+
const rightStem = box(BRACKETS.right.stem);
|
|
30
|
+
const rightArm = box(BRACKETS.right.arm);
|
|
31
|
+
leftStem.draw(cam);
|
|
32
|
+
rightStem.draw(cam);
|
|
33
|
+
// How far each arm falls to reach the plinth.
|
|
34
|
+
const fallL = BRACKETS.left.arm[2];
|
|
35
|
+
const fallR = BRACKETS.right.arm[2];
|
|
36
|
+
// A bouncier spring than the rule's: these land.
|
|
37
|
+
const dropL = new Spring(0, 140, 9);
|
|
38
|
+
const dropR = new Spring(0, 140, 9);
|
|
39
|
+
let dropped = false;
|
|
40
|
+
let changed = -Infinity;
|
|
41
|
+
const draw = () => {
|
|
42
|
+
leftArm.draw(cam, [0, 0, -dropL.x * fallL]);
|
|
43
|
+
rightArm.draw(cam, [0, 0, -dropR.x * fallR]);
|
|
44
|
+
// The arm that has let go is the bright one; at rest, the left arm marks where to look.
|
|
45
|
+
leftArm.hi(dropL.x < 0.5 || dropR.x < 0.5);
|
|
46
|
+
rightArm.hi(dropR.x >= 0.5 && dropL.x >= 0.5);
|
|
47
|
+
};
|
|
48
|
+
ctx.loop((dt, now) => {
|
|
49
|
+
const p = ctx.pointer;
|
|
50
|
+
const [cx, cy] = cam.P(MARK_W / 2, (y0 + y1) / 2, MARK_H / 2);
|
|
51
|
+
// Near the mark (a frame distance, for a tall thing), with a little hysteresis.
|
|
52
|
+
const d = Math.hypot(p.x - cx, p.y - cy);
|
|
53
|
+
const near = p.over && d < (dropped ? 175 : 140);
|
|
54
|
+
if (near !== dropped) {
|
|
55
|
+
dropped = near;
|
|
56
|
+
changed = now;
|
|
57
|
+
}
|
|
58
|
+
// The left arm goes first and the right follows 110ms later; on the way up the order turns.
|
|
59
|
+
const since = now - changed;
|
|
60
|
+
if (dropped) {
|
|
61
|
+
dropL.t = 1;
|
|
62
|
+
dropR.t = since > 110 ? 1 : 0;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
dropR.t = 0;
|
|
66
|
+
dropL.t = since > 110 ? 0 : 1;
|
|
67
|
+
}
|
|
68
|
+
let moving = false;
|
|
69
|
+
for (const s of [dropL, dropR]) {
|
|
70
|
+
if (s.step(dt, ctx.reduced))
|
|
71
|
+
moving = true;
|
|
72
|
+
// An arm meets the plinth and bounces off it, a little lower each time.
|
|
73
|
+
if (s.x > 1) {
|
|
74
|
+
s.x = 1;
|
|
75
|
+
s.v = -Math.abs(s.v) * 0.32;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
draw();
|
|
79
|
+
return moving || since < 200;
|
|
80
|
+
});
|
|
81
|
+
draw();
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
export default figure;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* City — systems as buildings on a grid, joined along the streets. The building nearest the pointer
|
|
3
|
+
* rises and pulses run out along its connections to the systems it talks to.
|
|
4
|
+
*/
|
|
5
|
+
import { type Figure } from "../kernel.js";
|
|
6
|
+
declare const figure: Figure;
|
|
7
|
+
export default figure;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* City — systems as buildings on a grid, joined along the streets. The building nearest the pointer
|
|
3
|
+
* rises and pulses run out along its connections to the systems it talks to.
|
|
4
|
+
*/
|
|
5
|
+
import { Spring, falloff, fit, hash } from "../kernel.js";
|
|
6
|
+
import { faceLine, frontFace, pulse } from "../parts.js";
|
|
7
|
+
const figure = {
|
|
8
|
+
mount(ctx) {
|
|
9
|
+
const n = 4;
|
|
10
|
+
const cell = 3;
|
|
11
|
+
const fs = 1.7;
|
|
12
|
+
const G = n * cell;
|
|
13
|
+
const cam = fit([
|
|
14
|
+
[0, 0, 0],
|
|
15
|
+
[G, G, 0],
|
|
16
|
+
[0, 0, 4.4],
|
|
17
|
+
[G, 0, 4.4],
|
|
18
|
+
], 24);
|
|
19
|
+
ctx.box(0, 0, G, G, -0.3, 0, { r: 0.8, b: 0.5 }).draw(cam);
|
|
20
|
+
const blds = Array.from({ length: n * n }, (_, i) => {
|
|
21
|
+
const x = (i % n) * cell + cell / 2;
|
|
22
|
+
const y = Math.floor(i / n) * cell + cell / 2;
|
|
23
|
+
return { x, y, h: 0.8 + hash(i + 3) * 2.8, i };
|
|
24
|
+
});
|
|
25
|
+
// Each building talks to its neighbours to the east and south, some of them.
|
|
26
|
+
const links = [];
|
|
27
|
+
blds.forEach((b) => {
|
|
28
|
+
const right = b.i % n < n - 1 ? b.i + 1 : -1;
|
|
29
|
+
const down = b.i + n < n * n ? b.i + n : -1;
|
|
30
|
+
for (const j of [right, down]) {
|
|
31
|
+
if (j < 0 || hash(b.i * 7 + j) < 0.35)
|
|
32
|
+
continue;
|
|
33
|
+
const o = blds[j];
|
|
34
|
+
links.push({ a: b.i, b: j, route: [[b.x, b.y, 0.02], [o.x, o.y, 0.02]] });
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
const streets = ctx.path("guide");
|
|
38
|
+
streets.attr("d", links.map((l) => `M${cam.P(...l.route[0]).join(" ")}L${cam.P(...l.route[1]).join(" ")}`).join(""));
|
|
39
|
+
const flows = ctx.path("pulse");
|
|
40
|
+
const order = [...blds].sort((p, q) => p.x + p.y - (q.x + q.y));
|
|
41
|
+
const boxes = [];
|
|
42
|
+
const windows = [];
|
|
43
|
+
for (const b of order) {
|
|
44
|
+
const box = ctx.box(b.x - fs / 2, b.y - fs / 2, b.x + fs / 2, b.y + fs / 2, 0, b.h, { r: 0.25, b: 0.18 });
|
|
45
|
+
boxes[b.i] = box;
|
|
46
|
+
windows[b.i] = ctx.path("crease", box.g);
|
|
47
|
+
}
|
|
48
|
+
const lift = blds.map(() => new Spring(0));
|
|
49
|
+
let near = -1;
|
|
50
|
+
let phase = 0;
|
|
51
|
+
const restLink = links.length ? links[Math.floor(links.length / 2)] : null;
|
|
52
|
+
const draw = () => {
|
|
53
|
+
blds.forEach((b) => {
|
|
54
|
+
const z = lift[b.i].x;
|
|
55
|
+
boxes[b.i].draw(cam, [0, 0, z]).hi(b.i === near);
|
|
56
|
+
const f = frontFace(cam, b.x - fs / 2, b.y + fs / 2, z);
|
|
57
|
+
const floors = Math.max(1, Math.floor(b.h / 0.7));
|
|
58
|
+
windows[b.i].attr("d", Array.from({ length: floors }, (_, k) => faceLine(f, [0.35, 0.45 + k * 0.62], [fs - 0.35, 0.45 + k * 0.62])).join(""));
|
|
59
|
+
});
|
|
60
|
+
const active = near < 0 ? (restLink ? [restLink] : []) : links.filter((l) => l.a === near || l.b === near);
|
|
61
|
+
flows.attr("d", active
|
|
62
|
+
.map((l) => {
|
|
63
|
+
const out = near < 0 || l.a === near ? l.route : [...l.route].reverse();
|
|
64
|
+
return pulse(cam, out, phase % 1.3, 0.9);
|
|
65
|
+
})
|
|
66
|
+
.join(""));
|
|
67
|
+
};
|
|
68
|
+
ctx.loop((dt) => {
|
|
69
|
+
const p = ctx.pointer;
|
|
70
|
+
near = -1;
|
|
71
|
+
if (p.over) {
|
|
72
|
+
const [gx, gy] = cam.unproj(p.x, p.y, 0);
|
|
73
|
+
let bd = Infinity;
|
|
74
|
+
blds.forEach((b) => {
|
|
75
|
+
const d = Math.hypot(gx - b.x, gy - b.y);
|
|
76
|
+
lift[b.i].t = 0.55 * falloff(d, 5);
|
|
77
|
+
if (d < bd)
|
|
78
|
+
[near, bd] = [b.i, d];
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
else
|
|
82
|
+
lift.forEach((s) => (s.t = 0));
|
|
83
|
+
if (!ctx.reduced)
|
|
84
|
+
phase += dt * (near < 0 ? 0.35 : 0.9);
|
|
85
|
+
for (const s of lift)
|
|
86
|
+
s.step(dt, ctx.reduced);
|
|
87
|
+
draw();
|
|
88
|
+
return true;
|
|
89
|
+
});
|
|
90
|
+
draw();
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
export default figure;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conveyor — crates ride a belt from a dispenser, through a press, into a receiver. The press comes
|
|
3
|
+
* down on each crate as it passes and leaves the mark on its lid.
|
|
4
|
+
*/
|
|
5
|
+
import { type Figure } from "../kernel.js";
|
|
6
|
+
declare const figure: Figure;
|
|
7
|
+
export default figure;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conveyor — crates ride a belt from a dispenser, through a press, into a receiver. The press comes
|
|
3
|
+
* down on each crate as it passes and leaves the mark on its lid.
|
|
4
|
+
*/
|
|
5
|
+
import { clamp, fit, line, rrect } from "../kernel.js";
|
|
6
|
+
import { faceLine, markOutline, poly, topFace } from "../parts.js";
|
|
7
|
+
const figure = {
|
|
8
|
+
mount(ctx) {
|
|
9
|
+
const L = 14;
|
|
10
|
+
const D = 2.6;
|
|
11
|
+
const zb = 1.2;
|
|
12
|
+
const zt = 1.85;
|
|
13
|
+
const gate = 7;
|
|
14
|
+
const [inX, outX] = [2.1, 11.9];
|
|
15
|
+
const cs = 1.3;
|
|
16
|
+
const ch = 1.0;
|
|
17
|
+
const cam = fit([
|
|
18
|
+
[0, 0, 0],
|
|
19
|
+
[L, D, 0],
|
|
20
|
+
[0, 0, zt + 4],
|
|
21
|
+
[L, D, zt + 2],
|
|
22
|
+
], 26);
|
|
23
|
+
// Legs, the dispenser behind the belt's start, and the belt.
|
|
24
|
+
for (const x of [2.6, 11.0])
|
|
25
|
+
for (const y of [0.3, D - 0.8])
|
|
26
|
+
ctx.box(x, y, x + 0.5, y + 0.5, 0, zb, { r: 0.1, b: 0 }).draw(cam);
|
|
27
|
+
ctx.box(-0.2, -0.3, inX, D + 0.3, 0, zt + 1.9, { r: 0.4, b: 0.25 }).draw(cam);
|
|
28
|
+
ctx.box(inX - 0.1, 0, L - 1.9, D, zb, zt, { r: 0.35, b: 0.2 }).draw(cam);
|
|
29
|
+
const slats = ctx.path("crease");
|
|
30
|
+
const front = ctx.path("crease");
|
|
31
|
+
front.attr("d", faceLine((a, b) => cam.P(a, D, b), [inX + 0.3, zb + 0.32], [L - 2.2, zb + 0.32]));
|
|
32
|
+
// The press frame's back posts.
|
|
33
|
+
const post = (x, y) => ctx.box(x, y, x + 0.42, y + 0.42, zt, zt + 3.4, { r: 0.12, b: 0 }).draw(cam);
|
|
34
|
+
post(gate - 1.1, -0.35);
|
|
35
|
+
post(gate + 0.7, -0.35);
|
|
36
|
+
const crates = [];
|
|
37
|
+
for (let k = 0; k < 4; k++) {
|
|
38
|
+
const g = ctx.g();
|
|
39
|
+
crates.push({ g, solid: ctx.solid(g), mark: ctx.path("mid", g) });
|
|
40
|
+
}
|
|
41
|
+
// The ram: a rod through the crossbar and a head that comes down on each crate.
|
|
42
|
+
const rod = ctx.box(gate - 0.11, D / 2 - 0.11, gate + 0.11, D / 2 + 0.11, zt + 1.65, zt + 3.6, { r: 0.08, b: 0 });
|
|
43
|
+
const head = ctx.box(gate - 0.62, D / 2 - 0.62, gate + 0.62, D / 2 + 0.62, zt + 1.3, zt + 1.65, { r: 0.15, b: 0.1 });
|
|
44
|
+
post(gate - 1.1, D - 0.07);
|
|
45
|
+
post(gate + 0.7, D - 0.07);
|
|
46
|
+
ctx.box(gate - 1.1, -0.35, gate + 1.12, D + 0.35, zt + 3.4, zt + 3.85, { r: 0.18, b: 0.12 }).draw(cam);
|
|
47
|
+
ctx.box(outX, -0.3, L + 0.2, D + 0.3, 0, zt + 1.9, { r: 0.4, b: 0.25 }).draw(cam);
|
|
48
|
+
const speed = 1.6;
|
|
49
|
+
let clock = 0;
|
|
50
|
+
const span = outX - inX + cs;
|
|
51
|
+
const mark = markOutline(0.72);
|
|
52
|
+
const draw = () => {
|
|
53
|
+
// The belt's slats move with it.
|
|
54
|
+
const off = (clock * speed) % 1;
|
|
55
|
+
const parts = [];
|
|
56
|
+
for (let x = inX + off; x < L - 2; x += 1)
|
|
57
|
+
parts.push(poly(cam, [[x, 0.2, zt], [x, D - 0.2, zt]]));
|
|
58
|
+
slats.attr("d", parts.join(""));
|
|
59
|
+
let press = 0;
|
|
60
|
+
const order = [];
|
|
61
|
+
crates.forEach((c, k) => {
|
|
62
|
+
// Each crate enters at the dispenser and leaves into the receiver: cut where it is inside them (rule 06).
|
|
63
|
+
const x0 = inX - cs + ((clock * speed + k * (span / 4)) % span);
|
|
64
|
+
const a = Math.max(x0, inX);
|
|
65
|
+
const b = Math.min(x0 + cs, outX);
|
|
66
|
+
const y0 = (D - cs) / 2;
|
|
67
|
+
if (b - a < 0.05) {
|
|
68
|
+
c.solid.sil.attr("d", null);
|
|
69
|
+
c.solid.crease.attr("d", null);
|
|
70
|
+
c.mark.attr("d", null);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const r = Math.min(0.18, (b - a) / 2);
|
|
74
|
+
const ring = rrect(a, y0, b, y0 + cs, r);
|
|
75
|
+
const inner = rrect(a + 0.12, y0 + 0.12, b - 0.12, y0 + cs - 0.12, Math.max(0, r - 0.12));
|
|
76
|
+
c.solid.draw(cam, ring, b - a > 0.3 ? inner : null, zt, zt + ch);
|
|
77
|
+
// Past the press, the lid carries the mark.
|
|
78
|
+
const stamped = x0 + cs / 2 > gate + 0.05 && x0 + 0.15 > inX && x0 + cs - 0.1 < outX;
|
|
79
|
+
const lid = topFace(cam, x0, y0, zt + ch);
|
|
80
|
+
c.mark.attr("d", stamped ? mark.map((m) => line(m.map(([u, v]) => lid(0.28 + u, 0.3 + v * 0.75)), true)).join("") : null);
|
|
81
|
+
press = Math.max(press, clamp(1 - Math.abs(x0 + cs / 2 - gate) / 0.55, 0, 1));
|
|
82
|
+
order.push({ g: c.g, x: x0 });
|
|
83
|
+
});
|
|
84
|
+
ctx.root.order(order.sort((p, q) => p.x - q.x).map((o) => o.g));
|
|
85
|
+
rod.draw(cam, [0, 0, -press * 0.28]);
|
|
86
|
+
head.draw(cam, [0, 0, -press * 0.28]);
|
|
87
|
+
};
|
|
88
|
+
ctx.loop((dt) => {
|
|
89
|
+
if (!ctx.reduced)
|
|
90
|
+
clock += dt;
|
|
91
|
+
draw();
|
|
92
|
+
return true;
|
|
93
|
+
});
|
|
94
|
+
draw();
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
export default figure;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Database — three platters in a stack. The pointer's height opens the stack at that level: the
|
|
3
|
+
* platters above lift clear, and the open platter's read arm is the bright line.
|
|
4
|
+
*/
|
|
5
|
+
import { type Figure } from "../kernel.js";
|
|
6
|
+
declare const figure: Figure;
|
|
7
|
+
export default figure;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Database — three platters in a stack. The pointer's height opens the stack at that level: the
|
|
3
|
+
* platters above lift clear, and the open platter's read arm is the bright line.
|
|
4
|
+
*/
|
|
5
|
+
import { Spring, circle, falloff, fit, line } from "../kernel.js";
|
|
6
|
+
import { bandIndex } from "../parts.js";
|
|
7
|
+
const figure = {
|
|
8
|
+
mount(ctx) {
|
|
9
|
+
const r = 2.3;
|
|
10
|
+
const h = 0.95;
|
|
11
|
+
const gap = 0.18;
|
|
12
|
+
const maxGap = 1.5;
|
|
13
|
+
const top = 3 * h + 2 * gap;
|
|
14
|
+
const cam = fit([
|
|
15
|
+
[-r, -r, 0],
|
|
16
|
+
[r, r, 0],
|
|
17
|
+
[-r, -r, top + 2 * maxGap],
|
|
18
|
+
[r, r, top + 2 * maxGap],
|
|
19
|
+
], 34);
|
|
20
|
+
const ring = circle(0, 0, r, 40);
|
|
21
|
+
const inner = circle(0, 0, r - 0.28, 40);
|
|
22
|
+
const platters = [];
|
|
23
|
+
for (let i = 0; i < 3; i++) {
|
|
24
|
+
const g = ctx.g();
|
|
25
|
+
platters.push({ solid: ctx.solid(g), rings: ctx.path("crease", g), arm: ctx.path("mid", g) });
|
|
26
|
+
}
|
|
27
|
+
// The two gaps: under the middle platter and under the top one.
|
|
28
|
+
const gaps = [new Spring(0.55), new Spring(0)];
|
|
29
|
+
const bands = [0, 1].map((k) => cam.P(0, r, (k + 1) * (h + gap))[1]);
|
|
30
|
+
const draw = () => {
|
|
31
|
+
let lift = 0;
|
|
32
|
+
platters.forEach((p, i) => {
|
|
33
|
+
if (i > 0)
|
|
34
|
+
lift += gaps[i - 1].x;
|
|
35
|
+
const z0 = i * (h + gap) + lift;
|
|
36
|
+
p.solid.draw(cam, ring, inner, z0, z0 + h);
|
|
37
|
+
const at = (pts) => pts.map(([x, y]) => cam.P(x, y, z0 + h));
|
|
38
|
+
p.rings.attr("d", [1.55, 0.95, 0.42].map((rr) => line(at(circle(0, 0, rr, 32)), true)).join(""));
|
|
39
|
+
p.arm.attr("d", line(at([[0.25, 0.55], [1.15, 1.75]])));
|
|
40
|
+
});
|
|
41
|
+
// The read arm of the platter most open above is the bright line.
|
|
42
|
+
const open = gaps[0].x >= gaps[1].x ? 0 : 1;
|
|
43
|
+
platters.forEach((p, i) => p.arm.cls("hi", i === open));
|
|
44
|
+
};
|
|
45
|
+
ctx.loop((dt) => {
|
|
46
|
+
const p = ctx.pointer;
|
|
47
|
+
if (p.over) {
|
|
48
|
+
const f = bandIndex(p.y, bands);
|
|
49
|
+
gaps.forEach((s, k) => (s.t = maxGap * falloff(Math.abs(k - f), 1.2)));
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
gaps[0].t = 0.55;
|
|
53
|
+
gaps[1].t = 0;
|
|
54
|
+
}
|
|
55
|
+
let moving = false;
|
|
56
|
+
for (const s of gaps)
|
|
57
|
+
if (s.step(dt, ctx.reduced))
|
|
58
|
+
moving = true;
|
|
59
|
+
draw();
|
|
60
|
+
return moving;
|
|
61
|
+
});
|
|
62
|
+
draw();
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
export default figure;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Documents — a stack of pages to sign. On the stack the top page lifts and slides out, and the
|
|
3
|
+
* signature writes itself as far as the pointer has moved across the page.
|
|
4
|
+
*/
|
|
5
|
+
import { type Figure } from "../kernel.js";
|
|
6
|
+
declare const figure: Figure;
|
|
7
|
+
export default figure;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Documents — a stack of pages to sign. On the stack the top page lifts and slides out, and the
|
|
3
|
+
* signature writes itself as far as the pointer has moved across the page.
|
|
4
|
+
*/
|
|
5
|
+
import { Spring, clamp, fit, line } from "../kernel.js";
|
|
6
|
+
import { faceLine, faceRect, topFace } from "../parts.js";
|
|
7
|
+
/** A hand-drawn flourish: loops along the line, like a signature (no letters, rule 10). */
|
|
8
|
+
const SIGNATURE = (() => {
|
|
9
|
+
const out = [];
|
|
10
|
+
const n = 220;
|
|
11
|
+
for (let i = 0; i <= n; i++) {
|
|
12
|
+
const th = (i / n) * Math.PI * 2 * 6.5;
|
|
13
|
+
// Loops of varying height and spacing, leaning a little, as a hand writes them.
|
|
14
|
+
const amp = 0.1 + 0.07 * Math.abs(Math.sin(th * 0.41 + 0.6));
|
|
15
|
+
out.push([0.062 * th - 0.075 * Math.sin(th) + 0.02 * Math.sin(th * 0.23), -amp * Math.cos(th) - 0.012 * th + 0.05]);
|
|
16
|
+
}
|
|
17
|
+
for (let i = 1; i <= 12; i++) {
|
|
18
|
+
const last = out[out.length - 1];
|
|
19
|
+
out.push([last[0] + 0.06, last[1] - 0.012 * i]);
|
|
20
|
+
}
|
|
21
|
+
return out;
|
|
22
|
+
})();
|
|
23
|
+
const figure = {
|
|
24
|
+
mount(ctx) {
|
|
25
|
+
const w = 4.4;
|
|
26
|
+
const d = 5.6;
|
|
27
|
+
const th = 0.07;
|
|
28
|
+
const cam = fit([
|
|
29
|
+
[0, 0, 0],
|
|
30
|
+
[w + 1.6, d + 0.5, 0],
|
|
31
|
+
[0, 0, 1.2],
|
|
32
|
+
[w + 1.6, d, 1.2],
|
|
33
|
+
], 32);
|
|
34
|
+
// The pile, as it was put down: no two pages quite square.
|
|
35
|
+
const rest = [
|
|
36
|
+
[0.55, 0.35],
|
|
37
|
+
[0.2, 0.2],
|
|
38
|
+
[0.38, 0.06],
|
|
39
|
+
];
|
|
40
|
+
rest.forEach(([x, y], k) => ctx.box(x, y, x + w, y + d, k * 0.12, k * 0.12 + th, { r: 0.12, b: 0 }).draw(cam));
|
|
41
|
+
const pageG = ctx.g();
|
|
42
|
+
const page = ctx.box(0, 0, w, d, 0, th, { r: 0.12, b: 0, parent: pageG });
|
|
43
|
+
const text = ctx.path("crease", pageG);
|
|
44
|
+
const signLine = ctx.path("mid", pageG);
|
|
45
|
+
const signature = ctx.path("hi", pageG);
|
|
46
|
+
const z = 0.36;
|
|
47
|
+
const lift = new Spring(0);
|
|
48
|
+
const slide = new Spring(0);
|
|
49
|
+
const ink = new Spring(0.38);
|
|
50
|
+
const draw = () => {
|
|
51
|
+
const dz = z + lift.x;
|
|
52
|
+
const dx = slide.x;
|
|
53
|
+
page.draw(cam, [dx, 0, dz]);
|
|
54
|
+
const f = topFace(cam, dx, 0, dz + th);
|
|
55
|
+
text.attr("d", faceRect(f, 0.5, 0.55, 1.5, 0.42, 0.1) + [1.45, 1.9, 2.35, 2.8, 3.25].map((v, k) => faceLine(f, [0.5, v], [k === 4 ? 2.3 : k % 2 ? 3.1 : 3.9, v])).join(""));
|
|
56
|
+
signLine.attr("d", faceLine(f, [1.0, 4.85], [3.9, 4.85]) + faceLine(f, [0.62, 4.62], [0.82, 4.82]) + faceLine(f, [0.82, 4.62], [0.62, 4.82]));
|
|
57
|
+
const k = Math.round(clamp(ink.x, 0, 1) * (SIGNATURE.length - 1));
|
|
58
|
+
signature.attr("d", k > 1 ? line(SIGNATURE.slice(0, k + 1).map(([u, v]) => f(1.1 + u, 4.75 + v))) : null);
|
|
59
|
+
};
|
|
60
|
+
ctx.loop((dt) => {
|
|
61
|
+
const p = ctx.pointer;
|
|
62
|
+
if (p.over) {
|
|
63
|
+
const [x] = cam.unproj(p.x, p.y, z);
|
|
64
|
+
lift.t = 0.45;
|
|
65
|
+
slide.t = 0.7;
|
|
66
|
+
ink.t = clamp((x - 0.6) / (w - 0.6), 0, 1);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
lift.t = 0;
|
|
70
|
+
slide.t = 0;
|
|
71
|
+
ink.t = 0.38;
|
|
72
|
+
}
|
|
73
|
+
let moving = false;
|
|
74
|
+
for (const s of [lift, slide, ink])
|
|
75
|
+
if (s.step(dt, ctx.reduced))
|
|
76
|
+
moving = true;
|
|
77
|
+
draw();
|
|
78
|
+
return moving;
|
|
79
|
+
});
|
|
80
|
+
draw();
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
export default figure;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Envelope — its flap hinged at the back edge. The pointer's height opens the flap; past upright it
|
|
3
|
+
* folds back onto the desk and the letter slides out over it, carrying the mark.
|
|
4
|
+
*/
|
|
5
|
+
import { type Figure } from "../kernel.js";
|
|
6
|
+
declare const figure: Figure;
|
|
7
|
+
export default figure;
|