10LOC

#rendering

Web Platformintermediate

Use requestVideoFrameCallback for smooth animation timing

type RvfcVideo = HTMLVideoElement & {
  requestVideoFrameCallback: (cb: (now: number, meta: { mediaTime: number }) => void) => number;
  cancelVideoFrameCallback: (handle: number) => void;
};

Schedule visual work with the browser's video frame callback for smoother rendering.

Chrome APIsintermediate

content-visibility: auto to skip render cost offscreen

.long-page section {
  content-visibility: auto;
  contain-intrinsic-size: auto 480px;
}

content-visibility: auto skips layout, style, and paint for an off-screen subtree — near-free virtualization that keeps find-in-page and anchors working.