Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
perf(website): unpack two cursors from the stylesheet, and stop easing an ease
Etienne Lescot8328c3c0d00a
diff --git a/website/src/components/Recreation/driver.ts b/website/src/components/Recreation/driver.tsindex c26fcf8d2..57da2b4ac 100644--- a/website/src/components/Recreation/driver.ts+++ b/website/src/components/Recreation/driver.ts@@ -273,10 +273,10 @@ export function attachDriver(refs: DriverRefs, cls: DriverClasses): () => void {cam.preload = "auto";cam.load();};- cam.addEventListener("loadeddata", () => {+ const onCamLoaded = () => {camReady = true;- });- cam.addEventListener("seeked", () => {+ };+ const onCamSeeked = () => {if (camPending !== undefined) {const q = camPending;camPending = undefined;@@ -286,7 +286,9 @@ export function attachDriver(refs: DriverRefs, cls: DriverClasses): () => void {// A seek past a not-yet-buffered range throws; the next frame retries.}}- });+ };+ cam.addEventListener("loadeddata", onCamLoaded);+ cam.addEventListener("seeked", onCamSeeked);const seekCam = (tf: number) => {if (!camReady || cam.readyState < 2) return;const dur = Number.isFinite(cam.duration) && cam.duration > 0 ? cam.duration : 10;@@ -429,20 +431,37 @@ export function attachDriver(refs: DriverRefs, cls: DriverClasses): () => void {onScroll();};+ let detached = false;+measure();// Targets inside a closed pane cannot be measured until it opens, and the// panes open on scroll — so re-measure once the fonts have settled, which is// also when the transcript's words stop moving.- document.fonts?.ready.then(measure).catch(() => {- // A font that never resolves leaves the first measurement standing.- });+ //+ // Guarded: the driver re-attaches whenever a SCENE_QUERIES breakpoint is+ // crossed, and by then `fonts.ready` is already resolved, so an unguarded+ // `.then` runs a second full measuring pass — five panes opened and closed —+ // for a driver that has since been thrown away.+ document.fonts?.ready+ .then(() => {+ if (!detached) measure();+ })+ .catch(() => {+ // A font that never resolves leaves the first measurement standing.+ });window.addEventListener("scroll", onScroll, { passive: true });window.addEventListener("resize", onResize);onScroll();return () => {+ detached = true;window.removeEventListener("scroll", onScroll);window.removeEventListener("resize", onResize);+ // The video outlives the driver — it is the same element on re-attach —+ // so listeners left on it accumulate one pair per breakpoint crossing,+ // each holding a dead driver's closure alive.+ cam.removeEventListener("loadeddata", onCamLoaded);+ cam.removeEventListener("seeked", onCamSeeked);if (raf) cancelAnimationFrame(raf);};}diff --git a/website/src/components/Recreation/index.tsx b/website/src/components/Recreation/index.tsxindex cc57a5f63..d68d79408 100644--- a/website/src/components/Recreation/index.tsx+++ b/website/src/components/Recreation/index.tsx@@ -160,7 +160,21 @@ export default function Recreation() {return (<section className={styles.band} ref={band} data-recreation="">- <div className={styles.stage} ref={root}>+ {/* The two cursor sprites are set here rather than in the stylesheet: a+ url() inside a CSS module is inlined by webpack as a data URI, and+ these two came to a quarter of the site's only render-blocking+ resource — paid for on every docs page, which have no stage on them.+ The driver writes both properties onto this same element. */}+ <div+ className={styles.stage}+ ref={root}+ style={+ {+ "--shot-cursor": 'url("/img/cursors/01-arrow.png")',+ "--ui-cursor": 'url("/img/cursors/00-arrow.png")',+ } as React.CSSProperties+ }+ >{/* ═══ THE CAPTIONS ═══ The section's real copy. Above the gate theyshare one box and take turns; below it they stack. */}<div className={styles.captions}>diff --git a/website/src/components/Recreation/styles.module.css b/website/src/components/Recreation/styles.module.cssindex 2e2af84ca..473aeb3f1 100644--- a/website/src/components/Recreation/styles.module.css+++ b/website/src/components/Recreation/styles.module.css@@ -102,10 +102,15 @@--zoom: 1;--zoom-origin: 52% 58%;--zoom-active: 0;+ /* --shot-cursor and --ui-cursor are set inline on this element in+ index.tsx, not here. Webpack inlines a small url() referenced from a+ stylesheet as a data URI, and these two sprites came to 9,139 gzipped+ bytes — a quarter of the site's only render-blocking resource, carried+ by every docs page, none of which has a .stage on it. The driver writes+ both properties to this same element's inline style anyway. */--shot-x: 48;--shot-y: 56;--shot-bounce: 1;- --shot-cursor: url("/img/cursors/01-arrow.png");--shot-hx: 4.69;--shot-hy: 4.69;--page-y: -8;@@ -113,7 +118,6 @@--ui-y: 45;--ui-bounce: 1;--ui-on: 0;- --ui-cursor: url("/img/cursors/00-arrow.png");--ui-hx: 11.9;--ui-hy: 8.74;--zooms-placed: 3;@@ -942,9 +946,10 @@--vis: min(var(--open), var(--shut));opacity: var(--vis);transform: scale(calc(0.82 + var(--vis) * 0.18));- transition:- opacity 0.25s var(--ease),- transform 0.3s var(--ease);+ /* No transition. --vis is min() of two clamp() ramps off --tf, which the+ driver rewrites every rAF, so the `* 8` in those clamps IS the ease;+ a transition on top of it eases an eased value and lands late. Same bug+ as --tl on .floor and the panel, twice post-mortemed. */}.appSetup,