animations on page: 0
advancing right now: 0
WebGL contexts: 1

← main demo

Many animations, one WebGL context

Every animation on this page is an <ss-player> element sitting in normal document flow. None of them owns a canvas. Scroll — they follow their elements, and the counter never moves off one.

A block-level element. The animation is fitted into its box.

Why this matters

Browsers allow only about 8–16 live WebGL contexts per page. A player that owns its canvas therefore runs out at roughly a dozen: past the cap the browser drops the oldest context and that canvas simply goes blank. This page would have hit that limit before you finished scrolling it.

Instead a single SSOverlay holds one transparent, full-viewport canvas behind the article. Each element registers with it and gets an SSPlayer; every frame the overlay reads the element rects and writes them into the players' boxes so each animation is drawn where its element is. Elements stay plain boxes, and they can sit inline in a sentence like that one.

<ss-player src="chara.ssab" autoplay></ss-player>

// that is the whole page-author API — the overlay is created on first use.
// Opt out per element when you need a private context:
<ss-player src="chara.ssab" standalone></ss-player>

Off-screen animations stop

The overlay watches each element with an IntersectionObserver and skips players whose element has scrolled away — no timeline advance, no draw. Gating on the canvas instead would be useless here, since the overlay canvas always covers the viewport.

Each animation prints its current frame underneath. Scroll one until it leaves the viewport and the number stops changing; the HUD's advancing right now count drops at the same moment. Scroll back and it picks up from where it stopped.

What you give up

The overlay is one canvas at one place in the stacking order, so page content cannot be interleaved between two overlay animations, and clipping is a plain rectangle — border-radius, clip-path and CSS filters on the element do not shape the animation. Blend modes composite against the transparent overlay rather than against the page.

When any of that matters for one element, give it standalone and it gets its own canvas and context back — at the usual cost of one.

Still the same context as everything above.

Keep scrolling

The rest of these exist only to push the count up. Watch the HUD: the animation count climbs, the context count does not.

One canvas has been drawing every animation on this page the whole way down.