@buoy-gg/shared-ui 7.0.32 → 7.0.34
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/lib/commonjs/JsModal.js +70 -28
- package/lib/commonjs/hooks/index.js +26 -0
- package/lib/commonjs/hooks/safe-area-impl.js +1 -1
- package/lib/commonjs/hooks/useChangeLog.js +55 -0
- package/lib/commonjs/hooks/useEventStoreEvents.js +65 -0
- package/lib/commonjs/hooks/usePersistedState.js +45 -10
- package/lib/commonjs/index.js +143 -0
- package/lib/commonjs/storage/definePersistedSetting.js +67 -0
- package/lib/commonjs/storage/devToolsStorageKeys.js +12 -0
- package/lib/commonjs/storage/index.js +8 -1
- package/lib/commonjs/stores/ChangeLog.js +197 -0
- package/lib/commonjs/stores/createToolStore.js +175 -0
- package/lib/commonjs/stores/index.js +15 -1
- package/lib/commonjs/sync/toolSyncAdapter.js +63 -0
- package/lib/commonjs/sync/wireForm.js +172 -0
- package/lib/commonjs/tools/defineTool.js +79 -0
- package/lib/commonjs/ui/components/ChangeRow.js +110 -0
- package/lib/commonjs/ui/components/ChipStrip.js +94 -0
- package/lib/commonjs/ui/components/DetailViewToggle.js +130 -0
- package/lib/commonjs/ui/components/DevToolsCard.js +3 -1
- package/lib/commonjs/ui/components/EmptyState.js +10 -2
- package/lib/commonjs/ui/components/EntityFilterView.js +354 -0
- package/lib/commonjs/ui/components/ExportPreview.js +174 -0
- package/lib/commonjs/ui/components/InfoRow.js +90 -0
- package/lib/commonjs/ui/components/ModalHeader.js +40 -7
- package/lib/commonjs/ui/components/Pill.js +114 -0
- package/lib/commonjs/ui/components/ToggleRow.js +116 -0
- package/lib/commonjs/ui/components/ToolEmptyState.js +154 -0
- package/lib/commonjs/ui/components/ToolFooter.js +204 -0
- package/lib/commonjs/ui/components/WindowControls.js +8 -5
- package/lib/commonjs/ui/components/index.js +113 -1
- package/lib/commonjs/ui/index.js +36 -2
- package/lib/commonjs/ui/listPresets.js +43 -0
- package/lib/commonjs/ui/night/primitives.js +3 -1
- package/lib/commonjs/ui/otto/OttoSprite.js +510 -0
- package/lib/commonjs/ui/otto/index.js +38 -0
- package/lib/commonjs/ui/otto/ottoEngine.js +2734 -0
- package/lib/commonjs/ui/otto/ottoSheet.js +191 -0
- package/lib/commonjs/utils/snapshotProviderKit.js +167 -0
- package/lib/commonjs/utils/stateTools.js +160 -0
- package/lib/module/JsModal.js +70 -28
- package/lib/module/hooks/index.js +3 -1
- package/lib/module/hooks/safe-area-impl.js +1 -1
- package/lib/module/hooks/useChangeLog.js +50 -0
- package/lib/module/hooks/useEventStoreEvents.js +61 -0
- package/lib/module/hooks/usePersistedState.js +44 -10
- package/lib/module/index.js +11 -1
- package/lib/module/storage/definePersistedSetting.js +63 -0
- package/lib/module/storage/devToolsStorageKeys.js +12 -0
- package/lib/module/storage/index.js +2 -1
- package/lib/module/stores/ChangeLog.js +192 -0
- package/lib/module/stores/createToolStore.js +171 -0
- package/lib/module/stores/index.js +3 -1
- package/lib/module/sync/toolSyncAdapter.js +58 -0
- package/lib/module/sync/wireForm.js +159 -0
- package/lib/module/tools/defineTool.js +74 -0
- package/lib/module/ui/components/ChangeRow.js +105 -0
- package/lib/module/ui/components/ChipStrip.js +91 -0
- package/lib/module/ui/components/DetailViewToggle.js +125 -0
- package/lib/module/ui/components/DevToolsCard.js +3 -1
- package/lib/module/ui/components/EmptyState.js +10 -2
- package/lib/module/ui/components/EntityFilterView.js +350 -0
- package/lib/module/ui/components/ExportPreview.js +169 -0
- package/lib/module/ui/components/InfoRow.js +86 -0
- package/lib/module/ui/components/ModalHeader.js +40 -7
- package/lib/module/ui/components/Pill.js +110 -0
- package/lib/module/ui/components/ToggleRow.js +112 -0
- package/lib/module/ui/components/ToolEmptyState.js +149 -0
- package/lib/module/ui/components/ToolFooter.js +196 -0
- package/lib/module/ui/components/WindowControls.js +8 -5
- package/lib/module/ui/components/index.js +13 -1
- package/lib/module/ui/index.js +7 -1
- package/lib/module/ui/listPresets.js +39 -0
- package/lib/module/ui/night/primitives.js +3 -1
- package/lib/module/ui/otto/OttoSprite.js +496 -0
- package/lib/module/ui/otto/index.js +20 -0
- package/lib/module/ui/otto/ottoEngine.js +2726 -0
- package/lib/module/ui/otto/ottoSheet.js +180 -0
- package/lib/module/utils/snapshotProviderKit.js +156 -0
- package/lib/module/utils/stateTools.js +154 -0
- package/lib/typescript/commonjs/JsModal.d.ts.map +1 -1
- package/lib/typescript/commonjs/hooks/index.d.ts +3 -1
- package/lib/typescript/commonjs/hooks/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/hooks/safe-area-impl.d.ts +1 -1
- package/lib/typescript/commonjs/hooks/useChangeLog.d.ts +38 -0
- package/lib/typescript/commonjs/hooks/useChangeLog.d.ts.map +1 -0
- package/lib/typescript/commonjs/hooks/useEventStoreEvents.d.ts +25 -0
- package/lib/typescript/commonjs/hooks/useEventStoreEvents.d.ts.map +1 -0
- package/lib/typescript/commonjs/hooks/usePersistedState.d.ts +34 -5
- package/lib/typescript/commonjs/hooks/usePersistedState.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +6 -1
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/storage/definePersistedSetting.d.ts +39 -0
- package/lib/typescript/commonjs/storage/definePersistedSetting.d.ts.map +1 -0
- package/lib/typescript/commonjs/storage/devToolsStorageKeys.d.ts +12 -0
- package/lib/typescript/commonjs/storage/devToolsStorageKeys.d.ts.map +1 -1
- package/lib/typescript/commonjs/storage/index.d.ts +1 -0
- package/lib/typescript/commonjs/storage/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/stores/ChangeLog.d.ts +100 -0
- package/lib/typescript/commonjs/stores/ChangeLog.d.ts.map +1 -0
- package/lib/typescript/commonjs/stores/createToolStore.d.ts +92 -0
- package/lib/typescript/commonjs/stores/createToolStore.d.ts.map +1 -0
- package/lib/typescript/commonjs/stores/index.d.ts +2 -0
- package/lib/typescript/commonjs/stores/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/sync/toolSyncAdapter.d.ts +66 -0
- package/lib/typescript/commonjs/sync/toolSyncAdapter.d.ts.map +1 -0
- package/lib/typescript/commonjs/sync/wireForm.d.ts +100 -0
- package/lib/typescript/commonjs/sync/wireForm.d.ts.map +1 -0
- package/lib/typescript/commonjs/tools/defineTool.d.ts +100 -0
- package/lib/typescript/commonjs/tools/defineTool.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/ChangeRow.d.ts +52 -0
- package/lib/typescript/commonjs/ui/components/ChangeRow.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/ChipStrip.d.ts +41 -0
- package/lib/typescript/commonjs/ui/components/ChipStrip.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/DetailViewToggle.d.ts +36 -0
- package/lib/typescript/commonjs/ui/components/DetailViewToggle.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/DevToolsCard.d.ts +8 -1
- package/lib/typescript/commonjs/ui/components/DevToolsCard.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/EmptyState.d.ts +14 -1
- package/lib/typescript/commonjs/ui/components/EmptyState.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/EntityFilterView.d.ts +51 -0
- package/lib/typescript/commonjs/ui/components/EntityFilterView.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/ExportPreview.d.ts +48 -0
- package/lib/typescript/commonjs/ui/components/ExportPreview.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/InfoRow.d.ts +33 -0
- package/lib/typescript/commonjs/ui/components/InfoRow.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/ModalHeader.d.ts +31 -1
- package/lib/typescript/commonjs/ui/components/ModalHeader.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/Pill.d.ts +38 -0
- package/lib/typescript/commonjs/ui/components/Pill.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/ToggleRow.d.ts +33 -0
- package/lib/typescript/commonjs/ui/components/ToggleRow.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/ToolEmptyState.d.ts +113 -0
- package/lib/typescript/commonjs/ui/components/ToolEmptyState.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/ToolFooter.d.ts +69 -0
- package/lib/typescript/commonjs/ui/components/ToolFooter.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/WindowControls.d.ts +7 -1
- package/lib/typescript/commonjs/ui/components/WindowControls.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/index.d.ts +11 -0
- package/lib/typescript/commonjs/ui/components/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/index.d.ts +2 -0
- package/lib/typescript/commonjs/ui/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/listPresets.d.ts +28 -0
- package/lib/typescript/commonjs/ui/listPresets.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/night/primitives.d.ts +3 -1
- package/lib/typescript/commonjs/ui/night/primitives.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/otto/OttoSprite.d.ts +103 -0
- package/lib/typescript/commonjs/ui/otto/OttoSprite.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/otto/index.d.ts +19 -0
- package/lib/typescript/commonjs/ui/otto/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/otto/ottoEngine.d.ts +2205 -0
- package/lib/typescript/commonjs/ui/otto/ottoEngine.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/otto/ottoSheet.d.ts +73 -0
- package/lib/typescript/commonjs/ui/otto/ottoSheet.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/snapshotProviderKit.d.ts +81 -0
- package/lib/typescript/commonjs/utils/snapshotProviderKit.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/stateTools.d.ts +44 -0
- package/lib/typescript/commonjs/utils/stateTools.d.ts.map +1 -0
- package/lib/typescript/module/JsModal.d.ts.map +1 -1
- package/lib/typescript/module/hooks/index.d.ts +3 -1
- package/lib/typescript/module/hooks/index.d.ts.map +1 -1
- package/lib/typescript/module/hooks/safe-area-impl.d.ts +1 -1
- package/lib/typescript/module/hooks/useChangeLog.d.ts +38 -0
- package/lib/typescript/module/hooks/useChangeLog.d.ts.map +1 -0
- package/lib/typescript/module/hooks/useEventStoreEvents.d.ts +25 -0
- package/lib/typescript/module/hooks/useEventStoreEvents.d.ts.map +1 -0
- package/lib/typescript/module/hooks/usePersistedState.d.ts +34 -5
- package/lib/typescript/module/hooks/usePersistedState.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +6 -1
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/storage/definePersistedSetting.d.ts +39 -0
- package/lib/typescript/module/storage/definePersistedSetting.d.ts.map +1 -0
- package/lib/typescript/module/storage/devToolsStorageKeys.d.ts +12 -0
- package/lib/typescript/module/storage/devToolsStorageKeys.d.ts.map +1 -1
- package/lib/typescript/module/storage/index.d.ts +1 -0
- package/lib/typescript/module/storage/index.d.ts.map +1 -1
- package/lib/typescript/module/stores/ChangeLog.d.ts +100 -0
- package/lib/typescript/module/stores/ChangeLog.d.ts.map +1 -0
- package/lib/typescript/module/stores/createToolStore.d.ts +92 -0
- package/lib/typescript/module/stores/createToolStore.d.ts.map +1 -0
- package/lib/typescript/module/stores/index.d.ts +2 -0
- package/lib/typescript/module/stores/index.d.ts.map +1 -1
- package/lib/typescript/module/sync/toolSyncAdapter.d.ts +66 -0
- package/lib/typescript/module/sync/toolSyncAdapter.d.ts.map +1 -0
- package/lib/typescript/module/sync/wireForm.d.ts +100 -0
- package/lib/typescript/module/sync/wireForm.d.ts.map +1 -0
- package/lib/typescript/module/tools/defineTool.d.ts +100 -0
- package/lib/typescript/module/tools/defineTool.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/ChangeRow.d.ts +52 -0
- package/lib/typescript/module/ui/components/ChangeRow.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/ChipStrip.d.ts +41 -0
- package/lib/typescript/module/ui/components/ChipStrip.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/DetailViewToggle.d.ts +36 -0
- package/lib/typescript/module/ui/components/DetailViewToggle.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/DevToolsCard.d.ts +8 -1
- package/lib/typescript/module/ui/components/DevToolsCard.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/EmptyState.d.ts +14 -1
- package/lib/typescript/module/ui/components/EmptyState.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/EntityFilterView.d.ts +51 -0
- package/lib/typescript/module/ui/components/EntityFilterView.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/ExportPreview.d.ts +48 -0
- package/lib/typescript/module/ui/components/ExportPreview.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/InfoRow.d.ts +33 -0
- package/lib/typescript/module/ui/components/InfoRow.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/ModalHeader.d.ts +31 -1
- package/lib/typescript/module/ui/components/ModalHeader.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/Pill.d.ts +38 -0
- package/lib/typescript/module/ui/components/Pill.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/ToggleRow.d.ts +33 -0
- package/lib/typescript/module/ui/components/ToggleRow.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/ToolEmptyState.d.ts +113 -0
- package/lib/typescript/module/ui/components/ToolEmptyState.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/ToolFooter.d.ts +69 -0
- package/lib/typescript/module/ui/components/ToolFooter.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/WindowControls.d.ts +7 -1
- package/lib/typescript/module/ui/components/WindowControls.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/index.d.ts +11 -0
- package/lib/typescript/module/ui/components/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/index.d.ts +2 -0
- package/lib/typescript/module/ui/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/listPresets.d.ts +28 -0
- package/lib/typescript/module/ui/listPresets.d.ts.map +1 -0
- package/lib/typescript/module/ui/night/primitives.d.ts +3 -1
- package/lib/typescript/module/ui/night/primitives.d.ts.map +1 -1
- package/lib/typescript/module/ui/otto/OttoSprite.d.ts +103 -0
- package/lib/typescript/module/ui/otto/OttoSprite.d.ts.map +1 -0
- package/lib/typescript/module/ui/otto/index.d.ts +19 -0
- package/lib/typescript/module/ui/otto/index.d.ts.map +1 -0
- package/lib/typescript/module/ui/otto/ottoEngine.d.ts +2205 -0
- package/lib/typescript/module/ui/otto/ottoEngine.d.ts.map +1 -0
- package/lib/typescript/module/ui/otto/ottoSheet.d.ts +73 -0
- package/lib/typescript/module/ui/otto/ottoSheet.d.ts.map +1 -0
- package/lib/typescript/module/utils/snapshotProviderKit.d.ts +81 -0
- package/lib/typescript/module/utils/snapshotProviderKit.d.ts.map +1 -0
- package/lib/typescript/module/utils/stateTools.d.ts +44 -0
- package/lib/typescript/module/utils/stateTools.d.ts.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,2734 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.OTTO_USES = exports.OTTO_STATE_NAMES = exports.OTTO_STATES = exports.OTTO_REEL = exports.OTTO_PALETTE = exports.OTTO_NOTES = exports.OTTO_GROUPS = exports.OTTO_GRID = exports.OTTO_ANCHOR_SIZE = exports.OTTO_ANCHORS = void 0;
|
|
7
|
+
exports.ottoReel = ottoReel;
|
|
8
|
+
exports.ottoRuns = ottoRuns;
|
|
9
|
+
exports.ottoWaterRows = ottoWaterRows;
|
|
10
|
+
exports.renderOttoFrame = renderOttoFrame;
|
|
11
|
+
/**
|
|
12
|
+
* Otto — Buoy's pixel mascot, ported 1:1 from the Claude Design mockup
|
|
13
|
+
* (`Otto.dc.html`, "Turn 6 — Otto, full state set").
|
|
14
|
+
*
|
|
15
|
+
* Everything here is pure: a pose is a parametric description (body rect,
|
|
16
|
+
* lamp, eyes, legs, prop extras) baked onto a 16×16 grid, composed with a
|
|
17
|
+
* keyline and water, then painted from the palette. No React, no timers —
|
|
18
|
+
* `renderOttoFrame(state, t)` is the whole API, so it can be lifted into a
|
|
19
|
+
* package unchanged. `OttoSprite.tsx` is the React Native renderer.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
const OTTO_GRID = exports.OTTO_GRID = 16;
|
|
23
|
+
|
|
24
|
+
/** Palette keys → colours. `.` is transparent. */
|
|
25
|
+
const OTTO_PALETTE = exports.OTTO_PALETTE = {
|
|
26
|
+
g: "#20C997",
|
|
27
|
+
// body
|
|
28
|
+
s: "#1BAB80",
|
|
29
|
+
// body shade
|
|
30
|
+
d: "#0D9668",
|
|
31
|
+
// body deep (lamp base)
|
|
32
|
+
h: "#3DD9A8",
|
|
33
|
+
// body highlight (top row)
|
|
34
|
+
k: "#000000",
|
|
35
|
+
// keyline / eyes
|
|
36
|
+
a: "#FFA94D",
|
|
37
|
+
// lamp lit
|
|
38
|
+
A: "#6B4520",
|
|
39
|
+
// lamp dim
|
|
40
|
+
r: "#FF3B30",
|
|
41
|
+
// danger
|
|
42
|
+
R: "#5A1712",
|
|
43
|
+
// danger dim
|
|
44
|
+
p: "#9B70E0",
|
|
45
|
+
// purple props
|
|
46
|
+
w: "#0A1A16",
|
|
47
|
+
// water
|
|
48
|
+
W: "#0F2A22",
|
|
49
|
+
// water crest
|
|
50
|
+
n: "#9BA1A6",
|
|
51
|
+
// prop light grey
|
|
52
|
+
m: "#636366",
|
|
53
|
+
// prop mid grey
|
|
54
|
+
l: "#ECEDEE",
|
|
55
|
+
// prop white
|
|
56
|
+
"1": "#2A2A2E" // prop dark
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/** [x, y, paletteKey] */
|
|
60
|
+
|
|
61
|
+
const BASE = {
|
|
62
|
+
x0: 3,
|
|
63
|
+
y0: 4,
|
|
64
|
+
w: 10,
|
|
65
|
+
h: 7,
|
|
66
|
+
eyes: "open",
|
|
67
|
+
lamp: "a",
|
|
68
|
+
legs: [0, 0, 0]
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// Keys that count as "body" for the keyline pass. Props (n/m/l/p/1) get none.
|
|
72
|
+
const BODY_KEYS = "gsdhaArRk";
|
|
73
|
+
function walk(t) {
|
|
74
|
+
return t % 2 ? [0, 1, 0] : [1, 0, 1];
|
|
75
|
+
}
|
|
76
|
+
function rect(x0, y0, x1, y1, c, out) {
|
|
77
|
+
for (let y = y0; y <= y1; y++) for (let x = x0; x <= x1; x++) out.push([x, y, c]);
|
|
78
|
+
return out;
|
|
79
|
+
}
|
|
80
|
+
function pt([x, y], c) {
|
|
81
|
+
return [x, y, c];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** A 4×5 loop at the top right, clockwise from the top left — spinners orbit it. */
|
|
85
|
+
const RING = [[13, 0], [14, 0], [15, 1], [15, 2], [15, 3], [14, 4], [13, 4], [12, 3], [12, 2], [12, 1]];
|
|
86
|
+
|
|
87
|
+
/** A 3-wide arrow pointing down, tip at `y + 3`; parts above row 0 are clipped. */
|
|
88
|
+
function arrowDown(x, y, c, out) {
|
|
89
|
+
out.push([x, y, c], [x, y + 1, c], [x - 1, y + 2, c], [x, y + 2, c], [x + 1, y + 2, c], [x, y + 3, c]);
|
|
90
|
+
return out;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** A 3-wide arrow pointing up, tip at `y`. */
|
|
94
|
+
function arrowUp(x, y, c, out) {
|
|
95
|
+
out.push([x, y, c], [x - 1, y + 1, c], [x, y + 1, c], [x + 1, y + 1, c], [x, y + 2, c], [x, y + 3, c]);
|
|
96
|
+
return out;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** Morse S-O-S, one tick per unit: dot 1, dash 3, gaps 1/2, word pause 6. */
|
|
100
|
+
const SOS = [1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0];
|
|
101
|
+
|
|
102
|
+
/** A padlock at the right edge (x 13–15): orange body, grey shackle, keyhole. */
|
|
103
|
+
function padlock(open, out) {
|
|
104
|
+
rect(13, 4, 15, 6, "a", out);
|
|
105
|
+
out.push([14, 5, "k"], [14, 6, "k"]);
|
|
106
|
+
if (open) out.push([13, 1, "n"], [14, 1, "n"], [15, 1, "n"], [13, 2, "n"], [13, 3, "n"]);else out.push([13, 2, "n"], [14, 2, "n"], [15, 2, "n"], [13, 3, "n"], [15, 3, "n"]);
|
|
107
|
+
return out;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Bake a pose onto the grid as palette keys (`.` = empty). */
|
|
111
|
+
function draw(p) {
|
|
112
|
+
const W = OTTO_GRID;
|
|
113
|
+
const H = OTTO_GRID;
|
|
114
|
+
const g = Array.from({
|
|
115
|
+
length: H
|
|
116
|
+
}, () => Array(W).fill("."));
|
|
117
|
+
const dx = p.dx || 0;
|
|
118
|
+
const put = (x, y, c) => {
|
|
119
|
+
x += dx;
|
|
120
|
+
if (x >= 0 && x < W && y >= 0 && y < H) g[y][x] = c;
|
|
121
|
+
};
|
|
122
|
+
const {
|
|
123
|
+
x0,
|
|
124
|
+
y0,
|
|
125
|
+
w,
|
|
126
|
+
h
|
|
127
|
+
} = p;
|
|
128
|
+
const x1 = x0 + w - 1;
|
|
129
|
+
const y1 = y0 + h - 1;
|
|
130
|
+
for (let y = y0; y <= y1; y++) {
|
|
131
|
+
for (let x = x0; x <= x1; x++) {
|
|
132
|
+
if ((x === x0 || x === x1) && (y === y0 || y === y1)) continue;
|
|
133
|
+
put(x, y, y === y0 ? "h" : y === y1 || x === x1 ? "s" : "g");
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (p.lamp) {
|
|
137
|
+
const cx = x0 + Math.floor(w / 2) - 1;
|
|
138
|
+
put(cx, y0 - 2, p.lamp);
|
|
139
|
+
put(cx + 1, y0 - 2, p.lamp);
|
|
140
|
+
for (let x = cx - 1; x <= cx + 2; x++) put(x, y0 - 1, "d");
|
|
141
|
+
}
|
|
142
|
+
const ex = p.ex || 0;
|
|
143
|
+
const ey = y0 + 2 + (p.ey || 0);
|
|
144
|
+
for (const e of [x0 + 2 + ex, x1 - 3 + ex]) {
|
|
145
|
+
if (p.eyes === "open") {
|
|
146
|
+
put(e, ey, "k");
|
|
147
|
+
put(e + 1, ey, "k");
|
|
148
|
+
put(e, ey + 1, "k");
|
|
149
|
+
put(e + 1, ey + 1, "k");
|
|
150
|
+
} else if (p.eyes === "closed") {
|
|
151
|
+
put(e, ey + 1, "k");
|
|
152
|
+
put(e + 1, ey + 1, "k");
|
|
153
|
+
} else if (p.eyes === "happy") {
|
|
154
|
+
put(e, ey + 1, "k");
|
|
155
|
+
put(e + 1, ey, "k");
|
|
156
|
+
put(e + 2, ey + 1, "k");
|
|
157
|
+
} else if (p.eyes === "x") {
|
|
158
|
+
put(e, ey, "k");
|
|
159
|
+
put(e + 2, ey, "k");
|
|
160
|
+
put(e + 1, ey + 1, "k");
|
|
161
|
+
put(e, ey + 2, "k");
|
|
162
|
+
put(e + 2, ey + 2, "k");
|
|
163
|
+
} else if (p.eyes === "big") {
|
|
164
|
+
for (let yy = 0; yy < 3; yy++) for (let xx = 0; xx < 3; xx++) put(e + xx, ey + yy, "k");
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (p.legs) {
|
|
168
|
+
const start = x0 + Math.floor((w - 8) / 2);
|
|
169
|
+
p.legs.forEach((o, i) => {
|
|
170
|
+
const lx = start + i * 3;
|
|
171
|
+
put(lx, y1 + 1, o ? "s" : "g");
|
|
172
|
+
put(lx + 1, y1 + 1, o ? "s" : "g");
|
|
173
|
+
if (!o) {
|
|
174
|
+
put(lx, y1 + 2, "s");
|
|
175
|
+
put(lx + 1, y1 + 2, "s");
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
(p.extras || []).forEach(([x, y, c]) => put(x, y, c));
|
|
180
|
+
return g;
|
|
181
|
+
}
|
|
182
|
+
function wave(x, y, t) {
|
|
183
|
+
return ((x - Math.floor(t / 2) + y * 5) % 7 + 7) % 7 < 2 ? "W" : "w";
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** The water on its own: rows 13–15 as palette keys at tick `t`. Period 7 in floor(t/2). */
|
|
187
|
+
function ottoWaterRows(t) {
|
|
188
|
+
const rows = [];
|
|
189
|
+
for (let y = 13; y < OTTO_GRID; y++) {
|
|
190
|
+
const row = [];
|
|
191
|
+
for (let x = 0; x < OTTO_GRID; x++) row.push(wave(x, y, t));
|
|
192
|
+
rows.push(row);
|
|
193
|
+
}
|
|
194
|
+
return rows;
|
|
195
|
+
}
|
|
196
|
+
const NEIGHBOURS = [[0, 1], [0, -1], [1, 0], [-1, 0]];
|
|
197
|
+
/** Keyline around the body, water in the bottom three rows. */
|
|
198
|
+
function compose(g, t, o) {
|
|
199
|
+
const W = OTTO_GRID;
|
|
200
|
+
const H = OTTO_GRID;
|
|
201
|
+
const out = g.map(r => r.slice());
|
|
202
|
+
for (let y = 0; y < H; y++) {
|
|
203
|
+
for (let x = 0; x < W; x++) {
|
|
204
|
+
const under = y >= 13;
|
|
205
|
+
if (under && o.submerged) {
|
|
206
|
+
out[y][x] = o.water ? wave(x, y, t) : ".";
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
if (g[y][x] !== ".") continue;
|
|
210
|
+
const nb = o.keyline && NEIGHBOURS.some(([dy, ddx]) => {
|
|
211
|
+
const yy = y + dy;
|
|
212
|
+
const xx = x + ddx;
|
|
213
|
+
return yy >= 0 && yy < H && xx >= 0 && xx < W && BODY_KEYS.includes(g[yy][xx]);
|
|
214
|
+
});
|
|
215
|
+
if (nb) out[y][x] = "k";else if (under && o.water) out[y][x] = wave(x, y, t);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return out;
|
|
219
|
+
}
|
|
220
|
+
const OTTO_STATES = exports.OTTO_STATES = {
|
|
221
|
+
idle: t => {
|
|
222
|
+
const c = t % 48;
|
|
223
|
+
const bob = c % 8 >= 4 ? 1 : 0;
|
|
224
|
+
const blink = c % 16 === 13 || c === 47;
|
|
225
|
+
const ex = c >= 20 && c <= 26 ? -1 : c >= 32 && c <= 38 ? 1 : 0;
|
|
226
|
+
return {
|
|
227
|
+
...BASE,
|
|
228
|
+
y0: 4 + bob,
|
|
229
|
+
eyes: blink ? "closed" : "open",
|
|
230
|
+
ex,
|
|
231
|
+
legs: walk(Math.floor(t / 2))
|
|
232
|
+
};
|
|
233
|
+
},
|
|
234
|
+
thinking: t => {
|
|
235
|
+
const c = t % 10;
|
|
236
|
+
const e = [];
|
|
237
|
+
if (c >= 1) e.push([13, 5, "n"]);
|
|
238
|
+
if (c >= 2) e.push([14, 3, "n"]);
|
|
239
|
+
if (c >= 3) {
|
|
240
|
+
rect(11, 0, 14, 0, "l", e);
|
|
241
|
+
rect(10, 1, 15, 1, "l", e);
|
|
242
|
+
rect(11, 2, 14, 2, "l", e);
|
|
243
|
+
}
|
|
244
|
+
for (let i = 0; i < Math.min(3, Math.max(0, c - 4)); i++) e.push([11 + i * 2, 1, "m"]);
|
|
245
|
+
return {
|
|
246
|
+
...BASE,
|
|
247
|
+
ex: 1,
|
|
248
|
+
ey: -1,
|
|
249
|
+
lamp: t % 4 < 2 ? "a" : "A",
|
|
250
|
+
extras: e
|
|
251
|
+
};
|
|
252
|
+
},
|
|
253
|
+
happy: t => {
|
|
254
|
+
const c = t % 12;
|
|
255
|
+
const hop = [0, 1, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0][c];
|
|
256
|
+
let p = {
|
|
257
|
+
...BASE,
|
|
258
|
+
eyes: "happy",
|
|
259
|
+
legs: walk(t),
|
|
260
|
+
y0: 4 - hop
|
|
261
|
+
};
|
|
262
|
+
if (c === 1) p = {
|
|
263
|
+
...p,
|
|
264
|
+
x0: 4,
|
|
265
|
+
w: 8,
|
|
266
|
+
h: 8,
|
|
267
|
+
y0: 2
|
|
268
|
+
};
|
|
269
|
+
if (c === 5 || c === 6) p = {
|
|
270
|
+
...p,
|
|
271
|
+
x0: 2,
|
|
272
|
+
w: 12,
|
|
273
|
+
h: 6,
|
|
274
|
+
y0: 5
|
|
275
|
+
};
|
|
276
|
+
return p;
|
|
277
|
+
},
|
|
278
|
+
error: t => ({
|
|
279
|
+
...BASE,
|
|
280
|
+
lamp: t % 2 ? "r" : "R",
|
|
281
|
+
dx: [0, 1, 0, -1][t % 4],
|
|
282
|
+
eyes: "closed"
|
|
283
|
+
}),
|
|
284
|
+
sleep: t => {
|
|
285
|
+
const ph = Math.floor(t / 3) % 4;
|
|
286
|
+
const z = (x, y) => [[x, y], [x + 1, y], [x + 2, y], [x + 3, y], [x + 2, y + 1], [x + 1, y + 2], [x, y + 3], [x + 1, y + 3], [x + 2, y + 3], [x + 3, y + 3]].map(([a, b]) => [a, b, "n"]);
|
|
287
|
+
return {
|
|
288
|
+
...BASE,
|
|
289
|
+
y0: 5 + Math.floor(t / 8) % 2,
|
|
290
|
+
eyes: "closed",
|
|
291
|
+
lamp: "A",
|
|
292
|
+
extras: z(12, 6 - ph * 2)
|
|
293
|
+
};
|
|
294
|
+
},
|
|
295
|
+
peek: t => ({
|
|
296
|
+
...BASE,
|
|
297
|
+
submerged: true,
|
|
298
|
+
y0: 9 + Math.floor(t / 4) % 2,
|
|
299
|
+
ex: [-1, 0, 1, 0][Math.floor(t / 6) % 4],
|
|
300
|
+
legs: null
|
|
301
|
+
}),
|
|
302
|
+
typing: t => {
|
|
303
|
+
const e = [];
|
|
304
|
+
rect(3, 8, 12, 8, "n", e);
|
|
305
|
+
rect(3, 11, 12, 11, "n", e);
|
|
306
|
+
rect(3, 9, 3, 10, "n", e);
|
|
307
|
+
rect(12, 9, 12, 10, "n", e);
|
|
308
|
+
rect(4, 9, 11, 10, "1", e);
|
|
309
|
+
rect(7, 9, 8, 10, "g", e);
|
|
310
|
+
rect(2, 12, 13, 12, "m", e);
|
|
311
|
+
const tap = t % 2;
|
|
312
|
+
e.push([2, 10 + tap, "g"], [13, 11 - tap, "g"]);
|
|
313
|
+
return {
|
|
314
|
+
...BASE,
|
|
315
|
+
eyes: t % 12 === 11 ? "closed" : "open",
|
|
316
|
+
legs: null,
|
|
317
|
+
extras: e
|
|
318
|
+
};
|
|
319
|
+
},
|
|
320
|
+
debugging: t => {
|
|
321
|
+
const gx = Math.floor(t / 4) % 2 ? 0 : -1;
|
|
322
|
+
const e = [];
|
|
323
|
+
[[10, 3], [11, 3], [12, 3], [9, 4], [13, 4], [9, 5], [13, 5], [9, 6], [13, 6], [10, 7], [11, 7], [12, 7]].forEach(([x, y]) => e.push([x + gx, y, "n"]));
|
|
324
|
+
rect(10 + gx, 4, 12 + gx, 4, "l", e);
|
|
325
|
+
rect(10 + gx, 5, 12 + gx, 6, "k", e);
|
|
326
|
+
e.push([14 + gx, 7, "m"], [15 + gx, 8, "m"]);
|
|
327
|
+
return {
|
|
328
|
+
...BASE,
|
|
329
|
+
extras: e
|
|
330
|
+
};
|
|
331
|
+
},
|
|
332
|
+
building: t => {
|
|
333
|
+
const e = [];
|
|
334
|
+
rect(5, 1, 10, 1, "a", e);
|
|
335
|
+
rect(4, 2, 11, 2, "a", e);
|
|
336
|
+
rect(2, 3, 13, 3, "A", e);
|
|
337
|
+
rect(13, 11, 15, 12, "m", e);
|
|
338
|
+
if (t % 4 < 2) e.push([13, 6, "g"], [14, 5, "m"], [14, 4, "m"], [13, 2, "n"], [14, 2, "n"], [15, 2, "n"]);else e.push([13, 8, "g"], [14, 9, "m"], [15, 8, "n"], [15, 9, "n"], [15, 10, "n"], [12, 10, "a"]);
|
|
339
|
+
return {
|
|
340
|
+
...BASE,
|
|
341
|
+
lamp: null,
|
|
342
|
+
eyes: t % 10 === 9 ? "closed" : "open",
|
|
343
|
+
extras: e
|
|
344
|
+
};
|
|
345
|
+
},
|
|
346
|
+
carrying: t => {
|
|
347
|
+
const b = t % 4 < 2 ? 0 : 1;
|
|
348
|
+
const e = [];
|
|
349
|
+
rect(5, b, 10, b, "n", e);
|
|
350
|
+
rect(5, 3 + b, 10, 3 + b, "n", e);
|
|
351
|
+
rect(5, 1 + b, 5, 2 + b, "n", e);
|
|
352
|
+
rect(10, 1 + b, 10, 2 + b, "n", e);
|
|
353
|
+
rect(6, 1 + b, 9, 2 + b, "g", e);
|
|
354
|
+
rect(4, 2 + b, 4, 3 + b, "g", e);
|
|
355
|
+
rect(11, 2 + b, 11, 3 + b, "g", e);
|
|
356
|
+
return {
|
|
357
|
+
...BASE,
|
|
358
|
+
y0: 4 + b,
|
|
359
|
+
lamp: null,
|
|
360
|
+
ey: -1,
|
|
361
|
+
legs: walk(t),
|
|
362
|
+
extras: e
|
|
363
|
+
};
|
|
364
|
+
},
|
|
365
|
+
pushing: t => {
|
|
366
|
+
const e = [];
|
|
367
|
+
for (let y = 5; y <= 12; y++) {
|
|
368
|
+
for (let x = 11; x <= 15; x++) {
|
|
369
|
+
e.push([x, y, y === 5 || y === 12 || x === 11 || x === 15 ? "n" : x === 13 ? "l" : "m"]);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
e.push([10, 7, "g"], [10, 8, "g"]);
|
|
373
|
+
return {
|
|
374
|
+
...BASE,
|
|
375
|
+
x0: 0,
|
|
376
|
+
dx: t % 4 < 2 ? 0 : 1,
|
|
377
|
+
ex: 1,
|
|
378
|
+
legs: walk(t),
|
|
379
|
+
extras: e
|
|
380
|
+
};
|
|
381
|
+
},
|
|
382
|
+
sweeping: t => {
|
|
383
|
+
const s = t % 4 < 2 ? 0 : 1;
|
|
384
|
+
const e = [];
|
|
385
|
+
rect(13, 3, 13, 10, "m", e);
|
|
386
|
+
rect(12 + s, 11, 15 + s, 12, "a", e);
|
|
387
|
+
e.push([13, 6, "g"]);
|
|
388
|
+
if (s) e.push([15, 10, "m"], [11, 12, "m"]);
|
|
389
|
+
return {
|
|
390
|
+
...BASE,
|
|
391
|
+
ex: 1,
|
|
392
|
+
eyes: t % 12 === 11 ? "closed" : "open",
|
|
393
|
+
extras: e
|
|
394
|
+
};
|
|
395
|
+
},
|
|
396
|
+
juggling: t => {
|
|
397
|
+
const e = [];
|
|
398
|
+
[[2, "r"], [7, "a"], [12, "p"]].forEach(([x, c], i) => {
|
|
399
|
+
const h = [0, 1, 2, 2, 1, 0][(t + i * 2) % 6];
|
|
400
|
+
const y = 2 - h;
|
|
401
|
+
rect(x, y, x + 1, y + 1, c, e);
|
|
402
|
+
});
|
|
403
|
+
e.push([2, 4 + t % 2, "g"], [13, 5 - t % 2, "g"]);
|
|
404
|
+
return {
|
|
405
|
+
...BASE,
|
|
406
|
+
lamp: null,
|
|
407
|
+
ey: -1,
|
|
408
|
+
ex: [-1, 0, 1, 0][Math.floor(t / 2) % 4],
|
|
409
|
+
extras: e
|
|
410
|
+
};
|
|
411
|
+
},
|
|
412
|
+
wizard: t => {
|
|
413
|
+
const e = [];
|
|
414
|
+
rect(7, 0, 8, 0, "p", e);
|
|
415
|
+
rect(6, 1, 9, 1, "p", e);
|
|
416
|
+
rect(5, 2, 10, 2, "p", e);
|
|
417
|
+
rect(3, 3, 12, 3, "p", e);
|
|
418
|
+
e.push([8, 1, "a"]);
|
|
419
|
+
e.push([13, 5, "g"], [14, 4, "m"], [15, 3, "m"]);
|
|
420
|
+
const sp = t % 4;
|
|
421
|
+
if (sp === 1) e.push([15, 1, "a"]);
|
|
422
|
+
if (sp === 2) e.push([14, 1, "a"], [15, 0, "a"], [15, 2, "a"]);
|
|
423
|
+
if (sp === 3) e.push([13, 0, "a"]);
|
|
424
|
+
return {
|
|
425
|
+
...BASE,
|
|
426
|
+
lamp: null,
|
|
427
|
+
eyes: t % 12 === 11 ? "closed" : "open",
|
|
428
|
+
extras: e
|
|
429
|
+
};
|
|
430
|
+
},
|
|
431
|
+
conducting: t => {
|
|
432
|
+
const u = t % 2;
|
|
433
|
+
const n = Math.floor(t / 2) % 4;
|
|
434
|
+
const e = [[1, 4 + u * 3, "g"], [2, 4 + u * 3, "g"], [13, 7 - u * 3, "g"], [14, 7 - u * 3, "g"], [15, 6 - u * 3, "m"], [2, 3 - n, "n"], [3, 2 - n, "n"]];
|
|
435
|
+
return {
|
|
436
|
+
...BASE,
|
|
437
|
+
eyes: "happy",
|
|
438
|
+
extras: e
|
|
439
|
+
};
|
|
440
|
+
},
|
|
441
|
+
beacon: t => {
|
|
442
|
+
const f = t % 6;
|
|
443
|
+
const rings = [[], [[5, 3], [10, 3], [5, 2], [10, 2]], [[3, 3], [12, 3], [3, 2], [12, 2], [4, 1], [11, 1], [5, 0], [10, 0]], [[1, 2], [14, 2], [1, 1], [14, 1], [2, 0], [13, 0]], [], []];
|
|
444
|
+
return {
|
|
445
|
+
...BASE,
|
|
446
|
+
lamp: f < 4 ? "a" : "A",
|
|
447
|
+
ey: -1,
|
|
448
|
+
extras: rings[f].map(([x, y]) => [x, y, "a"])
|
|
449
|
+
};
|
|
450
|
+
},
|
|
451
|
+
notification: t => {
|
|
452
|
+
const c = t % 16;
|
|
453
|
+
const hop = [0, 0, 0, 0, 1, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0][c];
|
|
454
|
+
const show = c >= 3 && c <= 10;
|
|
455
|
+
const e = show ? [...rect(14, 0, 15, 2, "a", []), [14, 4, "a"], [15, 4, "a"]] : [];
|
|
456
|
+
return {
|
|
457
|
+
...BASE,
|
|
458
|
+
y0: 4 - hop,
|
|
459
|
+
lamp: show && c % 2 ? "A" : "a",
|
|
460
|
+
legs: hop ? [1, 1, 1] : [0, 0, 0],
|
|
461
|
+
extras: e
|
|
462
|
+
};
|
|
463
|
+
},
|
|
464
|
+
disconnected: t => {
|
|
465
|
+
const on = t % 4 < 2;
|
|
466
|
+
const e = [];
|
|
467
|
+
for (let y = 0; y <= 4; y++) {
|
|
468
|
+
e.push([12, y, "n"], [14, y, "n"], [13, y, y === 0 || y === 4 ? "n" : on ? "r" : "1"]);
|
|
469
|
+
}
|
|
470
|
+
return {
|
|
471
|
+
...BASE,
|
|
472
|
+
y0: 5,
|
|
473
|
+
lamp: "A",
|
|
474
|
+
ex: 1,
|
|
475
|
+
ey: -1,
|
|
476
|
+
extras: e
|
|
477
|
+
};
|
|
478
|
+
},
|
|
479
|
+
dizzy: t => {
|
|
480
|
+
const pos = [[1, 2], [4, 0], [11, 0], [14, 2]];
|
|
481
|
+
const s = [pos[t % 4], pos[(t + 2) % 4]].map(([x, y]) => [x, y, "a"]);
|
|
482
|
+
return {
|
|
483
|
+
...BASE,
|
|
484
|
+
eyes: "x",
|
|
485
|
+
lamp: "A",
|
|
486
|
+
dx: [0, 1, 0, -1][t % 4],
|
|
487
|
+
extras: s
|
|
488
|
+
};
|
|
489
|
+
},
|
|
490
|
+
overheated: t => {
|
|
491
|
+
const k = [0, 0, 0, 1, 2, 3, 3, 3, 3, 2, 1, 0][t % 12];
|
|
492
|
+
const shapes = [{
|
|
493
|
+
x0: 3,
|
|
494
|
+
y0: 4,
|
|
495
|
+
w: 10,
|
|
496
|
+
h: 7,
|
|
497
|
+
ey: 0,
|
|
498
|
+
legs: [0, 0, 0]
|
|
499
|
+
}, {
|
|
500
|
+
x0: 3,
|
|
501
|
+
y0: 6,
|
|
502
|
+
w: 10,
|
|
503
|
+
h: 5,
|
|
504
|
+
ey: 0,
|
|
505
|
+
legs: [0, 0, 0]
|
|
506
|
+
}, {
|
|
507
|
+
x0: 2,
|
|
508
|
+
y0: 8,
|
|
509
|
+
w: 12,
|
|
510
|
+
h: 3,
|
|
511
|
+
ey: -1,
|
|
512
|
+
legs: null
|
|
513
|
+
}, {
|
|
514
|
+
x0: 1,
|
|
515
|
+
y0: 10,
|
|
516
|
+
w: 14,
|
|
517
|
+
h: 2,
|
|
518
|
+
ey: -2,
|
|
519
|
+
legs: null
|
|
520
|
+
}];
|
|
521
|
+
return {
|
|
522
|
+
...BASE,
|
|
523
|
+
...shapes[k],
|
|
524
|
+
eyes: k >= 2 ? "closed" : "open",
|
|
525
|
+
lamp: k >= 2 ? "A" : t % 2 ? "a" : "A",
|
|
526
|
+
extras: k >= 1 ? [[14, 2 + t % 3, "l"]] : []
|
|
527
|
+
};
|
|
528
|
+
},
|
|
529
|
+
confused: t => {
|
|
530
|
+
const c = t % 18;
|
|
531
|
+
const e = c >= 4 ? [[12, 0, "n"], [13, 0, "n"], [14, 0, "n"], [14, 1, "n"], [13, 2, "n"], [14, 2, "n"], [13, 4, "n"]] : [];
|
|
532
|
+
return {
|
|
533
|
+
...BASE,
|
|
534
|
+
ex: [1, 1, 0, -1, -1, 0][Math.floor(c / 3) % 6],
|
|
535
|
+
ey: -1,
|
|
536
|
+
dx: c >= 9 ? -1 : 0,
|
|
537
|
+
extras: e
|
|
538
|
+
};
|
|
539
|
+
},
|
|
540
|
+
stare: t => ({
|
|
541
|
+
...BASE,
|
|
542
|
+
eyes: t % 20 === 19 ? "closed" : "big",
|
|
543
|
+
ex: [0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, -1, -1, 0, 0, 0, 0, 0, 0][t % 20]
|
|
544
|
+
}),
|
|
545
|
+
walking: t => {
|
|
546
|
+
const c = t % 16;
|
|
547
|
+
const pos = c < 8 ? c - 4 : 11 - c;
|
|
548
|
+
return {
|
|
549
|
+
...BASE,
|
|
550
|
+
dx: pos,
|
|
551
|
+
ex: c < 8 ? 1 : -1,
|
|
552
|
+
legs: walk(t)
|
|
553
|
+
};
|
|
554
|
+
},
|
|
555
|
+
goingaway: t => ({
|
|
556
|
+
...BASE,
|
|
557
|
+
dx: t % 26 - 6,
|
|
558
|
+
ex: 1,
|
|
559
|
+
legs: walk(t)
|
|
560
|
+
}),
|
|
561
|
+
eureka: t => {
|
|
562
|
+
const c = t % 24;
|
|
563
|
+
const e = [];
|
|
564
|
+
if (c >= 3 && c < 20) {
|
|
565
|
+
const on = c >= 6;
|
|
566
|
+
rect(12, 0, 13, 0, on ? "a" : "A", e);
|
|
567
|
+
rect(11, 1, 14, 2, on ? "a" : "A", e);
|
|
568
|
+
rect(12, 3, 13, 3, "m", e);
|
|
569
|
+
rect(12, 4, 13, 4, "n", e);
|
|
570
|
+
if (on) e.push([12, 1, "l"]);
|
|
571
|
+
if (on && c < 14 && c % 2 === 0) e.push([10, 0, "l"], [15, 0, "l"], [10, 4, "l"], [15, 4, "l"]);
|
|
572
|
+
e.push([13, 6, "g"], [14, 5, "g"]);
|
|
573
|
+
}
|
|
574
|
+
return {
|
|
575
|
+
...BASE,
|
|
576
|
+
lamp: c >= 6 && c < 20 ? "a" : "A",
|
|
577
|
+
eyes: c >= 8 && c < 20 ? "happy" : c === 22 ? "closed" : "open",
|
|
578
|
+
ex: c >= 3 && c < 8 ? 1 : 0,
|
|
579
|
+
ey: c >= 3 && c < 8 ? -1 : 0,
|
|
580
|
+
y0: c >= 8 && c < 20 && c % 4 < 2 ? 3 : 4,
|
|
581
|
+
extras: e
|
|
582
|
+
};
|
|
583
|
+
},
|
|
584
|
+
grooving: t => {
|
|
585
|
+
const b = t % 4;
|
|
586
|
+
const lean = [0, 1, 0, -1][b];
|
|
587
|
+
const e = [];
|
|
588
|
+
rect(4, 1, 11, 1, "p", e);
|
|
589
|
+
rect(3, 2, 3, 3, "p", e);
|
|
590
|
+
rect(12, 2, 12, 3, "p", e);
|
|
591
|
+
rect(1, 6, 2, 8, "p", e);
|
|
592
|
+
rect(13, 6, 14, 8, "p", e);
|
|
593
|
+
e.push([2, 7, "1"], [13, 7, "1"]);
|
|
594
|
+
if (b === 1) e.push([0, 3, "a"], [1, 2, "a"], [1, 3, "a"]);
|
|
595
|
+
if (b === 3) e.push([15, 3, "a"], [14, 2, "a"], [14, 3, "a"]);
|
|
596
|
+
return {
|
|
597
|
+
...BASE,
|
|
598
|
+
lamp: null,
|
|
599
|
+
dx: lean,
|
|
600
|
+
eyes: "happy",
|
|
601
|
+
legs: b % 2 ? [1, 0, 1] : [0, 1, 0],
|
|
602
|
+
y0: b % 2 ? 4 : 5,
|
|
603
|
+
extras: e
|
|
604
|
+
};
|
|
605
|
+
},
|
|
606
|
+
hatmishap: t => {
|
|
607
|
+
const c = t % 32;
|
|
608
|
+
const e = [];
|
|
609
|
+
const drop = c >= 10 && c < 20 ? 2 : c >= 20 && c < 22 ? 1 : 0;
|
|
610
|
+
const ox = c >= 10 && c < 20 ? 1 : 0;
|
|
611
|
+
const hy = drop;
|
|
612
|
+
const hat = (x, y, col) => e.push([x + ox, y + hy, col]);
|
|
613
|
+
hat(7, 0, "p");
|
|
614
|
+
hat(8, 0, "p");
|
|
615
|
+
for (let x = 6; x <= 9; x++) hat(x, 1, "p");
|
|
616
|
+
for (let x = 5; x <= 10; x++) hat(x, 2, "p");
|
|
617
|
+
for (let x = 3; x <= 12; x++) hat(x, 3, "p");
|
|
618
|
+
hat(8, 1, "a");
|
|
619
|
+
hat(6, 2, "a");
|
|
620
|
+
hat(10, 3, "a");
|
|
621
|
+
if (drop === 2) for (let x = 4; x <= 11; x++) hat(x, 4, "p");
|
|
622
|
+
if (c >= 14 && c < 22) {
|
|
623
|
+
e.push([13, 5, "g"], [14, 4, "g"], [14, 3, "g"]);
|
|
624
|
+
if (c % 2) e.push([15, 1, "a"], [14, 0, "l"]);
|
|
625
|
+
}
|
|
626
|
+
return {
|
|
627
|
+
...BASE,
|
|
628
|
+
lamp: null,
|
|
629
|
+
eyes: drop === 2 ? "closed" : c >= 22 && c < 24 ? "happy" : "open",
|
|
630
|
+
ex: c < 10 ? 1 : 0,
|
|
631
|
+
legs: c < 8 ? walk(t) : [0, 0, 0],
|
|
632
|
+
dx: c < 8 ? c < 4 ? c - 2 : 5 - c : 0,
|
|
633
|
+
extras: e
|
|
634
|
+
};
|
|
635
|
+
},
|
|
636
|
+
lowbattery: t => {
|
|
637
|
+
const e = [];
|
|
638
|
+
rect(12, 1, 15, 1, "r", e);
|
|
639
|
+
rect(12, 6, 15, 6, "r", e);
|
|
640
|
+
e.push([12, 2, "r"], [12, 3, "r"], [12, 4, "r"], [12, 5, "r"], [15, 2, "r"], [15, 3, "r"], [15, 4, "r"], [15, 5, "r"], [13, 0, "r"], [14, 0, "r"]);
|
|
641
|
+
if (t % 6 < 3) rect(13, 5, 14, 5, "r", e);
|
|
642
|
+
const open = t % 24 >= 18 && t % 24 < 21;
|
|
643
|
+
return {
|
|
644
|
+
...BASE,
|
|
645
|
+
y0: 6,
|
|
646
|
+
h: 6,
|
|
647
|
+
x0: 2,
|
|
648
|
+
w: 12,
|
|
649
|
+
lamp: "A",
|
|
650
|
+
eyes: open ? "open" : "closed",
|
|
651
|
+
ey: open ? 1 : 0,
|
|
652
|
+
legs: null,
|
|
653
|
+
extras: e
|
|
654
|
+
};
|
|
655
|
+
},
|
|
656
|
+
wake: t => {
|
|
657
|
+
const c = t % 30;
|
|
658
|
+
if (c < 8) return {
|
|
659
|
+
...BASE,
|
|
660
|
+
x0: 2,
|
|
661
|
+
w: 12,
|
|
662
|
+
y0: 7,
|
|
663
|
+
h: 5,
|
|
664
|
+
lamp: "A",
|
|
665
|
+
eyes: c >= 6 ? "big" : "closed",
|
|
666
|
+
ey: 0,
|
|
667
|
+
legs: null
|
|
668
|
+
};
|
|
669
|
+
if (c < 10) return {
|
|
670
|
+
...BASE,
|
|
671
|
+
x0: 4,
|
|
672
|
+
w: 8,
|
|
673
|
+
y0: 0,
|
|
674
|
+
h: 9,
|
|
675
|
+
lamp: null,
|
|
676
|
+
eyes: "big",
|
|
677
|
+
ey: 1,
|
|
678
|
+
legs: [1, 1, 1]
|
|
679
|
+
};
|
|
680
|
+
if (c < 12) return {
|
|
681
|
+
...BASE,
|
|
682
|
+
y0: 2,
|
|
683
|
+
eyes: "big",
|
|
684
|
+
lamp: "a",
|
|
685
|
+
legs: [1, 1, 1]
|
|
686
|
+
};
|
|
687
|
+
if (c < 14) return {
|
|
688
|
+
...BASE,
|
|
689
|
+
x0: 2,
|
|
690
|
+
w: 12,
|
|
691
|
+
y0: 5,
|
|
692
|
+
h: 6,
|
|
693
|
+
eyes: "open",
|
|
694
|
+
lamp: "a"
|
|
695
|
+
};
|
|
696
|
+
return {
|
|
697
|
+
...BASE,
|
|
698
|
+
eyes: c === 20 || c === 21 ? "closed" : "open",
|
|
699
|
+
legs: [0, 0, 0]
|
|
700
|
+
};
|
|
701
|
+
},
|
|
702
|
+
builder: t => {
|
|
703
|
+
const s = [0, 1, 0, -1][Math.floor(t / 2) % 4];
|
|
704
|
+
const e = [];
|
|
705
|
+
rect(5, 2, 10, 3, "n", e);
|
|
706
|
+
e.push([5, 3, "m"], [10, 3, "m"]);
|
|
707
|
+
rect(4 + s, 0, 9 + s, 1, "p", e);
|
|
708
|
+
e.push([4 + s, 1, "1"]);
|
|
709
|
+
if (Math.floor(t / 2) % 4 === 3 && t % 2) e.push([1, 5, "l"], [0, 4, "l"]);
|
|
710
|
+
const arms = s ? [[1, 5, "g"], [14, 7, "g"]] : [[1, 6, "g"], [14, 6, "g"]];
|
|
711
|
+
return {
|
|
712
|
+
...BASE,
|
|
713
|
+
lamp: null,
|
|
714
|
+
ex: s,
|
|
715
|
+
ey: -1,
|
|
716
|
+
legs: walk(t),
|
|
717
|
+
extras: [...e, ...arms]
|
|
718
|
+
};
|
|
719
|
+
},
|
|
720
|
+
mini: t => {
|
|
721
|
+
const c = t % 32;
|
|
722
|
+
const ex = c < 8 ? 0 : c < 16 ? -1 : c < 24 ? 1 : 0;
|
|
723
|
+
const ey = c >= 24 && c < 28 ? -1 : 0;
|
|
724
|
+
return {
|
|
725
|
+
...BASE,
|
|
726
|
+
x0: 4,
|
|
727
|
+
w: 8,
|
|
728
|
+
y0: 6 + Math.floor(t / 4) % 2,
|
|
729
|
+
h: 5,
|
|
730
|
+
lamp: "a",
|
|
731
|
+
eyes: "big",
|
|
732
|
+
ex,
|
|
733
|
+
ey,
|
|
734
|
+
legs: [Math.floor(t / 2) % 2, 0, (Math.floor(t / 2) + 1) % 2],
|
|
735
|
+
extras: [[2, 8 + t % 2, "g"], [13, 8 + (t + 1) % 2, "g"]]
|
|
736
|
+
};
|
|
737
|
+
},
|
|
738
|
+
minityping: t => {
|
|
739
|
+
const e = [[2, 8 + t % 2, "g"], [13, 8 + (t + 1) % 2, "g"]];
|
|
740
|
+
const dy = t % 6;
|
|
741
|
+
e.push([7 + t % 3, 5 - dy, "p"]);
|
|
742
|
+
return {
|
|
743
|
+
...BASE,
|
|
744
|
+
x0: 4,
|
|
745
|
+
w: 8,
|
|
746
|
+
y0: 7 - t % 2,
|
|
747
|
+
h: 5,
|
|
748
|
+
lamp: null,
|
|
749
|
+
legs: [0, 0, 0],
|
|
750
|
+
extras: e
|
|
751
|
+
};
|
|
752
|
+
},
|
|
753
|
+
happydance: t => {
|
|
754
|
+
const c = t % 4;
|
|
755
|
+
const e = [[1, 5 + [0, 1, 2, 1][c], "g"], [14, 5 + [2, 1, 0, 1][c], "g"]];
|
|
756
|
+
return {
|
|
757
|
+
...BASE,
|
|
758
|
+
eyes: c % 2 ? "happy" : "open",
|
|
759
|
+
legs: c % 2 ? [1, 0, 1] : [0, 1, 0],
|
|
760
|
+
extras: e
|
|
761
|
+
};
|
|
762
|
+
},
|
|
763
|
+
jumping: t => {
|
|
764
|
+
const c = t % 8;
|
|
765
|
+
const y = [0, 1, -1, -3, -4, -2, 0, 0][c];
|
|
766
|
+
const armY = [6, 7, 6, 4, 3, 4, 6, 6][c];
|
|
767
|
+
return {
|
|
768
|
+
...BASE,
|
|
769
|
+
y0: 4 + y,
|
|
770
|
+
eyes: c === 1 ? "closed" : "open",
|
|
771
|
+
legs: c >= 2 && c <= 5 ? [1, 1, 1] : [0, 0, 0],
|
|
772
|
+
extras: [[1, armY + y, "g"], [14, armY + y, "g"]]
|
|
773
|
+
};
|
|
774
|
+
},
|
|
775
|
+
// ── Loading & progress ──────────────────────────────────────────────────
|
|
776
|
+
loading: t => {
|
|
777
|
+
// Three dots chase around a ring at the top right; eyes follow the head.
|
|
778
|
+
const e = [];
|
|
779
|
+
const n = RING.length;
|
|
780
|
+
const head = t % n;
|
|
781
|
+
e.push(pt(RING[head], "l"), pt(RING[(head + n - 1) % n], "n"), pt(RING[(head + n - 2) % n], "m"));
|
|
782
|
+
return {
|
|
783
|
+
...BASE,
|
|
784
|
+
ex: 1,
|
|
785
|
+
ey: -1,
|
|
786
|
+
extras: e
|
|
787
|
+
};
|
|
788
|
+
},
|
|
789
|
+
progress: t => {
|
|
790
|
+
// A bar fills across the top, two ticks per pixel; a hop when it lands.
|
|
791
|
+
const c = t % 32;
|
|
792
|
+
const fill = Math.min(12, Math.floor(c / 2));
|
|
793
|
+
const done = c >= 24;
|
|
794
|
+
const e = [];
|
|
795
|
+
// Lamp colours — a dim track that lights up — so the keyline wraps the whole bar.
|
|
796
|
+
rect(2, 0, 13, 1, "A", e);
|
|
797
|
+
if (fill > 0) rect(2, 0, 1 + fill, 1, "a", e);
|
|
798
|
+
const hop = done && (c === 25 || c === 26) ? 1 : 0;
|
|
799
|
+
return {
|
|
800
|
+
...BASE,
|
|
801
|
+
y0: 4 - hop,
|
|
802
|
+
eyes: done ? "happy" : "open",
|
|
803
|
+
ex: done ? 0 : fill < 4 ? -1 : fill < 9 ? 0 : 1,
|
|
804
|
+
ey: done ? 0 : -1,
|
|
805
|
+
lamp: done && c % 2 ? "A" : "a",
|
|
806
|
+
legs: hop ? [1, 1, 1] : [0, 0, 0],
|
|
807
|
+
extras: e
|
|
808
|
+
};
|
|
809
|
+
},
|
|
810
|
+
hourglass: t => {
|
|
811
|
+
// Sand runs top to bottom, then the glass lifts and flips.
|
|
812
|
+
const c = t % 20;
|
|
813
|
+
const lift = c >= 16 ? -1 : 0;
|
|
814
|
+
const e = [];
|
|
815
|
+
const y = 3 + lift;
|
|
816
|
+
rect(13, y, 15, y, "n", e);
|
|
817
|
+
rect(13, y + 4, 15, y + 4, "n", e);
|
|
818
|
+
e.push([13, y + 1, "n"], [15, y + 1, "n"], [14, y + 2, "n"], [13, y + 3, "n"], [15, y + 3, "n"]);
|
|
819
|
+
const topFull = c < 8 || c >= 16;
|
|
820
|
+
e.push([14, y + 1, topFull ? "a" : "1"], [14, y + 3, topFull ? "1" : "a"]);
|
|
821
|
+
if (c >= 4 && c < 12 && c % 2) e.push([14, y + 2, "a"]);
|
|
822
|
+
e.push([13, 8 + lift, "g"]);
|
|
823
|
+
return {
|
|
824
|
+
...BASE,
|
|
825
|
+
ex: 1,
|
|
826
|
+
eyes: c === 17 ? "closed" : "open",
|
|
827
|
+
extras: e
|
|
828
|
+
};
|
|
829
|
+
},
|
|
830
|
+
waiting: t => {
|
|
831
|
+
// Foot taps, checks the wristwatch, dots pile up.
|
|
832
|
+
const c = t % 16;
|
|
833
|
+
const e = [];
|
|
834
|
+
// Wall clock, top left: a ring with one hand ticking round the face.
|
|
835
|
+
e.push([1, 0, "n"], [2, 0, "n"], [0, 1, "n"], [3, 1, "n"], [0, 2, "n"], [3, 2, "n"], [1, 3, "n"], [2, 3, "n"]);
|
|
836
|
+
rect(1, 1, 2, 2, "l", e);
|
|
837
|
+
e.push(pt([[2, 1], [2, 2], [1, 2], [1, 1]][Math.floor(c / 2) % 4], "k"));
|
|
838
|
+
const dots = Math.min(3, Math.floor(c / 4));
|
|
839
|
+
for (let i = 0; i < dots; i++) e.push([13 + i, 1, "n"]);
|
|
840
|
+
const look = c >= 6 && c < 11;
|
|
841
|
+
return {
|
|
842
|
+
...BASE,
|
|
843
|
+
ex: look ? -1 : 0,
|
|
844
|
+
ey: look ? -1 : 0,
|
|
845
|
+
legs: [0, 0, c % 2],
|
|
846
|
+
extras: e
|
|
847
|
+
};
|
|
848
|
+
},
|
|
849
|
+
syncing: t => {
|
|
850
|
+
// Two arcs chase each other around the ring; the lamp pulses in step.
|
|
851
|
+
const e = [];
|
|
852
|
+
const n = RING.length;
|
|
853
|
+
const p = t % n;
|
|
854
|
+
for (const off of [0, 1, 2]) {
|
|
855
|
+
e.push(pt(RING[(p + off) % n], off === 2 ? "l" : "n"));
|
|
856
|
+
e.push(pt(RING[(p + off + 5) % n], off === 2 ? "l" : "n"));
|
|
857
|
+
}
|
|
858
|
+
return {
|
|
859
|
+
...BASE,
|
|
860
|
+
ex: 1,
|
|
861
|
+
ey: -1,
|
|
862
|
+
lamp: t % 4 < 2 ? "a" : "A",
|
|
863
|
+
extras: e
|
|
864
|
+
};
|
|
865
|
+
},
|
|
866
|
+
downloading: t => {
|
|
867
|
+
// An arrow drops into a tray; the parcel lands, then the tray clears.
|
|
868
|
+
const c = t % 12;
|
|
869
|
+
const e = [[13, 5, "n"], [15, 5, "n"], [13, 6, "n"], [14, 6, "n"], [15, 6, "n"]];
|
|
870
|
+
if (c < 6) {
|
|
871
|
+
const y = Math.floor(c / 2);
|
|
872
|
+
arrowDown(14, y, "l", e);
|
|
873
|
+
} else if (c === 6) {
|
|
874
|
+
rect(13, 6, 15, 6, "l", e);
|
|
875
|
+
} else if (c < 10) {
|
|
876
|
+
e.push([14, 5, "a"]);
|
|
877
|
+
}
|
|
878
|
+
return {
|
|
879
|
+
...BASE,
|
|
880
|
+
ex: 1,
|
|
881
|
+
ey: c < 2 ? -1 : c < 6 ? 0 : 1,
|
|
882
|
+
extras: e
|
|
883
|
+
};
|
|
884
|
+
},
|
|
885
|
+
uploading: t => {
|
|
886
|
+
// The parcel lifts off the tray and climbs out of frame.
|
|
887
|
+
const c = t % 12;
|
|
888
|
+
const e = [[13, 5, "n"], [15, 5, "n"], [13, 6, "n"], [14, 6, "n"], [15, 6, "n"]];
|
|
889
|
+
if (c < 2) e.push([14, 5, "a"]);else if (c < 10) arrowUp(14, 2 - Math.floor((c - 2) / 2), "l", e);
|
|
890
|
+
return {
|
|
891
|
+
...BASE,
|
|
892
|
+
ex: 1,
|
|
893
|
+
ey: c < 4 ? 1 : c < 8 ? 0 : -1,
|
|
894
|
+
extras: e
|
|
895
|
+
};
|
|
896
|
+
},
|
|
897
|
+
connecting: t => {
|
|
898
|
+
// Signal bars fill one at a time, then all four blink: connected.
|
|
899
|
+
const c = t % 14;
|
|
900
|
+
const bars = c < 8 ? Math.floor(c / 2) : c % 2 ? 4 : 0;
|
|
901
|
+
const e = [];
|
|
902
|
+
for (let i = 0; i < 4; i++) {
|
|
903
|
+
const x = 12 + i;
|
|
904
|
+
const lit = i < bars;
|
|
905
|
+
for (let y = 4 - i; y <= 4; y++) e.push([x, y, lit ? "g" : "1"]);
|
|
906
|
+
}
|
|
907
|
+
return {
|
|
908
|
+
...BASE,
|
|
909
|
+
ex: 1,
|
|
910
|
+
ey: -1,
|
|
911
|
+
eyes: c >= 8 ? "happy" : "open",
|
|
912
|
+
extras: e
|
|
913
|
+
};
|
|
914
|
+
},
|
|
915
|
+
scanning: t => {
|
|
916
|
+
// A bright line sweeps down the body with a faint trail.
|
|
917
|
+
const c = t % 14;
|
|
918
|
+
const e = [];
|
|
919
|
+
if (c < 9) {
|
|
920
|
+
const y = 4 + c;
|
|
921
|
+
if (c > 0) rect(1, y - 1, 14, y - 1, "n", e);
|
|
922
|
+
rect(1, y, 14, y, "l", e);
|
|
923
|
+
}
|
|
924
|
+
return {
|
|
925
|
+
...BASE,
|
|
926
|
+
eyes: "big",
|
|
927
|
+
legs: [0, 0, 0],
|
|
928
|
+
extras: e
|
|
929
|
+
};
|
|
930
|
+
},
|
|
931
|
+
searching: t => {
|
|
932
|
+
// Binoculars up, slow sweep left and right.
|
|
933
|
+
const e = [];
|
|
934
|
+
for (const x of [4, 9]) {
|
|
935
|
+
rect(x, 5, x + 2, 5, "n", e);
|
|
936
|
+
rect(x, 7, x + 2, 7, "n", e);
|
|
937
|
+
e.push([x, 6, "n"], [x + 2, 6, "n"], [x + 1, 6, "k"]);
|
|
938
|
+
}
|
|
939
|
+
e.push([7, 6, "n"], [8, 6, "n"]);
|
|
940
|
+
const s = Math.floor(t / 3) % 4;
|
|
941
|
+
const dx = [-1, 0, 1, 0][s];
|
|
942
|
+
return {
|
|
943
|
+
...BASE,
|
|
944
|
+
dx,
|
|
945
|
+
legs: s % 2 ? walk(t) : [0, 0, 0],
|
|
946
|
+
extras: e
|
|
947
|
+
};
|
|
948
|
+
},
|
|
949
|
+
// ── Empty & nothing ─────────────────────────────────────────────────────
|
|
950
|
+
empty: t => {
|
|
951
|
+
// Peers into an open box, finds nothing, looks back at you.
|
|
952
|
+
const c = t % 16;
|
|
953
|
+
const e = [];
|
|
954
|
+
rect(13, 7, 13, 10, "n", e);
|
|
955
|
+
rect(15, 7, 15, 10, "n", e);
|
|
956
|
+
rect(14, 10, 14, 10, "n", e);
|
|
957
|
+
rect(14, 8, 14, 9, "1", e);
|
|
958
|
+
const dots = c >= 9 ? Math.min(3, c - 8) : 0;
|
|
959
|
+
for (let i = 0; i < dots; i++) e.push([12 + i, 1, "n"]);
|
|
960
|
+
const peer = c < 8;
|
|
961
|
+
return {
|
|
962
|
+
...BASE,
|
|
963
|
+
ex: peer ? 1 : 0,
|
|
964
|
+
ey: peer ? 1 : 0,
|
|
965
|
+
eyes: c === 8 ? "closed" : "open",
|
|
966
|
+
extras: e
|
|
967
|
+
};
|
|
968
|
+
},
|
|
969
|
+
shrug: t => {
|
|
970
|
+
// Arms up, looks left, looks right, arms down.
|
|
971
|
+
const c = t % 16;
|
|
972
|
+
const up = c >= 4 && c < 12;
|
|
973
|
+
const e = up ? [[2, 5, "g"], [1, 4, "g"], [13, 5, "g"], [14, 4, "g"]] : [];
|
|
974
|
+
return {
|
|
975
|
+
...BASE,
|
|
976
|
+
ex: c < 4 ? 0 : c < 8 ? -1 : c < 12 ? 1 : 0,
|
|
977
|
+
ey: up ? -1 : 0,
|
|
978
|
+
extras: e
|
|
979
|
+
};
|
|
980
|
+
},
|
|
981
|
+
fishing: t => {
|
|
982
|
+
// Rod out, bobber bobbing; one tug, one splash, back to waiting.
|
|
983
|
+
const c = t % 32;
|
|
984
|
+
const e = [[13, 6, "g"], [14, 6, "g"], [14, 5, "m"], [15, 4, "m"]];
|
|
985
|
+
const tug = c >= 20 && c < 24;
|
|
986
|
+
const pop = c >= 24 && c < 27;
|
|
987
|
+
const by = tug ? 14 : pop ? 11 : 12 + Math.floor(c / 4) % 2;
|
|
988
|
+
rect(15, 5, 15, by - 1, "n", e);
|
|
989
|
+
e.push([15, by, "r"], [15, by + 1, "l"]);
|
|
990
|
+
if (pop) e.push([14, 12, "l"], [13, 13, "l"]);
|
|
991
|
+
return {
|
|
992
|
+
...BASE,
|
|
993
|
+
ex: 1,
|
|
994
|
+
eyes: tug ? "big" : c === 15 ? "closed" : "open",
|
|
995
|
+
extras: e
|
|
996
|
+
};
|
|
997
|
+
},
|
|
998
|
+
listening: t => {
|
|
999
|
+
// Shifted left; a hand cupped at the side, sound arcs arriving from the right.
|
|
1000
|
+
const c = Math.floor(t / 2) % 4;
|
|
1001
|
+
const e = [[13, 5, "g"], [14, 5, "g"], [14, 6, "g"]];
|
|
1002
|
+
const inner = [[15, 4, "n"], [16, 5, "n"], [16, 6, "n"], [15, 7, "n"]];
|
|
1003
|
+
const outer = [[16, 3, "l"], [17, 4, "l"], [17, 5, "l"], [17, 6, "l"], [17, 7, "l"], [16, 8, "l"]];
|
|
1004
|
+
if (c === 0 || c === 1) e.push(...inner);
|
|
1005
|
+
if (c === 1 || c === 2) e.push(...outer);
|
|
1006
|
+
return {
|
|
1007
|
+
...BASE,
|
|
1008
|
+
dx: -2,
|
|
1009
|
+
eyes: "closed",
|
|
1010
|
+
extras: e
|
|
1011
|
+
};
|
|
1012
|
+
},
|
|
1013
|
+
tumbleweed: t => {
|
|
1014
|
+
// A tumbleweed rolls past in the foreground; eyes follow it off the edge.
|
|
1015
|
+
const c = t % 28;
|
|
1016
|
+
const e = [];
|
|
1017
|
+
const wx = 15 - c;
|
|
1018
|
+
if (c < 20) {
|
|
1019
|
+
if (c % 2) e.push([wx, 11, "A"], [wx + 2, 11, "A"], [wx + 1, 12, "A"], [wx, 13, "A"], [wx + 2, 13, "A"]);else e.push([wx + 1, 11, "A"], [wx, 12, "A"], [wx + 2, 12, "A"], [wx + 1, 13, "A"]);
|
|
1020
|
+
}
|
|
1021
|
+
const ex = c >= 20 ? 0 : wx > 8 ? 1 : wx > 3 ? 0 : -1;
|
|
1022
|
+
return {
|
|
1023
|
+
...BASE,
|
|
1024
|
+
ex,
|
|
1025
|
+
ey: c < 20 ? 1 : 0,
|
|
1026
|
+
extras: e
|
|
1027
|
+
};
|
|
1028
|
+
},
|
|
1029
|
+
// ── Errors & trouble ────────────────────────────────────────────────────
|
|
1030
|
+
warning: t => {
|
|
1031
|
+
// Shifted left; a warning sign held up on the right, lamp blinking.
|
|
1032
|
+
const e = [];
|
|
1033
|
+
e.push([15, 0, "a"]);
|
|
1034
|
+
rect(14, 1, 16, 2, "a", e);
|
|
1035
|
+
rect(13, 3, 17, 4, "a", e);
|
|
1036
|
+
e.push([15, 1, "k"], [15, 2, "k"], [15, 4, "k"]);
|
|
1037
|
+
e.push([13, 5, "g"], [14, 5, "g"]);
|
|
1038
|
+
return {
|
|
1039
|
+
...BASE,
|
|
1040
|
+
dx: -2,
|
|
1041
|
+
eyes: "big",
|
|
1042
|
+
ex: 1,
|
|
1043
|
+
ey: -1,
|
|
1044
|
+
lamp: t % 4 < 2 ? "a" : "A",
|
|
1045
|
+
extras: e
|
|
1046
|
+
};
|
|
1047
|
+
},
|
|
1048
|
+
crash: t => {
|
|
1049
|
+
// Burst, smoke, then dazed.
|
|
1050
|
+
const c = t % 20;
|
|
1051
|
+
const e = [];
|
|
1052
|
+
if (c < 3) {
|
|
1053
|
+
const rays = c % 2 ? [[1, 2], [14, 2], [0, 7], [15, 7], [4, 0], [11, 0], [1, 11], [14, 11]] : [[2, 1], [13, 1], [0, 5], [15, 5], [6, 0], [9, 0], [0, 9], [15, 9]];
|
|
1054
|
+
rays.forEach(r => e.push(pt(r, c === 0 ? "l" : "a")));
|
|
1055
|
+
} else if (c < 10) {
|
|
1056
|
+
const y = 2 - Math.floor((c - 3) / 2);
|
|
1057
|
+
if (y >= 0) e.push([2, y, "n"], [13, y, "n"], [1, y + 1, "n"], [14, y + 1, "n"]);
|
|
1058
|
+
}
|
|
1059
|
+
return {
|
|
1060
|
+
...BASE,
|
|
1061
|
+
eyes: "x",
|
|
1062
|
+
lamp: c < 3 ? "r" : "R",
|
|
1063
|
+
dx: c < 3 ? [0, 1, -1][c] : c >= 10 ? [0, 1, 0, -1][c % 4] : 0,
|
|
1064
|
+
legs: c < 10 ? [1, 1, 1] : [0, 0, 0],
|
|
1065
|
+
extras: e
|
|
1066
|
+
};
|
|
1067
|
+
},
|
|
1068
|
+
panic: t => {
|
|
1069
|
+
// Arms flail, sweat flies, lamp strobes.
|
|
1070
|
+
const u = t % 2;
|
|
1071
|
+
const e = u ? [[2, 5, "g"], [1, 4, "g"], [13, 5, "g"], [14, 4, "g"], [14, 2, "l"]] : [[2, 7, "g"], [1, 8, "g"], [13, 7, "g"], [14, 8, "g"], [1, 3, "l"]];
|
|
1072
|
+
return {
|
|
1073
|
+
...BASE,
|
|
1074
|
+
eyes: "big",
|
|
1075
|
+
lamp: u ? "r" : "a",
|
|
1076
|
+
dx: [0, 1, 0, -1][t % 4],
|
|
1077
|
+
legs: walk(t),
|
|
1078
|
+
extras: e
|
|
1079
|
+
};
|
|
1080
|
+
},
|
|
1081
|
+
sos: t => {
|
|
1082
|
+
// The lamp flashes S-O-S in morse; arms wave between letters.
|
|
1083
|
+
const c = t % SOS.length;
|
|
1084
|
+
const on = SOS[c] === 1;
|
|
1085
|
+
const u = Math.floor(t / 2) % 2;
|
|
1086
|
+
const e = [[1, 4 + u * 2, "g"], [2, 5 + u * 2, "g"], [13, 5 + u * 2, "g"], [14, 4 + u * 2, "g"]];
|
|
1087
|
+
return {
|
|
1088
|
+
...BASE,
|
|
1089
|
+
eyes: "big",
|
|
1090
|
+
lamp: on ? "r" : "R",
|
|
1091
|
+
extras: e
|
|
1092
|
+
};
|
|
1093
|
+
},
|
|
1094
|
+
offline: t => {
|
|
1095
|
+
// A struck-through cloud; slumped, lamp dim, one glance up.
|
|
1096
|
+
const c = t % 16;
|
|
1097
|
+
const e = [];
|
|
1098
|
+
rect(11, 0, 14, 0, "n", e);
|
|
1099
|
+
rect(10, 1, 15, 1, "n", e);
|
|
1100
|
+
rect(11, 2, 14, 2, "n", e);
|
|
1101
|
+
if (c % 4 < 2) e.push([10, 3, "r"], [11, 2, "r"], [12, 1, "r"], [13, 0, "r"]);
|
|
1102
|
+
const glance = c >= 10 && c < 14;
|
|
1103
|
+
return {
|
|
1104
|
+
...BASE,
|
|
1105
|
+
y0: 5,
|
|
1106
|
+
lamp: "A",
|
|
1107
|
+
eyes: glance ? "open" : "closed",
|
|
1108
|
+
ex: 1,
|
|
1109
|
+
ey: glance ? -1 : 0,
|
|
1110
|
+
extras: e
|
|
1111
|
+
};
|
|
1112
|
+
},
|
|
1113
|
+
timeout: t => {
|
|
1114
|
+
// A clock ticks round, then turns red; Otto shakes.
|
|
1115
|
+
const c = t % 16;
|
|
1116
|
+
const late = c >= 12;
|
|
1117
|
+
const e = [];
|
|
1118
|
+
const ring = late ? "r" : "n";
|
|
1119
|
+
e.push([13, 1, ring], [14, 1, ring], [12, 2, ring], [15, 2, ring], [12, 3, ring], [15, 3, ring], [13, 4, ring], [14, 4, ring]);
|
|
1120
|
+
rect(13, 2, 14, 3, "l", e);
|
|
1121
|
+
e.push(pt([[14, 2], [14, 3], [13, 3], [13, 2]][late ? 0 : Math.floor(c / 3) % 4], "k"));
|
|
1122
|
+
return {
|
|
1123
|
+
...BASE,
|
|
1124
|
+
ex: 1,
|
|
1125
|
+
ey: -1,
|
|
1126
|
+
eyes: late ? "closed" : "open",
|
|
1127
|
+
lamp: late && c % 2 ? "r" : "a",
|
|
1128
|
+
dx: late ? [0, 1, 0, -1][c % 4] : 0,
|
|
1129
|
+
extras: e
|
|
1130
|
+
};
|
|
1131
|
+
},
|
|
1132
|
+
locked: t => {
|
|
1133
|
+
// A padlock on the right: look, strain at it, give up with a shrug.
|
|
1134
|
+
const c = t % 20;
|
|
1135
|
+
const e = [];
|
|
1136
|
+
padlock(false, e);
|
|
1137
|
+
const strain = c >= 6 && c < 12;
|
|
1138
|
+
const give = c >= 12;
|
|
1139
|
+
if (strain) e.push([13, 7, "g"], [14, 7, "g"]);
|
|
1140
|
+
if (give) e.push([2, 5, "g"], [1, 4, "g"]);
|
|
1141
|
+
return {
|
|
1142
|
+
...BASE,
|
|
1143
|
+
ex: give ? 0 : 1,
|
|
1144
|
+
ey: give ? 0 : -1,
|
|
1145
|
+
eyes: strain ? "closed" : "open",
|
|
1146
|
+
dx: strain && c % 2 ? -1 : 0,
|
|
1147
|
+
extras: e
|
|
1148
|
+
};
|
|
1149
|
+
},
|
|
1150
|
+
unlocked: t => {
|
|
1151
|
+
// The shackle pops open; sparkles, a hop, a happy Otto.
|
|
1152
|
+
const c = t % 20;
|
|
1153
|
+
const open = c >= 4;
|
|
1154
|
+
const e = [];
|
|
1155
|
+
padlock(open, e);
|
|
1156
|
+
if (c >= 4 && c < 10) {
|
|
1157
|
+
const sp = c % 2 ? [[11, 0], [15, 5], [12, 6]] : [[12, 0], [11, 4], [15, 6]];
|
|
1158
|
+
sp.forEach(s => e.push(pt(s, "l")));
|
|
1159
|
+
}
|
|
1160
|
+
const hop = c === 5 || c === 6 ? 1 : 0;
|
|
1161
|
+
return {
|
|
1162
|
+
...BASE,
|
|
1163
|
+
y0: 4 - hop,
|
|
1164
|
+
ex: open ? 0 : 1,
|
|
1165
|
+
ey: open ? 0 : -1,
|
|
1166
|
+
eyes: open ? "happy" : "open",
|
|
1167
|
+
lamp: open && c % 2 ? "A" : "a",
|
|
1168
|
+
legs: hop ? [1, 1, 1] : [0, 0, 0],
|
|
1169
|
+
extras: e
|
|
1170
|
+
};
|
|
1171
|
+
},
|
|
1172
|
+
denied: t => {
|
|
1173
|
+
// Shifted left; a red no-entry sign, head shaking.
|
|
1174
|
+
const e = [];
|
|
1175
|
+
rect(13, 0, 15, 0, "r", e);
|
|
1176
|
+
rect(13, 4, 15, 4, "r", e);
|
|
1177
|
+
for (let y = 1; y <= 3; y++) e.push([12, y, "r"], [16, y, "r"]);
|
|
1178
|
+
e.push([13, 3, "r"], [14, 2, "r"], [15, 1, "r"]);
|
|
1179
|
+
return {
|
|
1180
|
+
...BASE,
|
|
1181
|
+
dx: -1,
|
|
1182
|
+
ex: [-1, 0, 1, 0][Math.floor(t / 2) % 4],
|
|
1183
|
+
ey: -1,
|
|
1184
|
+
extras: e
|
|
1185
|
+
};
|
|
1186
|
+
},
|
|
1187
|
+
broken: t => {
|
|
1188
|
+
// A crack down the middle; a band-aid goes on.
|
|
1189
|
+
const c = t % 24;
|
|
1190
|
+
const e = [[8, 4, "k"], [7, 5, "k"], [8, 6, "k"], [7, 7, "k"], [8, 8, "k"], [7, 9, "k"], [8, 10, "k"]];
|
|
1191
|
+
if (c >= 8) {
|
|
1192
|
+
rect(6, 8, 9, 9, "n", e);
|
|
1193
|
+
rect(7, 8, 8, 9, "l", e);
|
|
1194
|
+
}
|
|
1195
|
+
return {
|
|
1196
|
+
...BASE,
|
|
1197
|
+
eyes: c < 8 ? "closed" : c === 20 ? "closed" : "open",
|
|
1198
|
+
lamp: c < 8 && c % 2 ? "A" : "a",
|
|
1199
|
+
dx: c < 4 ? [0, 1, 0, -1][c] : 0,
|
|
1200
|
+
extras: e
|
|
1201
|
+
};
|
|
1202
|
+
},
|
|
1203
|
+
sad: t => {
|
|
1204
|
+
// Sunk a row, lamp dim, a tear rolls down and drops in.
|
|
1205
|
+
const c = t % 16;
|
|
1206
|
+
const ty = c >= 2 && c < 10 ? 8 + Math.floor((c - 2) / 2) : c >= 10 && c < 12 ? 12 : -1;
|
|
1207
|
+
const e = ty >= 0 ? [[5, ty, "l"]] : [];
|
|
1208
|
+
return {
|
|
1209
|
+
...BASE,
|
|
1210
|
+
y0: 5,
|
|
1211
|
+
lamp: "A",
|
|
1212
|
+
eyes: "closed",
|
|
1213
|
+
extras: e
|
|
1214
|
+
};
|
|
1215
|
+
},
|
|
1216
|
+
rain: t => {
|
|
1217
|
+
// A rain cloud overhead, drops falling; lamp dim, eyes shut.
|
|
1218
|
+
const c = t % 12;
|
|
1219
|
+
const e = [];
|
|
1220
|
+
rect(5, 0, 10, 0, "n", e);
|
|
1221
|
+
rect(4, 1, 11, 1, "m", e);
|
|
1222
|
+
[1, 4, 8, 11, 14].forEach((x, i) => {
|
|
1223
|
+
const y = 2 + (c + i * 3) % 11;
|
|
1224
|
+
e.push([x, y, "l"]);
|
|
1225
|
+
});
|
|
1226
|
+
return {
|
|
1227
|
+
...BASE,
|
|
1228
|
+
y0: 5,
|
|
1229
|
+
lamp: "A",
|
|
1230
|
+
eyes: "closed",
|
|
1231
|
+
extras: e
|
|
1232
|
+
};
|
|
1233
|
+
},
|
|
1234
|
+
sick: t => {
|
|
1235
|
+
// A thermometer climbs; wobbling, sweating, eyes shut.
|
|
1236
|
+
const c = t % 12;
|
|
1237
|
+
const e = [];
|
|
1238
|
+
rect(14, 2, 14, 7, "l", e);
|
|
1239
|
+
e.push([14, 8, "r"], [15, 3, "n"], [15, 5, "n"]);
|
|
1240
|
+
const level = Math.min(4, Math.floor(c / 2));
|
|
1241
|
+
if (level > 0) rect(14, 8 - level, 14, 7, "r", e);
|
|
1242
|
+
e.push(c % 2 ? [2, 4, "l"] : [1, 5, "l"]);
|
|
1243
|
+
return {
|
|
1244
|
+
...BASE,
|
|
1245
|
+
eyes: "closed",
|
|
1246
|
+
lamp: "A",
|
|
1247
|
+
dx: [0, 1, 0, -1][Math.floor(c / 3) % 4],
|
|
1248
|
+
extras: e
|
|
1249
|
+
};
|
|
1250
|
+
},
|
|
1251
|
+
flood: t => {
|
|
1252
|
+
// In over the eyes, arms flailing, bubbles rising, lamp strobing.
|
|
1253
|
+
const c = t % 8;
|
|
1254
|
+
const e = [[1, 7 + c % 2, "g"], [2, 8 + c % 2, "g"], [13, 8 - c % 2, "g"], [14, 7 - c % 2, "g"], [0, 11 - c % 4, "l"], [15, 12 - (c + 2) % 4, "l"]];
|
|
1255
|
+
return {
|
|
1256
|
+
...BASE,
|
|
1257
|
+
submerged: true,
|
|
1258
|
+
y0: 9,
|
|
1259
|
+
eyes: "big",
|
|
1260
|
+
lamp: c % 2 ? "a" : "A",
|
|
1261
|
+
legs: null,
|
|
1262
|
+
extras: e
|
|
1263
|
+
};
|
|
1264
|
+
},
|
|
1265
|
+
bug: t => {
|
|
1266
|
+
// A beetle crawls across the body; eyes track it; it flies off.
|
|
1267
|
+
const c = t % 24;
|
|
1268
|
+
const e = [];
|
|
1269
|
+
let ex = 0;
|
|
1270
|
+
let ey = 1;
|
|
1271
|
+
if (c < 20) {
|
|
1272
|
+
const bx = 3 + Math.floor(c / 2);
|
|
1273
|
+
rect(bx, 8, bx + 1, 9, "1", e);
|
|
1274
|
+
e.push([bx - 1, 9 - c % 2, "k"], [bx + 2, 8 + c % 2, "k"]);
|
|
1275
|
+
ex = bx < 6 ? -1 : bx > 9 ? 1 : 0;
|
|
1276
|
+
} else {
|
|
1277
|
+
const f = c - 20;
|
|
1278
|
+
e.push([12 + f, 7 - f, "1"], [13 + f, 7 - f, "1"], [12 + f, 6 - f, "n"], [14 + f, 6 - f, "n"]);
|
|
1279
|
+
ex = 1;
|
|
1280
|
+
ey = -1;
|
|
1281
|
+
}
|
|
1282
|
+
return {
|
|
1283
|
+
...BASE,
|
|
1284
|
+
ex,
|
|
1285
|
+
ey,
|
|
1286
|
+
eyes: c >= 18 ? "big" : "open",
|
|
1287
|
+
extras: e
|
|
1288
|
+
};
|
|
1289
|
+
},
|
|
1290
|
+
alarm: t => {
|
|
1291
|
+
// The lamp becomes a siren: red strobe, light rays sweeping.
|
|
1292
|
+
const u = t % 2;
|
|
1293
|
+
const e = u ? [[4, 2, "l"], [11, 2, "l"], [6, 0, "l"], [9, 0, "l"]] : [[3, 1, "l"], [12, 1, "l"], [7, 0, "l"], [8, 0, "l"]];
|
|
1294
|
+
return {
|
|
1295
|
+
...BASE,
|
|
1296
|
+
eyes: "big",
|
|
1297
|
+
lamp: u ? "r" : "R",
|
|
1298
|
+
extras: e
|
|
1299
|
+
};
|
|
1300
|
+
},
|
|
1301
|
+
frozen: t => {
|
|
1302
|
+
// Iced over: icicles for legs, snow falling, shivering.
|
|
1303
|
+
const c = t % 12;
|
|
1304
|
+
const e = [[4, 11, "l"], [4, 12, "l"], [7, 11, "l"], [10, 11, "l"], [10, 12, "l"], [3, 3, "l"], [12, 3, "l"]];
|
|
1305
|
+
[1, 14, 5, 10].forEach((x, i) => e.push([x, (c * 2 + i * 3) % 12, "l"]));
|
|
1306
|
+
return {
|
|
1307
|
+
...BASE,
|
|
1308
|
+
lamp: "A",
|
|
1309
|
+
legs: null,
|
|
1310
|
+
dx: t % 2,
|
|
1311
|
+
extras: e
|
|
1312
|
+
};
|
|
1313
|
+
},
|
|
1314
|
+
snail: t => {
|
|
1315
|
+
// A snail crosses the foreground at one pixel per six ticks.
|
|
1316
|
+
const c = t % 36;
|
|
1317
|
+
const e = [];
|
|
1318
|
+
const sx = Math.floor(c / 6) - 3;
|
|
1319
|
+
rect(sx, 9, sx + 2, 11, "A", e);
|
|
1320
|
+
e.push([sx + 1, 10, "a"], [sx + 3, 11, "n"], [sx + 4, 11, "n"], [sx + 4, 10, "n"], [sx + 4, 9, "k"]);
|
|
1321
|
+
return {
|
|
1322
|
+
...BASE,
|
|
1323
|
+
ex: -1,
|
|
1324
|
+
ey: 1,
|
|
1325
|
+
eyes: c % 12 === 11 ? "closed" : "open",
|
|
1326
|
+
extras: e
|
|
1327
|
+
};
|
|
1328
|
+
},
|
|
1329
|
+
angry: t => {
|
|
1330
|
+
// Brows down, lamp red, steam off the top, stomping.
|
|
1331
|
+
const e = [[4, 5, "k"], [5, 5, "k"], [6, 6, "k"], [9, 6, "k"], [10, 5, "k"], [11, 5, "k"]];
|
|
1332
|
+
if (t % 2) e.push([4, 1, "n"], [11, 1, "n"]);else e.push([3, 0, "n"], [12, 0, "n"]);
|
|
1333
|
+
return {
|
|
1334
|
+
...BASE,
|
|
1335
|
+
ey: 1,
|
|
1336
|
+
lamp: t % 4 < 2 ? "r" : "R",
|
|
1337
|
+
legs: walk(t),
|
|
1338
|
+
extras: e
|
|
1339
|
+
};
|
|
1340
|
+
},
|
|
1341
|
+
ghost: t => {
|
|
1342
|
+
// Grey, translucent, no legs, floating; white eyes.
|
|
1343
|
+
const c = t % 8;
|
|
1344
|
+
const e = [];
|
|
1345
|
+
const y0 = 4 - (c < 4 ? 0 : 1);
|
|
1346
|
+
rect(4, y0, 11, y0 + 6, "m", e);
|
|
1347
|
+
rect(3, y0 + 1, 3, y0 + 5, "m", e);
|
|
1348
|
+
rect(12, y0 + 1, 12, y0 + 5, "m", e);
|
|
1349
|
+
[4, 7, 10].forEach(x => e.push([x, y0 + 7, "m"]));
|
|
1350
|
+
rect(5, y0 + 2, 6, y0 + 3, "l", e);
|
|
1351
|
+
rect(9, y0 + 2, 10, y0 + 3, "l", e);
|
|
1352
|
+
return {
|
|
1353
|
+
...BASE,
|
|
1354
|
+
y0,
|
|
1355
|
+
lamp: "A",
|
|
1356
|
+
legs: null,
|
|
1357
|
+
extras: e
|
|
1358
|
+
};
|
|
1359
|
+
},
|
|
1360
|
+
nervous: t => {
|
|
1361
|
+
// Eyes darting, sweat, feet fidgeting, lamp flickering.
|
|
1362
|
+
const e = [t % 2 ? [13, 3, "l"] : [2, 3, "l"]];
|
|
1363
|
+
return {
|
|
1364
|
+
...BASE,
|
|
1365
|
+
ex: t % 2 ? 1 : -1,
|
|
1366
|
+
lamp: t % 3 ? "a" : "A",
|
|
1367
|
+
legs: t % 2 ? [1, 0, 0] : [0, 0, 1],
|
|
1368
|
+
extras: e
|
|
1369
|
+
};
|
|
1370
|
+
},
|
|
1371
|
+
// ── Questions & investigation ───────────────────────────────────────────
|
|
1372
|
+
puzzled: t => {
|
|
1373
|
+
// A tentacle curls up to scratch the head; eyes wander.
|
|
1374
|
+
const c = t % 16;
|
|
1375
|
+
const scratch = c >= 4 && c < 12;
|
|
1376
|
+
const e = scratch ? [[13, 6, "g"], [14, 5, "g"], [14, 4, "g"], [13, 3 - c % 2, "g"]] : [];
|
|
1377
|
+
return {
|
|
1378
|
+
...BASE,
|
|
1379
|
+
ex: c < 4 ? 0 : c < 8 ? -1 : c < 12 ? 1 : 0,
|
|
1380
|
+
ey: scratch ? -1 : 0,
|
|
1381
|
+
eyes: c === 14 ? "closed" : "open",
|
|
1382
|
+
extras: e
|
|
1383
|
+
};
|
|
1384
|
+
},
|
|
1385
|
+
detective: t => {
|
|
1386
|
+
// Deerstalker hat, magnifying glass held out and moving; eyes track it.
|
|
1387
|
+
const c = t % 16;
|
|
1388
|
+
const e = [];
|
|
1389
|
+
rect(3, 3, 12, 3, "A", e);
|
|
1390
|
+
rect(5, 1, 10, 2, "A", e);
|
|
1391
|
+
rect(5, 2, 10, 2, "a", e);
|
|
1392
|
+
const gy = Math.floor(c / 4) % 2 ? 4 : 5;
|
|
1393
|
+
e.push([0, gy, "n"], [1, gy, "n"], [2, gy, "n"], [0, gy + 1, "n"], [2, gy + 1, "n"], [0, gy + 2, "n"], [1, gy + 2, "n"], [2, gy + 2, "n"]);
|
|
1394
|
+
e.push([1, gy + 1, "l"], [2, gy + 3, "g"], [1, gy + 3, "g"]);
|
|
1395
|
+
return {
|
|
1396
|
+
...BASE,
|
|
1397
|
+
lamp: null,
|
|
1398
|
+
ex: -1,
|
|
1399
|
+
ey: gy === 4 ? -1 : 0,
|
|
1400
|
+
eyes: c === 15 ? "closed" : "open",
|
|
1401
|
+
extras: e
|
|
1402
|
+
};
|
|
1403
|
+
},
|
|
1404
|
+
reading: t => {
|
|
1405
|
+
// An open book held up; eyes run along the lines; a page turns.
|
|
1406
|
+
const c = t % 24;
|
|
1407
|
+
const e = [];
|
|
1408
|
+
rect(3, 8, 12, 11, "l", e);
|
|
1409
|
+
rect(7, 8, 8, 11, "n", e);
|
|
1410
|
+
const flip = c >= 20 && c < 22;
|
|
1411
|
+
if (flip) rect(9, 8, 12, 11, "n", e);
|
|
1412
|
+
for (const y of [9, 10]) {
|
|
1413
|
+
rect(4, y, 6, y, "k", e);
|
|
1414
|
+
if (!flip) rect(9, y, 11, y, "k", e);
|
|
1415
|
+
}
|
|
1416
|
+
e.push([2, 9, "g"], [13, 9, "g"]);
|
|
1417
|
+
return {
|
|
1418
|
+
...BASE,
|
|
1419
|
+
ey: 1,
|
|
1420
|
+
ex: c < 20 ? [-1, 0, 1][Math.floor(c / 2) % 3] : 0,
|
|
1421
|
+
eyes: c === 22 ? "closed" : "open",
|
|
1422
|
+
legs: null,
|
|
1423
|
+
extras: e
|
|
1424
|
+
};
|
|
1425
|
+
},
|
|
1426
|
+
// ── Success & celebration ───────────────────────────────────────────────
|
|
1427
|
+
success: t => {
|
|
1428
|
+
// A check mark lands on the right; sparkles, a hop, the lamp blinks.
|
|
1429
|
+
const c = t % 16;
|
|
1430
|
+
const e = [];
|
|
1431
|
+
if (c >= 2) e.push([11, 2, "g"], [12, 3, "g"], [13, 2, "g"], [14, 1, "g"], [15, 0, "g"]);
|
|
1432
|
+
if (c >= 3 && c < 7) {
|
|
1433
|
+
const sp = c % 2 ? [[10, 0], [15, 3], [13, 5]] : [[11, 0], [14, 4], [9, 1]];
|
|
1434
|
+
sp.forEach(s => e.push(pt(s, "l")));
|
|
1435
|
+
}
|
|
1436
|
+
const hop = c === 3 || c === 4 ? 1 : 0;
|
|
1437
|
+
return {
|
|
1438
|
+
...BASE,
|
|
1439
|
+
y0: 4 - hop,
|
|
1440
|
+
eyes: c >= 2 ? "happy" : "open",
|
|
1441
|
+
ex: c >= 2 ? 0 : 1,
|
|
1442
|
+
ey: c >= 2 ? 0 : -1,
|
|
1443
|
+
lamp: c >= 2 && c < 8 && c % 2 ? "A" : "a",
|
|
1444
|
+
legs: hop ? [1, 1, 1] : [0, 0, 0],
|
|
1445
|
+
extras: e
|
|
1446
|
+
};
|
|
1447
|
+
},
|
|
1448
|
+
celebrate: t => {
|
|
1449
|
+
// Confetti falls, arms up, bouncing.
|
|
1450
|
+
const c = t % 12;
|
|
1451
|
+
const e = [];
|
|
1452
|
+
const cols = [0, 15, 2, 13, 5, 10, 1, 14];
|
|
1453
|
+
const tint = ["p", "l", "a", "p", "l", "p", "a", "l"];
|
|
1454
|
+
cols.forEach((x, i) => e.push([x, (c * 2 + i * 5) % 13, tint[i]]));
|
|
1455
|
+
const up = c % 4 < 2;
|
|
1456
|
+
e.push([2, 5, "g"], [1, 4, "g"], [13, 5, "g"], [14, 4, "g"]);
|
|
1457
|
+
return {
|
|
1458
|
+
...BASE,
|
|
1459
|
+
y0: up ? 3 : 4,
|
|
1460
|
+
eyes: "happy",
|
|
1461
|
+
legs: up ? [1, 1, 1] : [0, 0, 0],
|
|
1462
|
+
extras: e
|
|
1463
|
+
};
|
|
1464
|
+
},
|
|
1465
|
+
thumbsup: t => {
|
|
1466
|
+
// A fist rises with the thumb out; then a wink.
|
|
1467
|
+
const c = t % 12;
|
|
1468
|
+
const lift = c < 4 ? 2 : 0;
|
|
1469
|
+
const e = [];
|
|
1470
|
+
rect(13, 6 + lift, 14, 7 + lift, "g", e);
|
|
1471
|
+
e.push([14, 4 + lift, "g"], [14, 5 + lift, "g"]);
|
|
1472
|
+
const wink = c >= 6 && c < 10;
|
|
1473
|
+
if (wink) e.push([5, 6, "g"], [6, 6, "g"]);
|
|
1474
|
+
return {
|
|
1475
|
+
...BASE,
|
|
1476
|
+
eyes: c >= 4 && !wink ? "happy" : "open",
|
|
1477
|
+
extras: e
|
|
1478
|
+
};
|
|
1479
|
+
},
|
|
1480
|
+
party: t => {
|
|
1481
|
+
// Party hat in place of the lamp, confetti, a side-to-side dance.
|
|
1482
|
+
const c = t % 16;
|
|
1483
|
+
const e = [];
|
|
1484
|
+
e.push([7, 0, "a"], [8, 0, "a"]);
|
|
1485
|
+
rect(6, 1, 9, 1, "p", e);
|
|
1486
|
+
rect(5, 2, 10, 2, "a", e);
|
|
1487
|
+
rect(4, 3, 11, 3, "p", e);
|
|
1488
|
+
[0, 15, 2, 13].forEach((x, i) => e.push([x, (c * 2 + i * 4) % 12, i % 2 ? "l" : "p"]));
|
|
1489
|
+
const u = Math.floor(c / 2) % 2;
|
|
1490
|
+
e.push([1, 5 + u, "g"], [2, 6 - u, "g"], [13, 6 - u, "g"], [14, 5 + u, "g"]);
|
|
1491
|
+
return {
|
|
1492
|
+
...BASE,
|
|
1493
|
+
lamp: null,
|
|
1494
|
+
eyes: "happy",
|
|
1495
|
+
dx: [0, 1, 0, -1][Math.floor(c / 2) % 4],
|
|
1496
|
+
legs: walk(Math.floor(c / 2)),
|
|
1497
|
+
extras: e
|
|
1498
|
+
};
|
|
1499
|
+
},
|
|
1500
|
+
trophy: t => {
|
|
1501
|
+
// A cup held overhead, arms raised, sparkles, a hop every so often.
|
|
1502
|
+
const c = t % 16;
|
|
1503
|
+
const e = [];
|
|
1504
|
+
rect(5, 0, 10, 0, "a", e);
|
|
1505
|
+
rect(6, 1, 9, 1, "a", e);
|
|
1506
|
+
rect(7, 2, 8, 2, "A", e);
|
|
1507
|
+
rect(6, 3, 9, 3, "A", e);
|
|
1508
|
+
e.push([2, 5, "g"], [1, 4, "g"], [13, 5, "g"], [14, 4, "g"]);
|
|
1509
|
+
if (c % 2) e.push([3, 0, "l"], [12, 1, "l"]);else e.push([4, 1, "l"], [11, 0, "l"]);
|
|
1510
|
+
const hop = c === 8 || c === 9 ? 1 : 0;
|
|
1511
|
+
return {
|
|
1512
|
+
...BASE,
|
|
1513
|
+
y0: 4 - hop,
|
|
1514
|
+
lamp: null,
|
|
1515
|
+
eyes: "happy",
|
|
1516
|
+
legs: hop ? [1, 1, 1] : [0, 0, 0],
|
|
1517
|
+
extras: e
|
|
1518
|
+
};
|
|
1519
|
+
},
|
|
1520
|
+
starred: t => {
|
|
1521
|
+
// A star pops in at the top right and twinkles.
|
|
1522
|
+
const c = t % 12;
|
|
1523
|
+
const e = [];
|
|
1524
|
+
if (c >= 1) {
|
|
1525
|
+
e.push([13, 0, "a"]);
|
|
1526
|
+
rect(11, 1, 15, 1, "a", e);
|
|
1527
|
+
rect(12, 2, 14, 2, "a", e);
|
|
1528
|
+
e.push([12, 3, "a"], [14, 3, "a"], [11, 4, "a"], [15, 4, "a"]);
|
|
1529
|
+
if (c % 3 === 0) e.push([13, 2, "l"]);
|
|
1530
|
+
}
|
|
1531
|
+
return {
|
|
1532
|
+
...BASE,
|
|
1533
|
+
ex: 1,
|
|
1534
|
+
ey: -1,
|
|
1535
|
+
eyes: c >= 4 ? "happy" : "open",
|
|
1536
|
+
extras: e
|
|
1537
|
+
};
|
|
1538
|
+
},
|
|
1539
|
+
love: t => {
|
|
1540
|
+
// Hearts float up either side; the body bobs.
|
|
1541
|
+
const c = t % 16;
|
|
1542
|
+
const e = [];
|
|
1543
|
+
const heart = (x, y) => {
|
|
1544
|
+
if (y < -2) return;
|
|
1545
|
+
e.push([x, y, "r"], [x + 2, y, "r"], [x, y + 1, "r"], [x + 1, y + 1, "r"], [x + 2, y + 1, "r"], [x + 1, y + 2, "r"]);
|
|
1546
|
+
};
|
|
1547
|
+
heart(0, 8 - Math.floor(c / 2) * 2);
|
|
1548
|
+
heart(13, 8 - Math.floor((c + 8) % 16 / 2) * 2);
|
|
1549
|
+
return {
|
|
1550
|
+
...BASE,
|
|
1551
|
+
y0: 4 + Math.floor(c / 4) % 2,
|
|
1552
|
+
eyes: "happy",
|
|
1553
|
+
extras: e
|
|
1554
|
+
};
|
|
1555
|
+
},
|
|
1556
|
+
wave: t => {
|
|
1557
|
+
// One arm up, hand swinging side to side; a smile at the end.
|
|
1558
|
+
const c = t % 12;
|
|
1559
|
+
const e = [[13, 5, "g"], [14, 4, "g"], [c % 2 ? 15 : 14, 3, "g"]];
|
|
1560
|
+
return {
|
|
1561
|
+
...BASE,
|
|
1562
|
+
eyes: c >= 8 ? "happy" : "open",
|
|
1563
|
+
extras: e
|
|
1564
|
+
};
|
|
1565
|
+
},
|
|
1566
|
+
bow: t => {
|
|
1567
|
+
// A slow bow: squash forward, eyes shut, back up.
|
|
1568
|
+
const c = t % 16;
|
|
1569
|
+
const down = c >= 4 && c < 12;
|
|
1570
|
+
return down ? {
|
|
1571
|
+
...BASE,
|
|
1572
|
+
y0: 6,
|
|
1573
|
+
h: 5,
|
|
1574
|
+
eyes: "closed"
|
|
1575
|
+
} : {
|
|
1576
|
+
...BASE
|
|
1577
|
+
};
|
|
1578
|
+
},
|
|
1579
|
+
cool: t => {
|
|
1580
|
+
// Sunglasses drop into place; a little sway.
|
|
1581
|
+
const c = t % 16;
|
|
1582
|
+
const y = Math.min(6, 3 + c);
|
|
1583
|
+
const e = [];
|
|
1584
|
+
rect(4, y, 6, y + 1, "k", e);
|
|
1585
|
+
rect(9, y, 11, y + 1, "k", e);
|
|
1586
|
+
e.push([7, y, "k"], [8, y, "k"]);
|
|
1587
|
+
const on = y === 6;
|
|
1588
|
+
return {
|
|
1589
|
+
...BASE,
|
|
1590
|
+
dx: on ? [0, 0, 1, 0, 0, -1][Math.floor(c / 2) % 6] : 0,
|
|
1591
|
+
extras: e
|
|
1592
|
+
};
|
|
1593
|
+
},
|
|
1594
|
+
flexing: t => {
|
|
1595
|
+
// Both arms up in a flex; the biceps pop every other beat.
|
|
1596
|
+
const c = t % 8;
|
|
1597
|
+
const e = [[2, 6, "g"], [1, 6, "g"], [1, 5, "g"], [1, 4, "g"], [13, 6, "g"], [14, 6, "g"], [14, 5, "g"], [14, 4, "g"]];
|
|
1598
|
+
if (c < 4) e.push([0, 5, "g"], [15, 5, "g"]);
|
|
1599
|
+
return {
|
|
1600
|
+
...BASE,
|
|
1601
|
+
eyes: c < 4 ? "open" : "happy",
|
|
1602
|
+
extras: e
|
|
1603
|
+
};
|
|
1604
|
+
},
|
|
1605
|
+
zen: t => {
|
|
1606
|
+
// Floating above the water, eyes shut, slow bob, a sparkle or two.
|
|
1607
|
+
const c = t % 16;
|
|
1608
|
+
const e = c < 8 ? [[1, 5, "l"], [14, 9, "l"]] : [[2, 10, "l"], [13, 4, "l"]];
|
|
1609
|
+
return {
|
|
1610
|
+
...BASE,
|
|
1611
|
+
y0: 3 + Math.floor(c / 8) % 2,
|
|
1612
|
+
lamp: "a",
|
|
1613
|
+
eyes: "closed",
|
|
1614
|
+
legs: null,
|
|
1615
|
+
extras: e
|
|
1616
|
+
};
|
|
1617
|
+
},
|
|
1618
|
+
// ── Tool moments ────────────────────────────────────────────────────────
|
|
1619
|
+
recording: t => {
|
|
1620
|
+
// A red REC dot blinks at the top right; eyes slowly sweep the room.
|
|
1621
|
+
const c = t % 16;
|
|
1622
|
+
const e = c % 4 < 2 ? [...rect(13, 0, 14, 1, "r", [])] : [];
|
|
1623
|
+
return {
|
|
1624
|
+
...BASE,
|
|
1625
|
+
ex: [-1, -1, 0, 0, 1, 1, 0, 0][Math.floor(c / 2)],
|
|
1626
|
+
extras: e
|
|
1627
|
+
};
|
|
1628
|
+
},
|
|
1629
|
+
paused: t => {
|
|
1630
|
+
// Pause bars overhead; resting with the lamp dim, one peek.
|
|
1631
|
+
const c = t % 16;
|
|
1632
|
+
const e = [];
|
|
1633
|
+
rect(13, 0, 13, 3, "n", e);
|
|
1634
|
+
rect(15, 0, 15, 3, "n", e);
|
|
1635
|
+
const peek = c >= 8 && c < 10;
|
|
1636
|
+
return {
|
|
1637
|
+
...BASE,
|
|
1638
|
+
y0: 5,
|
|
1639
|
+
lamp: "A",
|
|
1640
|
+
eyes: peek ? "open" : "closed",
|
|
1641
|
+
ex: 1,
|
|
1642
|
+
ey: peek ? -1 : 0,
|
|
1643
|
+
extras: e
|
|
1644
|
+
};
|
|
1645
|
+
},
|
|
1646
|
+
filtering: t => {
|
|
1647
|
+
// A funnel on the right: mixed bits go in the top, only orange comes out.
|
|
1648
|
+
const c = t % 12;
|
|
1649
|
+
const e = [];
|
|
1650
|
+
rect(12, 0, 15, 0, "n", e);
|
|
1651
|
+
e.push([12, 1, "n"], [15, 1, "n"], [13, 2, "n"], [14, 2, "n"], [14, 3, "n"], [14, 4, "n"]);
|
|
1652
|
+
const mix = ["p", "l", "a", "l", "p", "a"];
|
|
1653
|
+
e.push([13, 1, mix[c % 6]], [14, 1, mix[(c + 3) % 6]]);
|
|
1654
|
+
e.push([14, 5 + c % 4, "a"]);
|
|
1655
|
+
return {
|
|
1656
|
+
...BASE,
|
|
1657
|
+
ex: 1,
|
|
1658
|
+
ey: c % 8 < 4 ? -1 : 1,
|
|
1659
|
+
extras: e
|
|
1660
|
+
};
|
|
1661
|
+
},
|
|
1662
|
+
pinned: t => {
|
|
1663
|
+
// A pushpin drops in from above and lands with a blink.
|
|
1664
|
+
const c = t % 12;
|
|
1665
|
+
const dy = c < 3 ? c - 3 : 0;
|
|
1666
|
+
const e = [];
|
|
1667
|
+
rect(13, 1 + dy, 14, 2 + dy, "r", e);
|
|
1668
|
+
e.push([13, 3 + dy, "n"], [14, 3 + dy, "n"], [13, 4 + dy, "n"], [13, 5 + dy, "n"]);
|
|
1669
|
+
if (c === 4 || c === 5) e.push([15, 0, "l"], [12, 6, "l"]);
|
|
1670
|
+
return {
|
|
1671
|
+
...BASE,
|
|
1672
|
+
ex: 1,
|
|
1673
|
+
ey: -1,
|
|
1674
|
+
eyes: c === 3 ? "closed" : "open",
|
|
1675
|
+
extras: e
|
|
1676
|
+
};
|
|
1677
|
+
},
|
|
1678
|
+
rewind: t => {
|
|
1679
|
+
// Moonwalks left while a clock runs backwards beside it.
|
|
1680
|
+
const c = t % 16;
|
|
1681
|
+
const e = [];
|
|
1682
|
+
e.push([1, 0, "n"], [2, 0, "n"], [0, 1, "n"], [3, 1, "n"], [0, 2, "n"], [3, 2, "n"], [1, 3, "n"], [2, 3, "n"]);
|
|
1683
|
+
rect(1, 1, 2, 2, "l", e);
|
|
1684
|
+
e.push(pt([[1, 1], [1, 2], [2, 2], [2, 1]][c % 4], "k"));
|
|
1685
|
+
return {
|
|
1686
|
+
...BASE,
|
|
1687
|
+
dx: 3 - Math.floor(c / 2),
|
|
1688
|
+
ex: 1,
|
|
1689
|
+
legs: walk(t),
|
|
1690
|
+
extras: e
|
|
1691
|
+
};
|
|
1692
|
+
},
|
|
1693
|
+
storing: t => {
|
|
1694
|
+
// Crates stack up on the right, one lowered into place every six ticks.
|
|
1695
|
+
const c = t % 24;
|
|
1696
|
+
const e = [];
|
|
1697
|
+
const placed = Math.floor(c / 6);
|
|
1698
|
+
for (let i = 0; i < Math.min(3, placed); i++) {
|
|
1699
|
+
const y = 11 - i * 2;
|
|
1700
|
+
rect(13, y, 14, y + 1, "A", e);
|
|
1701
|
+
e.push([13, y, "a"]);
|
|
1702
|
+
}
|
|
1703
|
+
if (placed < 3) {
|
|
1704
|
+
const y = 4 + (c % 6 < 3 ? 0 : 1);
|
|
1705
|
+
rect(13, y, 14, y + 1, "A", e);
|
|
1706
|
+
e.push([13, y, "a"], [13, y + 2, "g"], [14, y + 2, "g"]);
|
|
1707
|
+
}
|
|
1708
|
+
return {
|
|
1709
|
+
...BASE,
|
|
1710
|
+
ex: 1,
|
|
1711
|
+
ey: placed < 3 ? 0 : 1,
|
|
1712
|
+
eyes: placed === 3 && c % 6 === 5 ? "happy" : "open",
|
|
1713
|
+
extras: e
|
|
1714
|
+
};
|
|
1715
|
+
},
|
|
1716
|
+
printing: t => {
|
|
1717
|
+
// A little printer spools out a strip of log lines.
|
|
1718
|
+
const c = t % 16;
|
|
1719
|
+
const e = [];
|
|
1720
|
+
rect(13, 3, 15, 5, "n", e);
|
|
1721
|
+
e.push([14, 4, "1"]);
|
|
1722
|
+
const len = Math.min(6, c);
|
|
1723
|
+
if (len > 0) {
|
|
1724
|
+
rect(13, 6, 15, 5 + len, "l", e);
|
|
1725
|
+
for (let y = 6; y <= 5 + len; y += 2) e.push([14, y, "k"]);
|
|
1726
|
+
}
|
|
1727
|
+
return {
|
|
1728
|
+
...BASE,
|
|
1729
|
+
ex: 1,
|
|
1730
|
+
ey: 1,
|
|
1731
|
+
extras: e
|
|
1732
|
+
};
|
|
1733
|
+
},
|
|
1734
|
+
stopwatch: t => {
|
|
1735
|
+
// A stopwatch with a fast hand; speed lines off the far side.
|
|
1736
|
+
const e = [];
|
|
1737
|
+
e.push([13, 0, "n"], [13, 1, "n"], [14, 1, "n"], [12, 2, "n"], [15, 2, "n"], [12, 3, "n"], [15, 3, "n"], [13, 4, "n"], [14, 4, "n"]);
|
|
1738
|
+
rect(13, 2, 14, 3, "l", e);
|
|
1739
|
+
e.push(pt([[14, 2], [14, 3], [13, 3], [13, 2]][t % 4], "k"));
|
|
1740
|
+
if (t % 2) e.push([0, 6, "n"], [1, 6, "n"], [0, 9, "n"]);else e.push([0, 7, "n"], [1, 8, "n"], [0, 8, "n"]);
|
|
1741
|
+
return {
|
|
1742
|
+
...BASE,
|
|
1743
|
+
eyes: "big",
|
|
1744
|
+
ex: 1,
|
|
1745
|
+
ey: -1,
|
|
1746
|
+
extras: e
|
|
1747
|
+
};
|
|
1748
|
+
},
|
|
1749
|
+
spotlight: t => {
|
|
1750
|
+
// The lamp throws a beam that sweeps left, up, right.
|
|
1751
|
+
const c = t % 12;
|
|
1752
|
+
const e = [];
|
|
1753
|
+
if (c < 4) {
|
|
1754
|
+
rect(4, 1, 7, 1, "a", e);
|
|
1755
|
+
rect(2, 0, 6, 0, "a", e);
|
|
1756
|
+
} else if (c < 8) {
|
|
1757
|
+
rect(6, 1, 9, 1, "a", e);
|
|
1758
|
+
rect(5, 0, 10, 0, "a", e);
|
|
1759
|
+
} else {
|
|
1760
|
+
rect(8, 1, 11, 1, "a", e);
|
|
1761
|
+
rect(9, 0, 13, 0, "a", e);
|
|
1762
|
+
}
|
|
1763
|
+
return {
|
|
1764
|
+
...BASE,
|
|
1765
|
+
ex: c < 4 ? -1 : c < 8 ? 0 : 1,
|
|
1766
|
+
ey: -1,
|
|
1767
|
+
extras: e
|
|
1768
|
+
};
|
|
1769
|
+
},
|
|
1770
|
+
keys: t => {
|
|
1771
|
+
// A keyring held out; the keys jingle.
|
|
1772
|
+
const c = t % 8;
|
|
1773
|
+
const e = [[13, 5, "g"], [14, 5, "g"]];
|
|
1774
|
+
e.push([13, 6, "n"], [14, 6, "n"], [15, 6, "n"], [13, 7, "n"], [15, 7, "n"], [13, 8, "n"], [14, 8, "n"], [15, 8, "n"]);
|
|
1775
|
+
const k2 = c < 4 ? 15 : 14;
|
|
1776
|
+
e.push([13, 9, "a"], [13, 10, "a"], [k2, 9, "a"], [k2, 10, "a"]);
|
|
1777
|
+
return {
|
|
1778
|
+
...BASE,
|
|
1779
|
+
ex: 1,
|
|
1780
|
+
ey: 1,
|
|
1781
|
+
eyes: c === 7 ? "closed" : "open",
|
|
1782
|
+
extras: e
|
|
1783
|
+
};
|
|
1784
|
+
},
|
|
1785
|
+
map: t => {
|
|
1786
|
+
// A folded map held up: dotted route, red pin; looks around for the way.
|
|
1787
|
+
const c = t % 16;
|
|
1788
|
+
const e = [];
|
|
1789
|
+
rect(3, 8, 12, 11, "l", e);
|
|
1790
|
+
e.push([4, 10, "m"], [5, 9, "m"], [6, 9, "m"], [7, 10, "m"], [8, 10, "m"], [9, 9, "m"], [10, 9, "m"]);
|
|
1791
|
+
e.push([11, 8, "r"], [11, 9, "r"]);
|
|
1792
|
+
e.push([2, 9, "g"], [13, 9, "g"]);
|
|
1793
|
+
const look = c >= 8;
|
|
1794
|
+
return {
|
|
1795
|
+
...BASE,
|
|
1796
|
+
ex: look ? c < 12 ? -1 : 1 : 0,
|
|
1797
|
+
ey: look ? -1 : 1,
|
|
1798
|
+
legs: null,
|
|
1799
|
+
extras: e
|
|
1800
|
+
};
|
|
1801
|
+
},
|
|
1802
|
+
photo: t => {
|
|
1803
|
+
// A camera held up; flash; a print pops out the side.
|
|
1804
|
+
const c = t % 16;
|
|
1805
|
+
const e = [];
|
|
1806
|
+
rect(5, 8, 10, 10, "n", e);
|
|
1807
|
+
rect(7, 9, 8, 9, "k", e);
|
|
1808
|
+
e.push([7, 9, "l"], [10, 8, "1"]);
|
|
1809
|
+
e.push([2, 9, "g"], [13, 9, "g"]);
|
|
1810
|
+
if (c === 6) {
|
|
1811
|
+
rect(0, 0, 15, 1, "l", e);
|
|
1812
|
+
e.push([3, 2, "l"], [12, 2, "l"]);
|
|
1813
|
+
}
|
|
1814
|
+
if (c >= 8) {
|
|
1815
|
+
rect(13, 6, 15, 8, "n", e);
|
|
1816
|
+
e.push([14, 7, "g"]);
|
|
1817
|
+
}
|
|
1818
|
+
return {
|
|
1819
|
+
...BASE,
|
|
1820
|
+
lamp: c === 6 ? "a" : "A",
|
|
1821
|
+
eyes: c === 6 ? "closed" : "open",
|
|
1822
|
+
legs: null,
|
|
1823
|
+
extras: e
|
|
1824
|
+
};
|
|
1825
|
+
},
|
|
1826
|
+
painting: t => {
|
|
1827
|
+
// A canvas on the right; strokes appear as the brush works.
|
|
1828
|
+
const c = t % 16;
|
|
1829
|
+
const e = [];
|
|
1830
|
+
rect(13, 2, 15, 7, "l", e);
|
|
1831
|
+
if (c >= 2) e.push([13, 3, "p"], [14, 3, "p"]);
|
|
1832
|
+
if (c >= 6) e.push([14, 5, "a"], [15, 5, "a"]);
|
|
1833
|
+
if (c >= 10) e.push([13, 6, "r"]);
|
|
1834
|
+
e.push([13, 8, "g"], [14, 8, "g"], [15, 8 - c % 2, "m"]);
|
|
1835
|
+
return {
|
|
1836
|
+
...BASE,
|
|
1837
|
+
ex: 1,
|
|
1838
|
+
ey: c % 8 < 4 ? -1 : 0,
|
|
1839
|
+
extras: e
|
|
1840
|
+
};
|
|
1841
|
+
},
|
|
1842
|
+
disguise: t => {
|
|
1843
|
+
// Groucho glasses, nose and moustache; sly glances.
|
|
1844
|
+
const e = [];
|
|
1845
|
+
for (const x of [4, 8]) {
|
|
1846
|
+
rect(x, 5, x + 3, 5, "n", e);
|
|
1847
|
+
rect(x, 8, x + 3, 8, "n", e);
|
|
1848
|
+
e.push([x, 6, "n"], [x, 7, "n"], [x + 3, 6, "n"], [x + 3, 7, "n"]);
|
|
1849
|
+
}
|
|
1850
|
+
e.push([7, 8, "a"], [8, 8, "a"]);
|
|
1851
|
+
rect(5, 9, 10, 9, "k", e);
|
|
1852
|
+
e.push([5, 10, "k"], [10, 10, "k"]);
|
|
1853
|
+
return {
|
|
1854
|
+
...BASE,
|
|
1855
|
+
ex: [-1, -1, -1, 0, 1, 1, 1, 0][Math.floor(t / 3) % 8],
|
|
1856
|
+
extras: e
|
|
1857
|
+
};
|
|
1858
|
+
},
|
|
1859
|
+
pro: t => {
|
|
1860
|
+
// A crown in place of the lamp, jewels, sparkles.
|
|
1861
|
+
const c = t % 12;
|
|
1862
|
+
const e = [];
|
|
1863
|
+
rect(5, 2, 10, 3, "a", e);
|
|
1864
|
+
e.push([5, 1, "a"], [7, 1, "a"], [8, 1, "a"], [10, 1, "a"], [6, 2, "p"], [9, 2, "p"]);
|
|
1865
|
+
e.push(c % 2 ? [3, 1, "l"] : [12, 0, "l"]);
|
|
1866
|
+
return {
|
|
1867
|
+
...BASE,
|
|
1868
|
+
lamp: null,
|
|
1869
|
+
eyes: c >= 6 ? "happy" : "open",
|
|
1870
|
+
extras: e
|
|
1871
|
+
};
|
|
1872
|
+
},
|
|
1873
|
+
talking: t => {
|
|
1874
|
+
// A speech bubble with typing dots; the lamp pulses as it speaks.
|
|
1875
|
+
const c = t % 12;
|
|
1876
|
+
const e = [];
|
|
1877
|
+
rect(9, 0, 15, 2, "l", e);
|
|
1878
|
+
e.push([10, 3, "l"]);
|
|
1879
|
+
[10, 12, 14].forEach((x, i) => e.push([x, 1, (c + i) % 3 === 0 ? "k" : "m"]));
|
|
1880
|
+
return {
|
|
1881
|
+
...BASE,
|
|
1882
|
+
ex: 1,
|
|
1883
|
+
ey: -1,
|
|
1884
|
+
lamp: c % 4 < 2 ? "a" : "A",
|
|
1885
|
+
extras: e
|
|
1886
|
+
};
|
|
1887
|
+
},
|
|
1888
|
+
handshake: t => {
|
|
1889
|
+
// A hand arrives from the right; Otto meets it; they shake.
|
|
1890
|
+
const c = t % 16;
|
|
1891
|
+
const hx = 16 - Math.min(2, c);
|
|
1892
|
+
const dy = c >= 4 && c < 12 ? Math.floor(c / 2) % 2 : 0;
|
|
1893
|
+
const e = [];
|
|
1894
|
+
rect(hx, 6 + dy, hx + 1, 7 + dy, "n", e);
|
|
1895
|
+
if (c >= 2) e.push([13, 7 + dy, "g"]);
|
|
1896
|
+
return {
|
|
1897
|
+
...BASE,
|
|
1898
|
+
ex: 1,
|
|
1899
|
+
eyes: c >= 4 ? "happy" : "open",
|
|
1900
|
+
extras: e
|
|
1901
|
+
};
|
|
1902
|
+
},
|
|
1903
|
+
robot: t => {
|
|
1904
|
+
// A small robot friend on the right: antenna blinking, eyes flickering.
|
|
1905
|
+
const c = t % 16;
|
|
1906
|
+
const e = [];
|
|
1907
|
+
e.push([14, 3, c % 4 < 2 ? "r" : "n"], [14, 4, "n"]);
|
|
1908
|
+
rect(13, 5, 15, 7, "n", e);
|
|
1909
|
+
const eye = c % 8 < 2 ? "r" : "k";
|
|
1910
|
+
e.push([13, 6, eye], [15, 6, eye]);
|
|
1911
|
+
rect(13, 8, 15, 10, "m", e);
|
|
1912
|
+
e.push([14, 9, "l"], [13, 11, "n"], [15, 11, "n"]);
|
|
1913
|
+
return {
|
|
1914
|
+
...BASE,
|
|
1915
|
+
ex: 1,
|
|
1916
|
+
ey: 1,
|
|
1917
|
+
eyes: c >= 8 && c < 12 ? "happy" : "open",
|
|
1918
|
+
extras: e
|
|
1919
|
+
};
|
|
1920
|
+
},
|
|
1921
|
+
plug: t => {
|
|
1922
|
+
// A plug slides in from the right and connects; the lamp comes on.
|
|
1923
|
+
const c = t % 16;
|
|
1924
|
+
const px = 16 - Math.min(3, c);
|
|
1925
|
+
const e = [];
|
|
1926
|
+
rect(px, 6, px + 1, 7, "n", e);
|
|
1927
|
+
e.push([px - 1, 6, "l"], [px - 1, 7, "l"], [px + 2, 7, "n"], [px + 3, 7, "n"]);
|
|
1928
|
+
if (c >= 4 && c < 7) e.push(c % 2 ? [11, 2, "l"] : [15, 4, "l"]);
|
|
1929
|
+
return {
|
|
1930
|
+
...BASE,
|
|
1931
|
+
lamp: c >= 3 ? "a" : "A",
|
|
1932
|
+
ex: 1,
|
|
1933
|
+
eyes: c >= 5 ? "happy" : "open",
|
|
1934
|
+
extras: e
|
|
1935
|
+
};
|
|
1936
|
+
},
|
|
1937
|
+
gift: t => {
|
|
1938
|
+
// A wrapped gift bounces; the lid lifts with a sparkle.
|
|
1939
|
+
const c = t % 16;
|
|
1940
|
+
const open = c >= 12;
|
|
1941
|
+
const dy = !open && c % 4 === 2 ? -1 : 0;
|
|
1942
|
+
const e = [];
|
|
1943
|
+
rect(13, 7 + dy, 15, 10 + dy, "p", e);
|
|
1944
|
+
rect(14, 7 + dy, 14, 10 + dy, "a", e);
|
|
1945
|
+
const by = open ? 4 : 6 + dy;
|
|
1946
|
+
rect(13, by, 15, by, "a", e);
|
|
1947
|
+
if (open) e.push([14, 3, "l"], [12, 5, "l"]);
|
|
1948
|
+
return {
|
|
1949
|
+
...BASE,
|
|
1950
|
+
ex: 1,
|
|
1951
|
+
ey: 1,
|
|
1952
|
+
eyes: open ? "happy" : "big",
|
|
1953
|
+
extras: e
|
|
1954
|
+
};
|
|
1955
|
+
},
|
|
1956
|
+
action: t => {
|
|
1957
|
+
// A clapperboard on the right claps shut.
|
|
1958
|
+
const c = t % 16;
|
|
1959
|
+
const closed = c === 4 || c === 5;
|
|
1960
|
+
const e = [];
|
|
1961
|
+
rect(13, 4, 15, 7, "n", e);
|
|
1962
|
+
e.push([14, 5, "k"], [14, 6, "k"]);
|
|
1963
|
+
const by = closed ? 3 : 2;
|
|
1964
|
+
e.push([13, by, "l"], [14, by, "k"], [15, by, "l"]);
|
|
1965
|
+
if (c === 4) e.push([12, 2, "l"]);
|
|
1966
|
+
return {
|
|
1967
|
+
...BASE,
|
|
1968
|
+
ex: 1,
|
|
1969
|
+
ey: -1,
|
|
1970
|
+
eyes: c === 4 ? "closed" : "open",
|
|
1971
|
+
extras: e
|
|
1972
|
+
};
|
|
1973
|
+
},
|
|
1974
|
+
guard: t => {
|
|
1975
|
+
// A shield up; a red bolt comes in, sparks off it and bounces away.
|
|
1976
|
+
const c = t % 16;
|
|
1977
|
+
const e = [];
|
|
1978
|
+
rect(13, 5, 15, 7, "n", e);
|
|
1979
|
+
e.push([14, 8, "n"], [14, 6, "g"]);
|
|
1980
|
+
if (c % 6 === 0) e.push([13, 5, "l"]);
|
|
1981
|
+
if (c >= 2 && c < 6) e.push([15, c - 2, "r"]);
|
|
1982
|
+
if (c === 6) e.push([15, 4, "l"], [14, 4, "l"]);
|
|
1983
|
+
if (c >= 7 && c < 10) e.push([15, 9 - c, "R"]);
|
|
1984
|
+
return {
|
|
1985
|
+
...BASE,
|
|
1986
|
+
ex: 1,
|
|
1987
|
+
ey: -1,
|
|
1988
|
+
eyes: c === 5 || c === 6 ? "big" : "open",
|
|
1989
|
+
extras: e
|
|
1990
|
+
};
|
|
1991
|
+
},
|
|
1992
|
+
coffee: t => {
|
|
1993
|
+
// A mug with steam; lifts it for a sip, eyes shut, then content.
|
|
1994
|
+
const c = t % 16;
|
|
1995
|
+
const sip = c >= 8 && c < 12;
|
|
1996
|
+
const dy = sip ? -2 : 0;
|
|
1997
|
+
const e = [];
|
|
1998
|
+
rect(13, 6 + dy, 14, 8 + dy, "l", e);
|
|
1999
|
+
e.push([15, 7 + dy, "n"], [13, 6 + dy, "A"], [14, 6 + dy, "A"], [13, 9 + dy, "g"], [14, 9 + dy, "g"]);
|
|
2000
|
+
if (!sip) e.push(...(c % 2 ? [[13, 4, "n"], [14, 3, "n"]] : [[14, 4, "n"], [13, 3, "n"]]));
|
|
2001
|
+
return {
|
|
2002
|
+
...BASE,
|
|
2003
|
+
ex: sip ? 0 : 1,
|
|
2004
|
+
ey: sip ? 0 : 1,
|
|
2005
|
+
eyes: sip ? "closed" : c >= 12 && c < 14 ? "happy" : "open",
|
|
2006
|
+
extras: e
|
|
2007
|
+
};
|
|
2008
|
+
},
|
|
2009
|
+
swimming: t => {
|
|
2010
|
+
// In the water to the shoulders, alternating strokes with splashes.
|
|
2011
|
+
const c = t % 8;
|
|
2012
|
+
const left = c < 4;
|
|
2013
|
+
const e = left ? [[1, 8, "g"], [2, 9, "g"], [0, 12, "l"], [13, 11, "g"], [14, 12, "g"]] : [[14, 8, "g"], [13, 9, "g"], [15, 12, "l"], [2, 11, "g"], [1, 12, "g"]];
|
|
2014
|
+
return {
|
|
2015
|
+
...BASE,
|
|
2016
|
+
submerged: true,
|
|
2017
|
+
y0: 8,
|
|
2018
|
+
ex: left ? -1 : 1,
|
|
2019
|
+
legs: null,
|
|
2020
|
+
extras: e
|
|
2021
|
+
};
|
|
2022
|
+
},
|
|
2023
|
+
diving: t => {
|
|
2024
|
+
// Sinks out of sight, bubbles rise, then comes back up dripping.
|
|
2025
|
+
const c = t % 24;
|
|
2026
|
+
const e = [];
|
|
2027
|
+
let y0 = 4;
|
|
2028
|
+
if (c >= 4 && c < 10) y0 = 4 + (c - 3) * 2;else if (c >= 10 && c < 16) y0 = 16;else if (c >= 16 && c < 20) y0 = 14 - (c - 15) * 2;
|
|
2029
|
+
if (c >= 8 && c < 16) e.push([7, 12 - c * 2 % 6, "l"], [9, 12 - (c * 2 + 3) % 6, "l"]);
|
|
2030
|
+
if (c === 20 || c === 21) e.push([3, 3, "l"], [12, 3, "l"]);
|
|
2031
|
+
return {
|
|
2032
|
+
...BASE,
|
|
2033
|
+
submerged: y0 > 4,
|
|
2034
|
+
y0,
|
|
2035
|
+
ey: c < 4 ? 1 : 0,
|
|
2036
|
+
eyes: c >= 20 && c < 23 ? "happy" : "open",
|
|
2037
|
+
legs: y0 > 4 ? null : [0, 0, 0],
|
|
2038
|
+
extras: e
|
|
2039
|
+
};
|
|
2040
|
+
},
|
|
2041
|
+
balloon: t => {
|
|
2042
|
+
// A balloon lifts Otto clear of the water; a splash when it lets go.
|
|
2043
|
+
const c = t % 24;
|
|
2044
|
+
const y0 = c < 8 ? 4 : c < 20 ? 4 - Math.min(3, Math.floor((c - 8) / 2)) : 4;
|
|
2045
|
+
const e = [];
|
|
2046
|
+
rect(13, 0, 15, 2, "r", e);
|
|
2047
|
+
e.push([14, 3, "R"]);
|
|
2048
|
+
rect(14, 4, 14, y0 + 2, "n", e);
|
|
2049
|
+
e.push([13, y0 + 2, "g"]);
|
|
2050
|
+
if (c === 20) e.push([2, 12, "l"], [12, 12, "l"]);
|
|
2051
|
+
const lifted = y0 < 4;
|
|
2052
|
+
return {
|
|
2053
|
+
...BASE,
|
|
2054
|
+
y0,
|
|
2055
|
+
ex: lifted ? 0 : 1,
|
|
2056
|
+
ey: lifted ? 0 : -1,
|
|
2057
|
+
eyes: lifted ? "happy" : "open",
|
|
2058
|
+
legs: lifted ? c % 2 ? [1, 0, 1] : [0, 1, 0] : [0, 0, 0],
|
|
2059
|
+
extras: e
|
|
2060
|
+
};
|
|
2061
|
+
},
|
|
2062
|
+
landing: t => {
|
|
2063
|
+
// Drops in from above, lands with a squash and a splash, settles.
|
|
2064
|
+
const c = t % 16;
|
|
2065
|
+
if (c < 4) return {
|
|
2066
|
+
...BASE,
|
|
2067
|
+
y0: -8 + c * 3,
|
|
2068
|
+
eyes: "big",
|
|
2069
|
+
legs: [1, 1, 1]
|
|
2070
|
+
};
|
|
2071
|
+
if (c === 4) return {
|
|
2072
|
+
...BASE,
|
|
2073
|
+
x0: 2,
|
|
2074
|
+
w: 12,
|
|
2075
|
+
y0: 6,
|
|
2076
|
+
h: 5,
|
|
2077
|
+
eyes: "closed",
|
|
2078
|
+
extras: [[1, 12, "l"], [14, 12, "l"], [0, 11, "l"], [15, 11, "l"]]
|
|
2079
|
+
};
|
|
2080
|
+
if (c === 5) return {
|
|
2081
|
+
...BASE,
|
|
2082
|
+
eyes: "closed"
|
|
2083
|
+
};
|
|
2084
|
+
return {
|
|
2085
|
+
...BASE,
|
|
2086
|
+
eyes: c >= 8 && c < 12 ? "happy" : "open"
|
|
2087
|
+
};
|
|
2088
|
+
},
|
|
2089
|
+
spinning: t => {
|
|
2090
|
+
// A full turn: front, three-quarter, side, back and round again.
|
|
2091
|
+
const c = t % 16;
|
|
2092
|
+
const ph = Math.floor(c / 2);
|
|
2093
|
+
const [w, ex] = [[10, 0], [8, 1], [6, 0], [4, 0], [6, 0], [8, -1], [10, 0], [10, 0]][ph];
|
|
2094
|
+
const x0 = 3 + (10 - w) / 2;
|
|
2095
|
+
const e = [];
|
|
2096
|
+
if (w <= 6) {
|
|
2097
|
+
const x1 = x0 + w - 1;
|
|
2098
|
+
e.push([x0 + 1, 11, "s"], [x0 + 1, 12, "s"], [x1 - 1, 11, "s"], [x1 - 1, 12, "s"]);
|
|
2099
|
+
}
|
|
2100
|
+
if (w === 4) rect(x0, 6, x0 + 3, 7, "g", e);
|
|
2101
|
+
return {
|
|
2102
|
+
...BASE,
|
|
2103
|
+
x0,
|
|
2104
|
+
w,
|
|
2105
|
+
ex,
|
|
2106
|
+
legs: w <= 6 ? null : [0, 0, 0],
|
|
2107
|
+
extras: e
|
|
2108
|
+
};
|
|
2109
|
+
},
|
|
2110
|
+
bubbles: t => {
|
|
2111
|
+
// Blows through a bubble wand; bubbles drift up and away.
|
|
2112
|
+
const c = t % 12;
|
|
2113
|
+
const blow = c < 4;
|
|
2114
|
+
const e = [[13, 6, "g"], [14, 6, "g"], [15, 6, "m"], [15, 5, "m"], [15, 4, "n"]];
|
|
2115
|
+
for (let i = 0; i < 3; i++) {
|
|
2116
|
+
const y = 3 - (c + i * 4) % 12;
|
|
2117
|
+
if (y >= 0) e.push([13 + i % 2, y, "l"]);
|
|
2118
|
+
}
|
|
2119
|
+
return {
|
|
2120
|
+
...BASE,
|
|
2121
|
+
ex: blow ? 1 : 1,
|
|
2122
|
+
ey: blow ? 0 : -1,
|
|
2123
|
+
eyes: blow ? "closed" : "open",
|
|
2124
|
+
extras: e
|
|
2125
|
+
};
|
|
2126
|
+
},
|
|
2127
|
+
trash: t => {
|
|
2128
|
+
// Bits fly into a bin, the lid flaps, a puff when it's done.
|
|
2129
|
+
const c = t % 16;
|
|
2130
|
+
const e = [];
|
|
2131
|
+
rect(13, 7, 15, 11, "n", e);
|
|
2132
|
+
rect(14, 8, 14, 10, "1", e);
|
|
2133
|
+
const open = c >= 2 && c < 10;
|
|
2134
|
+
rect(13, open ? 5 : 6, 15, open ? 5 : 6, "n", e);
|
|
2135
|
+
if (c >= 3 && c < 9) e.push([7 + (c - 3), 5 - c % 2, c % 2 ? "p" : "a"]);
|
|
2136
|
+
if (c === 9 || c === 10) e.push([14, 4, "l"], [13, 3, "l"], [15, 3, "l"]);
|
|
2137
|
+
return {
|
|
2138
|
+
...BASE,
|
|
2139
|
+
ex: 1,
|
|
2140
|
+
ey: -1,
|
|
2141
|
+
eyes: c >= 11 && c < 14 ? "happy" : "open",
|
|
2142
|
+
extras: e
|
|
2143
|
+
};
|
|
2144
|
+
},
|
|
2145
|
+
saved: t => {
|
|
2146
|
+
// A floppy disk pops in; a hop and a sparkle.
|
|
2147
|
+
const c = t % 12;
|
|
2148
|
+
const dy = c === 1 ? -1 : 0;
|
|
2149
|
+
const e = [];
|
|
2150
|
+
if (c >= 1) {
|
|
2151
|
+
rect(13, 2 + dy, 15, 5 + dy, "1", e);
|
|
2152
|
+
e.push([13, 2 + dy, "n"], [14, 2 + dy, "n"]);
|
|
2153
|
+
rect(13, 4 + dy, 15, 5 + dy, "l", e);
|
|
2154
|
+
}
|
|
2155
|
+
if (c === 3 || c === 4) e.push([12, 0, "l"], [15, 7, "l"]);
|
|
2156
|
+
const hop = c === 2 ? 1 : 0;
|
|
2157
|
+
return {
|
|
2158
|
+
...BASE,
|
|
2159
|
+
y0: 4 - hop,
|
|
2160
|
+
ex: 1,
|
|
2161
|
+
ey: -1,
|
|
2162
|
+
eyes: c >= 3 ? "happy" : "open",
|
|
2163
|
+
legs: hop ? [1, 1, 1] : [0, 0, 0],
|
|
2164
|
+
extras: e
|
|
2165
|
+
};
|
|
2166
|
+
},
|
|
2167
|
+
copied: t => {
|
|
2168
|
+
// One sheet slides out from behind another; a sparkle.
|
|
2169
|
+
const c = t % 12;
|
|
2170
|
+
const off = c < 2 ? 0 : 1;
|
|
2171
|
+
const e = [];
|
|
2172
|
+
rect(12, 1, 14, 3, "n", e);
|
|
2173
|
+
e.push([13, 2, "1"]);
|
|
2174
|
+
rect(12 + off, 2 + off, 14 + off, 4 + off, "l", e);
|
|
2175
|
+
e.push([13 + off, 3 + off, "m"]);
|
|
2176
|
+
if (c === 4 || c === 5) e.push([15, 0, "l"], [11, 6, "l"]);
|
|
2177
|
+
return {
|
|
2178
|
+
...BASE,
|
|
2179
|
+
ex: 1,
|
|
2180
|
+
ey: -1,
|
|
2181
|
+
eyes: c >= 4 ? "happy" : "open",
|
|
2182
|
+
extras: e
|
|
2183
|
+
};
|
|
2184
|
+
},
|
|
2185
|
+
charting: t => {
|
|
2186
|
+
// Three bars grow on the right; pleased when they land.
|
|
2187
|
+
const c = t % 16;
|
|
2188
|
+
const e = [];
|
|
2189
|
+
rect(13, 12, 15, 12, "n", e);
|
|
2190
|
+
[3, 5, 4].forEach((target, i) => {
|
|
2191
|
+
const h = Math.min(target, Math.floor(c / 2));
|
|
2192
|
+
if (h > 0) rect(13 + i, 12 - h, 13 + i, 11, "g", e);
|
|
2193
|
+
});
|
|
2194
|
+
return {
|
|
2195
|
+
...BASE,
|
|
2196
|
+
ex: 1,
|
|
2197
|
+
ey: c < 6 ? 1 : 0,
|
|
2198
|
+
eyes: c >= 12 ? "happy" : "open",
|
|
2199
|
+
extras: e
|
|
2200
|
+
};
|
|
2201
|
+
},
|
|
2202
|
+
// ── Pairing poses ───────────────────────────────────────────────────────
|
|
2203
|
+
// Built to hold something that is NOT in the grid — a tool's icon tile,
|
|
2204
|
+
// drawn by the scene at OTTO_ANCHORS[state](t). The right-hand prop zone is
|
|
2205
|
+
// kept clear on purpose.
|
|
2206
|
+
present: t => {
|
|
2207
|
+
// A flat hand held out; the object floats above the palm and bobs.
|
|
2208
|
+
const c = t % 16;
|
|
2209
|
+
const e = [[13, 7, "g"], [14, 7, "g"], [15, 7, "g"], [15, 6, "g"]];
|
|
2210
|
+
return {
|
|
2211
|
+
...BASE,
|
|
2212
|
+
ex: 1,
|
|
2213
|
+
ey: -1,
|
|
2214
|
+
eyes: c === 13 ? "closed" : c >= 8 && c < 12 ? "happy" : "open",
|
|
2215
|
+
extras: e
|
|
2216
|
+
};
|
|
2217
|
+
},
|
|
2218
|
+
lift: t => {
|
|
2219
|
+
// Both arms up; the object rides above the head; a hop every eight ticks.
|
|
2220
|
+
const c = t % 16;
|
|
2221
|
+
const hop = c % 8 === 2 || c % 8 === 3 ? 1 : 0;
|
|
2222
|
+
const e = [[2, 5 - hop, "g"], [1, 4 - hop, "g"], [1, 3 - hop, "g"], [13, 5 - hop, "g"], [14, 4 - hop, "g"], [14, 3 - hop, "g"]];
|
|
2223
|
+
return {
|
|
2224
|
+
...BASE,
|
|
2225
|
+
y0: 4 - hop,
|
|
2226
|
+
eyes: "happy",
|
|
2227
|
+
legs: hop ? [1, 1, 1] : [0, 0, 0],
|
|
2228
|
+
extras: e
|
|
2229
|
+
};
|
|
2230
|
+
},
|
|
2231
|
+
carry: t => {
|
|
2232
|
+
// Arms up, marching; the object rides overhead with the step.
|
|
2233
|
+
const b = Math.floor(t / 2) % 2;
|
|
2234
|
+
const e = [[2, 5 + b, "g"], [1, 4 + b, "g"], [1, 3 + b, "g"], [13, 5 + b, "g"], [14, 4 + b, "g"], [14, 3 + b, "g"]];
|
|
2235
|
+
return {
|
|
2236
|
+
...BASE,
|
|
2237
|
+
y0: 4 + b,
|
|
2238
|
+
ex: t % 16 < 8 ? 0 : 1,
|
|
2239
|
+
legs: walk(t),
|
|
2240
|
+
extras: e
|
|
2241
|
+
};
|
|
2242
|
+
},
|
|
2243
|
+
hug: t => {
|
|
2244
|
+
// Arms wrapped round the object held against the body; eyes peep over it.
|
|
2245
|
+
const c = t % 16;
|
|
2246
|
+
const b = Math.floor(c / 8) % 2;
|
|
2247
|
+
const e = [[1, 7 + b, "g"], [2, 8 + b, "g"], [14, 7 + b, "g"], [13, 8 + b, "g"]];
|
|
2248
|
+
return {
|
|
2249
|
+
...BASE,
|
|
2250
|
+
y0: 4 + b,
|
|
2251
|
+
ey: -1,
|
|
2252
|
+
eyes: c >= 4 && c < 12 ? "happy" : "closed",
|
|
2253
|
+
extras: e
|
|
2254
|
+
};
|
|
2255
|
+
},
|
|
2256
|
+
lean: t => {
|
|
2257
|
+
// One arm resting on the object standing beside Otto; relaxed.
|
|
2258
|
+
const c = t % 24;
|
|
2259
|
+
const e = [[13, 5, "g"], [14, 5, "g"], [15, 5, "g"]];
|
|
2260
|
+
return {
|
|
2261
|
+
...BASE,
|
|
2262
|
+
ex: c < 16 ? 1 : 0,
|
|
2263
|
+
eyes: c >= 8 && c < 12 ? "closed" : "open",
|
|
2264
|
+
legs: [0, 1, 0],
|
|
2265
|
+
extras: e
|
|
2266
|
+
};
|
|
2267
|
+
},
|
|
2268
|
+
point: t => {
|
|
2269
|
+
// Arm up and out; the object hangs up-right, bobbing; a hop of delight.
|
|
2270
|
+
const c = t % 16;
|
|
2271
|
+
const hop = c === 6 || c === 7 ? 1 : 0;
|
|
2272
|
+
const e = [[13, 5 - hop, "g"], [14, 4 - hop, "g"], [15, 3 - hop, "g"]];
|
|
2273
|
+
return {
|
|
2274
|
+
...BASE,
|
|
2275
|
+
y0: 4 - hop,
|
|
2276
|
+
ex: 1,
|
|
2277
|
+
ey: -1,
|
|
2278
|
+
eyes: c >= 6 && c < 10 ? "happy" : "open",
|
|
2279
|
+
legs: hop ? [1, 1, 1] : [0, 0, 0],
|
|
2280
|
+
extras: e
|
|
2281
|
+
};
|
|
2282
|
+
},
|
|
2283
|
+
static: () => ({
|
|
2284
|
+
...BASE
|
|
2285
|
+
})
|
|
2286
|
+
};
|
|
2287
|
+
|
|
2288
|
+
/** Where a held object sits, in grid cells (may run past the 16×16 grid). */
|
|
2289
|
+
|
|
2290
|
+
/**
|
|
2291
|
+
* The pairing poses' object anchors at tick `t`, for a 7×7-cell object — a
|
|
2292
|
+
* tool icon tile. Bobs follow the pose so the object moves with the hands.
|
|
2293
|
+
*/
|
|
2294
|
+
const OTTO_ANCHORS = exports.OTTO_ANCHORS = {
|
|
2295
|
+
present: t => ({
|
|
2296
|
+
x: 14,
|
|
2297
|
+
y: -1 + Math.floor(t % 16 / 4) % 2,
|
|
2298
|
+
over: false
|
|
2299
|
+
}),
|
|
2300
|
+
lift: t => {
|
|
2301
|
+
const c = t % 16;
|
|
2302
|
+
const hop = c % 8 === 2 || c % 8 === 3 ? 1 : 0;
|
|
2303
|
+
return {
|
|
2304
|
+
x: 4,
|
|
2305
|
+
y: -5 - hop,
|
|
2306
|
+
over: false
|
|
2307
|
+
};
|
|
2308
|
+
},
|
|
2309
|
+
carry: t => ({
|
|
2310
|
+
x: 4,
|
|
2311
|
+
y: -5 + Math.floor(t / 2) % 2,
|
|
2312
|
+
over: false
|
|
2313
|
+
}),
|
|
2314
|
+
hug: t => ({
|
|
2315
|
+
x: 4,
|
|
2316
|
+
y: 7 + Math.floor(t % 16 / 8) % 2,
|
|
2317
|
+
over: true
|
|
2318
|
+
}),
|
|
2319
|
+
lean: () => ({
|
|
2320
|
+
x: 14,
|
|
2321
|
+
y: 6,
|
|
2322
|
+
over: false
|
|
2323
|
+
}),
|
|
2324
|
+
point: t => {
|
|
2325
|
+
const c = t % 16;
|
|
2326
|
+
const hop = c === 6 || c === 7 ? 1 : 0;
|
|
2327
|
+
return {
|
|
2328
|
+
x: 15,
|
|
2329
|
+
y: -5 - hop + Math.floor(c / 4) % 2,
|
|
2330
|
+
over: false
|
|
2331
|
+
};
|
|
2332
|
+
}
|
|
2333
|
+
};
|
|
2334
|
+
|
|
2335
|
+
/** The object size OTTO_ANCHORS is drawn for, in cells. */
|
|
2336
|
+
const OTTO_ANCHOR_SIZE = exports.OTTO_ANCHOR_SIZE = 7;
|
|
2337
|
+
const OTTO_NOTES = exports.OTTO_NOTES = {
|
|
2338
|
+
idle: "Bobs one pixel, blinks, glances left and right.",
|
|
2339
|
+
thinking: "Looks up; a thought cloud fills with dots.",
|
|
2340
|
+
happy: "Two-pixel hop: stretch on takeoff, squash on landing.",
|
|
2341
|
+
error: "Lamp goes red, eyes shut, body shakes.",
|
|
2342
|
+
sleep: "Sinks a row, lamp dims, z’s drift up.",
|
|
2343
|
+
peek: "Submerged to the eyes, scanning.",
|
|
2344
|
+
typing: "Laptop with a Buoy screen; tentacles tap.",
|
|
2345
|
+
debugging: "Magnifier over one eye, scanning left and right.",
|
|
2346
|
+
building: "Hard hat, hammer swings, spark on the hit.",
|
|
2347
|
+
carrying: "Phone overhead, marching.",
|
|
2348
|
+
pushing: "Shoves a crate, one pixel per heave.",
|
|
2349
|
+
sweeping: "Broom, dust puff on each stroke.",
|
|
2350
|
+
juggling: "Three blocks: red, orange, purple.",
|
|
2351
|
+
wizard: "Purple hat, wand sparkles.",
|
|
2352
|
+
conducting: "Arms swing in antiphase, notes rise.",
|
|
2353
|
+
beacon: "Lamp emits three expanding rings.",
|
|
2354
|
+
notification: "Hop with a blinking exclamation.",
|
|
2355
|
+
disconnected: "Lamp dim, looks up at a phone blinking red.",
|
|
2356
|
+
dizzy: "X eyes, two stars orbit, body wobbles.",
|
|
2357
|
+
overheated: "Melts into a puddle and reforms.",
|
|
2358
|
+
confused: "Question mark, head tilt, eyes wander.",
|
|
2359
|
+
stare: "Big square eyes. Rare blink.",
|
|
2360
|
+
walking: "Crab-walks left and right, eyes lead.",
|
|
2361
|
+
goingaway: "Walks off the right edge, returns from the left.",
|
|
2362
|
+
eureka: "Bulb appears, lights up with sparks, tiny hops.",
|
|
2363
|
+
grooving: "Headphones on, sways with the beat, notes pop.",
|
|
2364
|
+
hatmishap: "Wizard hat slips over the eyes; a wave of the wand fixes it.",
|
|
2365
|
+
lowbattery: "Slumped, lamp off, red battery blinks. Eyes barely open.",
|
|
2366
|
+
wake: "Puddle, wide eyes, springs up, squashes, settles.",
|
|
2367
|
+
builder: "Balances a stack of blocks; sweat drop when it wobbles.",
|
|
2368
|
+
mini: "Half-size Otto. Big eyes, waving arms, kicking feet.",
|
|
2369
|
+
minityping: "Mini Otto typing, data bits float up.",
|
|
2370
|
+
happydance: "Arms pump in antiphase, feet shuffle.",
|
|
2371
|
+
jumping: "Crouch, four-pixel leap, arms up, land.",
|
|
2372
|
+
loading: "Three dots chase around a ring; eyes follow the lead.",
|
|
2373
|
+
progress: "A bar fills across the top; a hop when it completes.",
|
|
2374
|
+
hourglass: "Sand runs through, the glass lifts and flips.",
|
|
2375
|
+
waiting: "Foot taps, checks the wristwatch, dots pile up.",
|
|
2376
|
+
syncing: "Two arcs chase each other; lamp pulses in step.",
|
|
2377
|
+
downloading: "An arrow drops into the tray, the parcel lands.",
|
|
2378
|
+
uploading: "The parcel lifts off the tray and climbs out.",
|
|
2379
|
+
connecting: "Signal bars fill one by one, then blink: connected.",
|
|
2380
|
+
scanning: "A bright line sweeps down the body with a trail.",
|
|
2381
|
+
searching: "Binoculars up, slow sweep left and right.",
|
|
2382
|
+
empty: "Peers into an open box, finds nothing, looks back at you.",
|
|
2383
|
+
shrug: "Arms up, looks left, looks right, arms down.",
|
|
2384
|
+
fishing: "Rod out, bobber bobbing; one tug, one splash.",
|
|
2385
|
+
listening: "Hand cupped, sound arcs arriving from the side.",
|
|
2386
|
+
tumbleweed: "A tumbleweed rolls past; eyes follow it off the edge.",
|
|
2387
|
+
warning: "Holds up a warning sign, lamp blinking.",
|
|
2388
|
+
crash: "Burst, smoke, then dazed with X eyes.",
|
|
2389
|
+
panic: "Arms flail, sweat flies, lamp strobes.",
|
|
2390
|
+
sos: "The lamp flashes S-O-S in morse; arms wave.",
|
|
2391
|
+
offline: "A struck-through cloud; slumped, lamp dim.",
|
|
2392
|
+
timeout: "A clock ticks round, turns red; a shake.",
|
|
2393
|
+
locked: "A padlock: look, strain at it, give up.",
|
|
2394
|
+
unlocked: "The shackle pops open; sparkles and a hop.",
|
|
2395
|
+
denied: "A red no-entry sign; head shaking.",
|
|
2396
|
+
broken: "A crack down the middle; a band-aid goes on.",
|
|
2397
|
+
sad: "Sunk a row, lamp dim, a tear drops in.",
|
|
2398
|
+
rain: "A rain cloud overhead, drops falling.",
|
|
2399
|
+
sick: "A thermometer climbs; wobbling and sweating.",
|
|
2400
|
+
flood: "In over the eyes, arms flailing, bubbles rising.",
|
|
2401
|
+
bug: "A beetle crawls across the body, then flies off.",
|
|
2402
|
+
alarm: "The lamp is a siren: red strobe, sweeping rays.",
|
|
2403
|
+
frozen: "Iced over: icicles for legs, snow, shivering.",
|
|
2404
|
+
snail: "A snail crosses the foreground, very slowly.",
|
|
2405
|
+
angry: "Brows down, lamp red, steam, stomping.",
|
|
2406
|
+
ghost: "Grey and translucent, floating, white eyes.",
|
|
2407
|
+
nervous: "Eyes darting, sweat, fidgeting feet.",
|
|
2408
|
+
puzzled: "A tentacle scratches the head; eyes wander.",
|
|
2409
|
+
detective: "Deerstalker hat, magnifying glass on the move.",
|
|
2410
|
+
reading: "An open book; eyes run the lines; a page turns.",
|
|
2411
|
+
success: "A check mark lands; sparkles, a hop, lamp blinks.",
|
|
2412
|
+
celebrate: "Confetti falls, arms up, bouncing.",
|
|
2413
|
+
thumbsup: "A fist rises, thumb out; then a wink.",
|
|
2414
|
+
party: "Party hat, confetti, a side-to-side dance.",
|
|
2415
|
+
trophy: "A cup held overhead, sparkles, a hop.",
|
|
2416
|
+
starred: "A star pops in at the top right and twinkles.",
|
|
2417
|
+
love: "Hearts float up either side; the body bobs.",
|
|
2418
|
+
wave: "One arm up, hand swinging; a smile at the end.",
|
|
2419
|
+
bow: "A slow bow: squash forward, eyes shut, back up.",
|
|
2420
|
+
cool: "Sunglasses drop into place; a little sway.",
|
|
2421
|
+
flexing: "Both arms up in a flex; the biceps pop.",
|
|
2422
|
+
zen: "Floating above the water, eyes shut, slow bob.",
|
|
2423
|
+
recording: "A red REC dot blinks; eyes slowly sweep the room.",
|
|
2424
|
+
paused: "Pause bars overhead; resting, lamp dim, one peek.",
|
|
2425
|
+
filtering: "A funnel: mixed bits go in, only orange comes out.",
|
|
2426
|
+
pinned: "A pushpin drops in from above and lands.",
|
|
2427
|
+
rewind: "Moonwalks left while a clock runs backwards.",
|
|
2428
|
+
storing: "Crates stack up on the right, one at a time.",
|
|
2429
|
+
printing: "A little printer spools out a strip of log lines.",
|
|
2430
|
+
stopwatch: "A stopwatch with a fast hand; speed lines.",
|
|
2431
|
+
spotlight: "The lamp throws a beam that sweeps left, up, right.",
|
|
2432
|
+
keys: "A keyring held out; the keys jingle.",
|
|
2433
|
+
map: "A folded map: dotted route, red pin; looks around.",
|
|
2434
|
+
photo: "A camera held up; flash; a print pops out.",
|
|
2435
|
+
painting: "A canvas on the right; strokes appear.",
|
|
2436
|
+
disguise: "Groucho glasses, nose and moustache; sly glances.",
|
|
2437
|
+
pro: "A crown in place of the lamp, jewels, sparkles.",
|
|
2438
|
+
talking: "A speech bubble with typing dots; lamp pulses.",
|
|
2439
|
+
handshake: "A hand arrives from the right; they shake.",
|
|
2440
|
+
robot: "A small robot friend: antenna blinking, eyes flickering.",
|
|
2441
|
+
plug: "A plug slides in and connects; the lamp comes on.",
|
|
2442
|
+
gift: "A wrapped gift bounces; the lid lifts with a sparkle.",
|
|
2443
|
+
action: "A clapperboard claps shut.",
|
|
2444
|
+
guard: "A shield up; a red bolt sparks off it and bounces away.",
|
|
2445
|
+
coffee: "A mug with steam; a sip with eyes shut.",
|
|
2446
|
+
swimming: "In to the shoulders, alternating strokes with splashes.",
|
|
2447
|
+
diving: "Sinks out of sight, bubbles rise, comes back dripping.",
|
|
2448
|
+
balloon: "A balloon lifts Otto clear of the water; a splash on release.",
|
|
2449
|
+
landing: "Drops in from above, lands with a squash and a splash.",
|
|
2450
|
+
spinning: "A full turn: front, three-quarter, side, back and round.",
|
|
2451
|
+
bubbles: "Blows through a bubble wand; bubbles drift up.",
|
|
2452
|
+
trash: "Bits fly into a bin, the lid flaps, a puff when done.",
|
|
2453
|
+
saved: "A floppy disk pops in; a hop and a sparkle.",
|
|
2454
|
+
copied: "One sheet slides out from behind another.",
|
|
2455
|
+
charting: "Three bars grow on the right; pleased when they land.",
|
|
2456
|
+
present: "A flat hand held out; the object floats above the palm.",
|
|
2457
|
+
lift: "Both arms up; the object rides overhead; a hop.",
|
|
2458
|
+
carry: "Arms up, marching; the object rides with the step.",
|
|
2459
|
+
hug: "Arms wrapped round the object; eyes peep over it.",
|
|
2460
|
+
lean: "One arm resting on the object beside Otto; relaxed.",
|
|
2461
|
+
point: "Arm up and out; the object hangs up-right, bobbing.",
|
|
2462
|
+
static: "Base pose, no motion. For favicons and stills."
|
|
2463
|
+
};
|
|
2464
|
+
|
|
2465
|
+
/** Every animated state, in the mockup's order (`static` excluded). */
|
|
2466
|
+
const OTTO_STATE_NAMES = exports.OTTO_STATE_NAMES = Object.keys(OTTO_STATES).filter(n => n !== "static");
|
|
2467
|
+
/**
|
|
2468
|
+
* The states by job. Every animated state is in exactly one group; a tool
|
|
2469
|
+
* picks from the group that matches the moment (an empty list shows an
|
|
2470
|
+
* `empty` group state, a failed request a `trouble` one, and so on).
|
|
2471
|
+
*/
|
|
2472
|
+
const OTTO_GROUPS = exports.OTTO_GROUPS = [{
|
|
2473
|
+
id: "loading",
|
|
2474
|
+
title: "Loading & progress",
|
|
2475
|
+
blurb: "Something is on its way. Spinners, bars, connecting, scanning, waiting.",
|
|
2476
|
+
states: ["loading", "progress", "hourglass", "waiting", "syncing", "downloading", "uploading", "connecting", "scanning", "searching", "fishing"]
|
|
2477
|
+
}, {
|
|
2478
|
+
id: "empty",
|
|
2479
|
+
title: "Empty & unknown",
|
|
2480
|
+
blurb: "Nothing here yet, nothing found, or no idea what this is.",
|
|
2481
|
+
states: ["empty", "shrug", "tumbleweed", "confused", "puzzled"]
|
|
2482
|
+
}, {
|
|
2483
|
+
id: "trouble",
|
|
2484
|
+
title: "Errors & trouble",
|
|
2485
|
+
blurb: "Failures, warnings, disconnects, limits — from a blip to a crash.",
|
|
2486
|
+
states: ["error", "warning", "crash", "panic", "sos", "alarm", "offline", "disconnected", "timeout", "locked", "denied", "broken", "sad", "rain", "sick", "overheated", "dizzy", "flood", "bug", "frozen", "snail", "angry", "ghost", "nervous", "lowbattery"]
|
|
2487
|
+
}, {
|
|
2488
|
+
id: "success",
|
|
2489
|
+
title: "Success & celebration",
|
|
2490
|
+
blurb: "It worked. Confirmations, unlocks, milestones, thanks.",
|
|
2491
|
+
states: ["happy", "eureka", "success", "celebrate", "thumbsup", "party", "trophy", "starred", "love", "unlocked", "notification", "beacon", "cool", "flexing", "pro", "gift"]
|
|
2492
|
+
}, {
|
|
2493
|
+
id: "working",
|
|
2494
|
+
title: "Working & tool moments",
|
|
2495
|
+
blurb: "Busy doing the job: capturing, filtering, saving, inspecting, talking.",
|
|
2496
|
+
states: ["thinking", "typing", "debugging", "building", "carrying", "pushing", "sweeping", "detective", "reading", "map", "painting", "photo", "printing", "storing", "charting", "stopwatch", "spotlight", "keys", "filtering", "talking", "listening", "recording", "paused", "rewind", "trash", "disguise", "guard", "action", "robot", "plug", "handshake", "saved", "copied", "pinned"]
|
|
2497
|
+
}, {
|
|
2498
|
+
id: "personality",
|
|
2499
|
+
title: "Idle, moves & personality",
|
|
2500
|
+
blurb: "Otto being Otto: idling, wandering, swimming, dancing, showing off.",
|
|
2501
|
+
states: ["idle", "stare", "mini", "minityping", "walking", "goingaway", "peek", "sleep", "wake", "jumping", "spinning", "swimming", "diving", "balloon", "landing", "bubbles", "zen", "bow", "wave", "coffee", "grooving", "conducting", "juggling", "wizard", "hatmishap", "builder", "happydance"]
|
|
2502
|
+
}, {
|
|
2503
|
+
id: "pairing",
|
|
2504
|
+
title: "Pairing poses",
|
|
2505
|
+
blurb: "Built to hold a tool's icon tile — the object is drawn by the scene at OTTO_ANCHORS.",
|
|
2506
|
+
states: ["present", "lift", "carry", "hug", "lean", "point"]
|
|
2507
|
+
}];
|
|
2508
|
+
|
|
2509
|
+
/** When to reach for each state — the moment in a tool it was drawn for. */
|
|
2510
|
+
const OTTO_USES = exports.OTTO_USES = {
|
|
2511
|
+
idle: "Default resting state; nothing to report.",
|
|
2512
|
+
thinking: "Working something out; Ask Buoy composing.",
|
|
2513
|
+
happy: "A quick positive beat after any action.",
|
|
2514
|
+
error: "A request or action failed.",
|
|
2515
|
+
sleep: "Tool idle for a long time; capture off overnight.",
|
|
2516
|
+
peek: "Minimized or collapsed; still watching.",
|
|
2517
|
+
typing: "Ask Buoy typing a reply; code being written.",
|
|
2518
|
+
debugging: "Inspecting a detail view; stepping through.",
|
|
2519
|
+
building: "Bundling, compiling, a build in progress.",
|
|
2520
|
+
carrying: "Moving data between tools; exporting.",
|
|
2521
|
+
pushing: "A heavy job: large payload, slow migration.",
|
|
2522
|
+
sweeping: "Clearing a list; cache cleanup done.",
|
|
2523
|
+
juggling: "Several stores or queries updating at once.",
|
|
2524
|
+
wizard: "A setup wizard; magic done on your behalf.",
|
|
2525
|
+
conducting: "Orchestrating a flow or scenario.",
|
|
2526
|
+
beacon: "Broadcasting: broker up, dashboard discoverable.",
|
|
2527
|
+
notification: "A new item arrived; badge count went up.",
|
|
2528
|
+
disconnected: "Device or dashboard connection dropped.",
|
|
2529
|
+
dizzy: "Too many re-renders; a render storm.",
|
|
2530
|
+
overheated: "CPU or thermal pressure; perf meltdown.",
|
|
2531
|
+
confused: "Unknown or unparseable data.",
|
|
2532
|
+
stare: "Watching for a specific event; recording armed.",
|
|
2533
|
+
walking: "Navigating between routes.",
|
|
2534
|
+
goingaway: "Leaving a screen; a tool closing.",
|
|
2535
|
+
eureka: "Root cause found; a diff that explains it.",
|
|
2536
|
+
grooving: "Everything healthy; nothing to do but vibe.",
|
|
2537
|
+
hatmishap: "A small recoverable slip; retry worked.",
|
|
2538
|
+
lowbattery: "Device battery low; power-saving mode.",
|
|
2539
|
+
wake: "Tool re-opened; capture resumed.",
|
|
2540
|
+
builder: "Assembling a state tree or fixture.",
|
|
2541
|
+
mini: "Compact or inline placements.",
|
|
2542
|
+
minityping: "A compact typing indicator.",
|
|
2543
|
+
happydance: "A milestone: all tests green, release done.",
|
|
2544
|
+
jumping: "Jump to a route, a log line, a snapshot.",
|
|
2545
|
+
loading: "Generic indeterminate loading.",
|
|
2546
|
+
progress: "Determinate progress: download, batch, upload.",
|
|
2547
|
+
hourglass: "Waiting on a timer; a scheduled retry.",
|
|
2548
|
+
waiting: "Waiting for a device, the first event, a reply.",
|
|
2549
|
+
syncing: "Syncing with the desktop dashboard or broker.",
|
|
2550
|
+
downloading: "Pulling a snapshot, an update, a payload.",
|
|
2551
|
+
uploading: "Sending a report, a snapshot, feedback.",
|
|
2552
|
+
connecting: "Connecting to a device or broker.",
|
|
2553
|
+
scanning: "Scanning for targets, keys, assets, fibers.",
|
|
2554
|
+
searching: "A search running; filtering a long list.",
|
|
2555
|
+
fishing: "Capture on, nothing captured yet.",
|
|
2556
|
+
empty: "An empty list: no requests, no logs, no keys.",
|
|
2557
|
+
shrug: "No result and no explanation available.",
|
|
2558
|
+
tumbleweed: "Deliberately empty; nothing happened for a while.",
|
|
2559
|
+
puzzled: "Unexpected shape; needs a second look.",
|
|
2560
|
+
warning: "A warning: deprecated, risky, near a limit.",
|
|
2561
|
+
crash: "The app crashed; a fatal was captured.",
|
|
2562
|
+
panic: "Many errors at once; an error cascade.",
|
|
2563
|
+
sos: "Critical: the app cannot continue.",
|
|
2564
|
+
alarm: "An alert rule fired; attention now.",
|
|
2565
|
+
offline: "No network; device offline.",
|
|
2566
|
+
timeout: "A request or connection timed out.",
|
|
2567
|
+
locked: "A Pro feature; a locked setting.",
|
|
2568
|
+
denied: "Permission denied; blocked by policy.",
|
|
2569
|
+
broken: "Corrupted data; a broken persisted value.",
|
|
2570
|
+
sad: "Nothing matched; a failed search.",
|
|
2571
|
+
rain: "A bad run: errors piling up.",
|
|
2572
|
+
sick: "Unhealthy config; env check failing.",
|
|
2573
|
+
flood: "Buffer full; too many events to keep up.",
|
|
2574
|
+
bug: "A bug was found (or is being reported).",
|
|
2575
|
+
frozen: "The UI thread froze; a hung frame.",
|
|
2576
|
+
snail: "Slow: a long request, a slow render.",
|
|
2577
|
+
angry: "Rate limited, rejected, forbidden.",
|
|
2578
|
+
ghost: "Stale or detached: an unmounted component, an old snapshot.",
|
|
2579
|
+
nervous: "A risky action pending confirmation.",
|
|
2580
|
+
detective: "Investigating; root-cause analysis.",
|
|
2581
|
+
reading: "Reading docs or a long log.",
|
|
2582
|
+
success: "Action completed; a rule saved, a replay done.",
|
|
2583
|
+
celebrate: "A big success: first capture, setup complete.",
|
|
2584
|
+
thumbsup: "Approved; looks good; confirmation received.",
|
|
2585
|
+
party: "Release shipped; a version milestone.",
|
|
2586
|
+
trophy: "Best benchmark yet; a personal record.",
|
|
2587
|
+
starred: "Pinned, favourited, starred.",
|
|
2588
|
+
love: "Thanks and delight; feedback sent.",
|
|
2589
|
+
unlocked: "Pro unlocked; license activated.",
|
|
2590
|
+
cool: "Perfect score; zero warnings.",
|
|
2591
|
+
flexing: "Fast: a great perf result.",
|
|
2592
|
+
zen: "All quiet; nothing needs attention.",
|
|
2593
|
+
pro: "Pro plan active.",
|
|
2594
|
+
gift: "New version or feature available.",
|
|
2595
|
+
map: "Route inspector; where am I in the navigator.",
|
|
2596
|
+
photo: "Screenshot taken; image captured.",
|
|
2597
|
+
painting: "Assets and design overlays; theming.",
|
|
2598
|
+
printing: "Console streaming; logs arriving.",
|
|
2599
|
+
storing: "Saving to storage; persisting.",
|
|
2600
|
+
charting: "Metrics building up; perf charts.",
|
|
2601
|
+
stopwatch: "Benchmark running; timing a request.",
|
|
2602
|
+
spotlight: "Highlighting renders; spotlight on a component.",
|
|
2603
|
+
keys: "Environment variables and secrets.",
|
|
2604
|
+
filtering: "Filters active; a subset shown.",
|
|
2605
|
+
talking: "Ask Buoy answering; a message in flight.",
|
|
2606
|
+
listening: "Listening for events; waiting for input.",
|
|
2607
|
+
recording: "Capture on; recording a session.",
|
|
2608
|
+
paused: "Capture paused.",
|
|
2609
|
+
rewind: "Time Machine: stepping back through snapshots.",
|
|
2610
|
+
trash: "Cleared: list emptied, cache purged.",
|
|
2611
|
+
disguise: "Impersonating another user.",
|
|
2612
|
+
guard: "Sentry or a guard rail caught something.",
|
|
2613
|
+
action: "A scenario or flow started.",
|
|
2614
|
+
robot: "The MCP agent is driving the tools.",
|
|
2615
|
+
plug: "Device connected; plugin installed.",
|
|
2616
|
+
handshake: "Paired with the desktop dashboard.",
|
|
2617
|
+
saved: "Saved: request, snapshot, rule.",
|
|
2618
|
+
copied: "Copied to clipboard.",
|
|
2619
|
+
pinned: "Item pinned; survives clears.",
|
|
2620
|
+
spinning: "Refreshing; reloading the app.",
|
|
2621
|
+
swimming: "Making progress through a long job.",
|
|
2622
|
+
diving: "Drilling into a detail or nested value.",
|
|
2623
|
+
balloon: "Upgrading; a plan change in progress.",
|
|
2624
|
+
landing: "Tool mounted; first open.",
|
|
2625
|
+
bubbles: "A light idle for empty side panels.",
|
|
2626
|
+
bow: "Thank you; a graceful exit.",
|
|
2627
|
+
wave: "Welcome; onboarding; first run.",
|
|
2628
|
+
coffee: "A long build; take a break.",
|
|
2629
|
+
present: "Presenting a tool: onboarding, a tool's intro card.",
|
|
2630
|
+
lift: "Showing off a tool: a feature announcement.",
|
|
2631
|
+
carry: "Bringing a tool along: install, add-to-dial.",
|
|
2632
|
+
hug: "A favourite tool: pinned, most used.",
|
|
2633
|
+
lean: "A tool at rest: its idle or settings screen.",
|
|
2634
|
+
point: "Pointing at a tool: a hint, a next step.",
|
|
2635
|
+
static: "Favicons, stills, icons."
|
|
2636
|
+
};
|
|
2637
|
+
|
|
2638
|
+
/** Cycle lengths that differ from the 16-tick default (used by the reel). */
|
|
2639
|
+
const OTTO_CYCLE = {
|
|
2640
|
+
progress: 32,
|
|
2641
|
+
hourglass: 20,
|
|
2642
|
+
fishing: 32,
|
|
2643
|
+
tumbleweed: 28,
|
|
2644
|
+
crash: 20,
|
|
2645
|
+
sos: 34,
|
|
2646
|
+
locked: 20,
|
|
2647
|
+
unlocked: 20,
|
|
2648
|
+
broken: 24,
|
|
2649
|
+
snail: 36,
|
|
2650
|
+
reading: 24,
|
|
2651
|
+
storing: 24,
|
|
2652
|
+
diving: 24,
|
|
2653
|
+
balloon: 24,
|
|
2654
|
+
swimming: 8,
|
|
2655
|
+
scanning: 14,
|
|
2656
|
+
connecting: 14,
|
|
2657
|
+
loading: 10,
|
|
2658
|
+
syncing: 10,
|
|
2659
|
+
downloading: 12,
|
|
2660
|
+
uploading: 12,
|
|
2661
|
+
alarm: 8,
|
|
2662
|
+
flood: 8,
|
|
2663
|
+
panic: 8,
|
|
2664
|
+
nervous: 8,
|
|
2665
|
+
keys: 8,
|
|
2666
|
+
flexing: 8
|
|
2667
|
+
};
|
|
2668
|
+
|
|
2669
|
+
/** The demo reel: [state, frames]. */
|
|
2670
|
+
const OTTO_REEL = exports.OTTO_REEL = [["idle", 30], ["thinking", 20], ["typing", 20], ["happy", 14], ["debugging", 18], ["idle", 14], ["building", 16], ["carrying", 14], ["pushing", 14], ["sweeping", 14], ["juggling", 16], ["wizard", 14], ["conducting", 14], ["beacon", 14], ["notification", 16], ["error", 12], ["disconnected", 14], ["dizzy", 14], ["overheated", 24], ["confused", 18], ["stare", 20], ["walking", 32], ["eureka", 24], ["grooving", 16], ["hatmishap", 32], ["builder", 16], ["happydance", 12], ["jumping", 16], ["mini", 16], ["minityping", 12], ["lowbattery", 24], ["sleep", 24], ["wake", 30], ["peek", 18], ["goingaway", 26],
|
|
2671
|
+
// Everything after the original set, one full cycle each.
|
|
2672
|
+
...["loading", "progress", "hourglass", "waiting", "syncing", "downloading", "uploading", "connecting", "scanning", "searching", "fishing", "empty", "shrug", "tumbleweed", "puzzled", "warning", "crash", "panic", "sos", "alarm", "offline", "timeout", "locked", "unlocked", "denied", "broken", "sad", "rain", "sick", "flood", "bug", "frozen", "snail", "angry", "ghost", "nervous", "detective", "reading", "success", "celebrate", "thumbsup", "party", "trophy", "starred", "love", "wave", "bow", "cool", "flexing", "zen", "recording", "paused", "filtering", "pinned", "rewind", "storing", "printing", "stopwatch", "spotlight", "keys", "map", "photo", "painting", "disguise", "pro", "talking", "handshake", "robot", "plug", "gift", "action", "guard", "coffee", "swimming", "diving", "balloon", "landing", "spinning", "bubbles", "trash", "saved", "copied", "charting", "present", "lift", "carry", "hug", "lean", "point"].map(s => [s, OTTO_CYCLE[s] ?? 16])];
|
|
2673
|
+
const REEL_LENGTH = OTTO_REEL.reduce((a, s) => a + s[1], 0);
|
|
2674
|
+
|
|
2675
|
+
/** Which reel state plays at tick `t`, and how far into it we are. */
|
|
2676
|
+
function ottoReel(t) {
|
|
2677
|
+
let c = (t % REEL_LENGTH + REEL_LENGTH) % REEL_LENGTH;
|
|
2678
|
+
for (const [state, len] of OTTO_REEL) {
|
|
2679
|
+
if (c < len) return {
|
|
2680
|
+
state,
|
|
2681
|
+
local: c
|
|
2682
|
+
};
|
|
2683
|
+
c -= len;
|
|
2684
|
+
}
|
|
2685
|
+
return {
|
|
2686
|
+
state: "idle",
|
|
2687
|
+
local: 0
|
|
2688
|
+
};
|
|
2689
|
+
}
|
|
2690
|
+
|
|
2691
|
+
/**
|
|
2692
|
+
* One frame of one state as a 16×16 grid of palette keys (`.` = transparent).
|
|
2693
|
+
* Look colours up in `OTTO_PALETTE`.
|
|
2694
|
+
*/
|
|
2695
|
+
function renderOttoFrame(state, t, opts = {}) {
|
|
2696
|
+
const local = Math.max(0, Math.floor(t));
|
|
2697
|
+
const pose = OTTO_STATES[state](local);
|
|
2698
|
+
return compose(draw(pose), local, {
|
|
2699
|
+
water: opts.water ?? true,
|
|
2700
|
+
keyline: opts.keyline ?? true,
|
|
2701
|
+
submerged: !!pose.submerged
|
|
2702
|
+
});
|
|
2703
|
+
}
|
|
2704
|
+
|
|
2705
|
+
/** A horizontal run of one colour — what the renderer actually draws. */
|
|
2706
|
+
|
|
2707
|
+
/**
|
|
2708
|
+
* Run-length encode a frame into coloured spans, skipping transparency. A
|
|
2709
|
+
* 16×16 frame is ~256 cells but only ~40–70 runs, which is what keeps a
|
|
2710
|
+
* screen full of animating sprites cheap on Fabric.
|
|
2711
|
+
*/
|
|
2712
|
+
function ottoRuns(grid) {
|
|
2713
|
+
const runs = [];
|
|
2714
|
+
for (let y = 0; y < grid.length; y++) {
|
|
2715
|
+
const row = grid[y];
|
|
2716
|
+
let x = 0;
|
|
2717
|
+
while (x < row.length) {
|
|
2718
|
+
const key = row[x];
|
|
2719
|
+
let w = 1;
|
|
2720
|
+
while (x + w < row.length && row[x + w] === key) w++;
|
|
2721
|
+
if (key !== ".") {
|
|
2722
|
+
const color = OTTO_PALETTE[key];
|
|
2723
|
+
if (color) runs.push({
|
|
2724
|
+
x,
|
|
2725
|
+
y,
|
|
2726
|
+
w,
|
|
2727
|
+
color
|
|
2728
|
+
});
|
|
2729
|
+
}
|
|
2730
|
+
x += w;
|
|
2731
|
+
}
|
|
2732
|
+
}
|
|
2733
|
+
return runs;
|
|
2734
|
+
}
|