Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

feat(website): ship the app's real cursor packs, for v4

Etienne Lescotd210283aa7e1
diff --git a/website/scripts/check-media-budget.mjs b/website/scripts/check-media-budget.mjs
index 39d64c1d5..2132d9268 100644
--- a/website/scripts/check-media-budget.mjs
+++ b/website/scripts/check-media-budget.mjs
@@ -27,6 +27,10 @@ const ROOT = resolve(import.meta.dirname, "..");
const RULES = [
{ dir: "static/video", ext: [".mp4"], max: 200_000 },
{ dir: "static/img/walkthrough", ext: [".jpg", ".avif"], max: 70_000 },
+ // The cursor packs, copied out of the application's own public/cursors. Each
+ // is a 32-logical sprite at 128px, so a five-figure file here means someone
+ // has shipped a full-resolution source by mistake.
+ { dir: "static/img/cursors", ext: [".png"], max: 12_000 },
];
/**
diff --git a/website/scripts/gen-recreation.mjs b/website/scripts/gen-recreation.mjs
index 31a29253c..0bcc0bef6 100644
--- a/website/scripts/gen-recreation.mjs
+++ b/website/scripts/gen-recreation.mjs
@@ -109,6 +109,11 @@ const { effectiveZoomScale, ZOOM_DEPTH_SCALES } = await appModule(
const { buildClipSection, isSilenceWord, SILENCE_THRESHOLD_SEC } = await appModule(
"src/lib/ai-edition/timeline/aggregated-transcript.ts",
);
+// Importable as-is: its only import is `import type { NativeCursorType }`, which
+// Node's type stripping removes, so the `@/` alias never has to resolve.
+const { CURSOR_THEMES, DEFAULT_CURSOR_SPRITES, DEFAULT_CURSOR_THEME_ID } = await appModule(
+ "src/lib/cursor/cursorThemes.ts",
+);
// ── locale access that fails loudly ─────────────────────────────────────
const locale = (ns) =>
@@ -786,6 +791,60 @@ const CONTROLS = {
),
};
+/**
+ * The cursor packs the Cursor panel's picker shows, and the two macOS shapes the
+ * demonstration pointer swaps to.
+ *
+ * Every one is a pack the application actually ships in `public/cursors/`, with
+ * the hotspot the application actually uses — which is the whole reason to read
+ * this table rather than eyeball a `transform-origin`. The two sources spell
+ * hotspots differently and that is the trap: `DEFAULT_CURSOR_SPRITES` stores
+ * fractions of the image (0.119), while a theme stores the same quantity against
+ * the ~32-logical reference the file header describes (1.5, i.e. 1.5/32). Both
+ * are normalised to a fraction here, once.
+ */
+const CURSOR_PICKER = [
+ DEFAULT_CURSOR_THEME_ID,
+ "pink-glossy-arrow-and-hand-3d",
+ "spring-gradient",
+ "black-and-rainbow-stroke-gradient-animated",
+ "among-us-sus-knife-and-red-animated",
+ "hollow-knight-and-game-arrow",
+ "mickey-mouse-black-hand-inflated-glove",
+ "sanrio-kuromi-skull-arrow",
+ "old-roblox",
+ "pokemon-neon-gengar",
+];
+
+const REF = 32;
+const frac = (v) => Number((v > 1 ? v / REF : v).toFixed(4));
+
+function cursorSprite(id, kind) {
+ if (id === DEFAULT_CURSOR_THEME_ID) {
+ const a = DEFAULT_CURSOR_SPRITES[kind];
+ if (!a) throw new Error(`default sprites have no ${kind}`);
+ return { name: "Default", hotspotX: frac(a.hotspotX), hotspotY: frac(a.hotspotY) };
+ }
+ const theme = CURSOR_THEMES.find((t) => t.id === id);
+ if (!theme) throw new Error(`unknown cursor theme ${id} — it is not in CURSOR_THEMES`);
+ const a = theme.assets[kind];
+ if (!a) throw new Error(`cursor theme ${id} ships no ${kind} sprite`);
+ return { name: theme.name, hotspotX: frac(a.hotspotX), hotspotY: frac(a.hotspotY) };
+}
+
+const CURSORS = {
+ themeCount: CURSOR_THEMES.length + 1,
+ themes: CURSOR_PICKER.map((id, i) => ({
+ id,
+ ...cursorSprite(id, "arrow"),
+ src: `/img/cursors/${String(i).padStart(2, "0")}-arrow.png`,
+ })),
+ // The demonstration pointer over a control and over text. Default pack only:
+ // a theme may ship an arrow and a pointer, and none ships a text caret.
+ pointer: { ...cursorSprite(DEFAULT_CURSOR_THEME_ID, "pointer"), src: "/img/cursors/mac-pointer.png" },
+ text: { ...cursorSprite(DEFAULT_CURSOR_THEME_ID, "text"), src: "/img/cursors/mac-text.png" },
+};
+
const PANELS = {
background: {
title: t("settings:background.title"),
@@ -1152,6 +1211,10 @@ export const EFFECTS = ${lit(EFFECTS)} as const;
* and suffixed the way RightPanes.tsx scales and suffixes it. */
export const CONTROLS = ${lit(CONTROLS)} as const;
+/** The cursor packs the picker shows, each with the application's own hotspot,
+ * normalised to a fraction of the sprite. */
+export const CURSORS = ${lit(CURSORS)} as const;
+
export const TRANSPORT = ${lit(TRANSPORT)} as const;
export const TOOLBAR = ${lit(TOOLBAR)} as const;
diff --git a/website/src/components/Recreation/generated.ts b/website/src/components/Recreation/generated.ts
index 6cd800ffc..8945efb58 100644
--- a/website/src/components/Recreation/generated.ts
+++ b/website/src/components/Recreation/generated.ts
@@ -639,6 +639,96 @@ export const CONTROLS = {
}
} as const;
+/** The cursor packs the picker shows, each with the application's own hotspot,
+ * normalised to a fraction of the sprite. */
+export const CURSORS = {
+ "themeCount": 18,
+ "themes": [
+ {
+ "id": "default",
+ "name": "Default",
+ "hotspotX": 0.119,
+ "hotspotY": 0.0874,
+ "src": "/img/cursors/00-arrow.png"
+ },
+ {
+ "id": "pink-glossy-arrow-and-hand-3d",
+ "name": "Pink Glossy Arrow & Hand 3D",
+ "hotspotX": 0.0469,
+ "hotspotY": 0.0469,
+ "src": "/img/cursors/01-arrow.png"
+ },
+ {
+ "id": "spring-gradient",
+ "name": "Spring Gradient",
+ "hotspotX": 0.0469,
+ "hotspotY": 0.5,
+ "src": "/img/cursors/02-arrow.png"
+ },
+ {
+ "id": "black-and-rainbow-stroke-gradient-animated",
+ "name": "Black & Rainbow Stroke Gradient Animated",
+ "hotspotX": 0.05,
+ "hotspotY": 0.96,
+ "src": "/img/cursors/03-arrow.png"
+ },
+ {
+ "id": "among-us-sus-knife-and-red-animated",
+ "name": "Among Us Sus Knife & Red Animated",
+ "hotspotX": 0.1531,
+ "hotspotY": 0.1016,
+ "src": "/img/cursors/04-arrow.png"
+ },
+ {
+ "id": "hollow-knight-and-game-arrow",
+ "name": "Hollow Knight & Game Arrow",
+ "hotspotX": 0.5,
+ "hotspotY": 0.5,
+ "src": "/img/cursors/05-arrow.png"
+ },
+ {
+ "id": "mickey-mouse-black-hand-inflated-glove",
+ "name": "Mickey Mouse Black Hand Inflated Glove",
+ "hotspotX": 0.0781,
+ "hotspotY": 0.5,
+ "src": "/img/cursors/06-arrow.png"
+ },
+ {
+ "id": "sanrio-kuromi-skull-arrow",
+ "name": "Sanrio Kuromi Skull Arrow",
+ "hotspotX": 0.0469,
+ "hotspotY": 0.5,
+ "src": "/img/cursors/07-arrow.png"
+ },
+ {
+ "id": "old-roblox",
+ "name": "Old Roblox",
+ "hotspotX": 0.0781,
+ "hotspotY": 0.0469,
+ "src": "/img/cursors/08-arrow.png"
+ },
+ {
+ "id": "pokemon-neon-gengar",
+ "name": "Pokemon Neon Gengar",
+ "hotspotX": 1,
+ "hotspotY": 0.5,
+ "src": "/img/cursors/09-arrow.png"
+ }
+ ],
+ "pointer": {
+ "name": "Default",
+ "hotspotX": 0.3893,
+ "hotspotY": 0.0032,
+ "src": "/img/cursors/mac-pointer.png"
+ },
+ "text": {
+ "name": "Default",
+ "hotspotX": 0.4375,
+ "hotspotY": 0.5333,
+ "src": "/img/cursors/mac-text.png"
+ }
+} as const;
+
export const TRANSPORT = {
"restCurrent": "0:17.5",
"endCurrent": "0:24.3",
diff --git a/website/static/img/cursors/00-arrow.png b/website/static/img/cursors/00-arrow.png
new file mode 100644
index 000000000..85998081e
Binary files /dev/null and b/website/static/img/cursors/00-arrow.png differ
diff --git a/website/static/img/cursors/01-arrow.png b/website/static/img/cursors/01-arrow.png
new file mode 100644
index 000000000..69ecd5b19
Binary files /dev/null and b/website/static/img/cursors/01-arrow.png differ
diff --git a/website/static/img/cursors/02-arrow.png b/website/static/img/cursors/02-arrow.png
new file mode 100644
index 000000000..51889625d
Binary files /dev/null and b/website/static/img/cursors/02-arrow.png differ
diff --git a/website/static/img/cursors/03-arrow.png b/website/static/img/cursors/03-arrow.png
new file mode 100644
index 000000000..adfcec8dc
Binary files /dev/null and b/website/static/img/cursors/03-arrow.png differ
diff --git a/website/static/img/cursors/04-arrow.png b/website/static/img/cursors/04-arrow.png
new file mode 100644
index 000000000..84e9a3b34
Binary files /dev/null and b/website/static/img/cursors/04-arrow.png differ
diff --git a/website/static/img/cursors/05-arrow.png b/website/static/img/cursors/05-arrow.png
new file mode 100644
index 000000000..efb4b7708
Binary files /dev/null and b/website/static/img/cursors/05-arrow.png differ
diff --git a/website/static/img/cursors/06-arrow.png b/website/static/img/cursors/06-arrow.png
new file mode 100644
index 000000000..143076372
Binary files /dev/null and b/website/static/img/cursors/06-arrow.png differ
diff --git a/website/static/img/cursors/07-arrow.png b/website/static/img/cursors/07-arrow.png
new file mode 100644
index 000000000..6fe7e89d6
Binary files /dev/null and b/website/static/img/cursors/07-arrow.png differ
diff --git a/website/static/img/cursors/08-arrow.png b/website/static/img/cursors/08-arrow.png
new file mode 100644
index 000000000..a55875df9
Binary files /dev/null and b/website/static/img/cursors/08-arrow.png differ
diff --git a/website/static/img/cursors/09-arrow.png b/website/static/img/cursors/09-arrow.png
new file mode 100644
index 000000000..4dcccb360
Binary files /dev/null and b/website/static/img/cursors/09-arrow.png differ
diff --git a/website/static/img/cursors/mac-pointer.png b/website/static/img/cursors/mac-pointer.png
new file mode 100644
index 000000000..a89d388bf
Binary files /dev/null and b/website/static/img/cursors/mac-pointer.png differ
diff --git a/website/static/img/cursors/mac-text.png b/website/static/img/cursors/mac-text.png
new file mode 100644
index 000000000..27a5e5ef9
Binary files /dev/null and b/website/static/img/cursors/mac-text.png differ
diff --git a/website/static/img/walkthrough/canvas-bg-1.jpg b/website/static/img/walkthrough/canvas-bg-1.jpg
new file mode 100644
index 000000000..7b19f1735
Binary files /dev/null and b/website/static/img/walkthrough/canvas-bg-1.jpg differ
diff --git a/website/static/img/walkthrough/canvas-bg-a.jpg b/website/static/img/walkthrough/canvas-bg-2.jpg
similarity index 100%
rename from website/static/img/walkthrough/canvas-bg-a.jpg
rename to website/static/img/walkthrough/canvas-bg-2.jpg
diff --git a/website/static/img/walkthrough/canvas-bg-3.jpg b/website/static/img/walkthrough/canvas-bg-3.jpg
new file mode 100644
index 000000000..8fb808407
Binary files /dev/null and b/website/static/img/walkthrough/canvas-bg-3.jpg differ
diff --git a/website/static/img/walkthrough/canvas-bg-4.jpg b/website/static/img/walkthrough/canvas-bg-4.jpg
new file mode 100644
index 000000000..958b4b2f4
Binary files /dev/null and b/website/static/img/walkthrough/canvas-bg-4.jpg differ
diff --git a/website/static/img/walkthrough/canvas-bg-b.jpg b/website/static/img/walkthrough/canvas-bg-b.jpg
deleted file mode 100644
index afeaff74c..000000000
Binary files a/website/static/img/walkthrough/canvas-bg-b.jpg and /dev/null differ
diff --git a/website/static/img/walkthrough/canvas-poster.jpg b/website/static/img/walkthrough/canvas-poster.jpg
new file mode 100644
index 000000000..4e3a4d68b
Binary files /dev/null and b/website/static/img/walkthrough/canvas-poster.jpg differ
diff --git a/website/static/img/walkthrough/fixture-page.jpg b/website/static/img/walkthrough/fixture-page.jpg
deleted file mode 100644
index ebdb03087..000000000
Binary files a/website/static/img/walkthrough/fixture-page.jpg and /dev/null differ