Skip to Content
Neshel-UI
Animations (experimental)

Performance

What each kind of effect costs, lazy activation, limits, budgets and measuring.

Experimental and not on npm

@neshel-ui/animations is a private package (0.0.0). It cannot be installed, and its API may change before a first publication. These pages document what exists in the repository.

Each effect page says what the effect writes. From the least to the most expensive:

KindCost while it runsExamples
ObserversNothing per frameIn view, section spy, stuck state
Layers rendered by CSSCompositor or small paints; nothing in JavaScriptSpinner, aurora, border sweep
Transform and opacityOne write per element and frameEntrance, hover, drag, parallax
Custom property or paintRepaints the elementClip reveal, highlighter, path draw
Split textOne write, plus CSS per pieceText reveal, wave
HeightReflows what is belowAuto height, collapse
Filter and backdrop-filterFull area, every frameTurbulence, tilt shift
Canvas 2D, WebGL2Draws a surface; memory for the surface and its texturesParticles, page curl

Rules of thumb

  • Animate few, small things. Ten large blurred surfaces cost more than a hundred transforms.
  • Attach expensive effects only near the viewport with lazyEffect.
  • Split long texts by word or line. Text reveal and wave limit pieces to 200 by default and fall back to a coarser split.
  • Nothing runs when nothing moves: the frame loop stops without tasks, ambient effects pause off screen and on hidden pages, GPU effects draw on change.
  • Do not combine setState with per-frame callbacks.

GPU budget

configureGpu limits a page: contexts (6 by default), pixel ratio (2), texture size and memory. An effect that gets no context shows the original content and reports mode and reason.

Bundle size

Import from the family path. Each family, and the common imports of each, has a size budget checked in CI from the packed tarball; families do not import each other, and the GPU layer is never loaded unless you import it.

Measure

Use your browser's performance panel with your own content and a slow device. The repository contains local benchmarks (pnpm bench:animations:*); they are observations of one machine, not guarantees.

Edit on GitHub

On this page