requestAnimationFrame(RAF)

requestAnimationFrame is a browser API that runs a function right before the browser paints the next frame of an animation. You call it once, it fires once, and calling it again inside the callback creates the loop — synced to your monitor's refresh rate (~60fps). Unlike setInterval, it pauses when the tab is hidden, never tears, and adapts to 120Hz displays automatically.

Animation libraries like Motion use it under the hood — animate() or useSpring is essentially a well-engineered RAF loop with physics and framerate-independence built in.

Terminal UIs

Brian Lovin built an excellent interactive explainer called How Terminals Work that breaks it all down.

Ink lets you build terminal UIs with React. It also has a UI library called ink-ui that you can use to build your own interactive terminal UIs.

Bonus find - ASCII Motion is a tool for creating terminal animations, built by Cameron Foxly, a Brand Designer at GitHub.