Global count of active animations (internal + external).
Incremented by AnimationManager when an internal animation starts, decremented when it stops. External animation libraries (e.g. AnimeJS, GSAP) increment/decrement this counter via RendererMain.registerAnimation / RendererMain.unregisterAnimation.
Used by the render loop to throttle texture uploads during animations:
while > 0, at most maxTextureUploadsDuringAnimation textures are
uploaded per frame to preserve the frame budget. When zero, the full
time budget is used.
ReadonlyanimationReadonlybufferReadonlycalculateReadonlydefaultReadonlydefReadonlyeventRenderer Event Bus for the Stage to emit events onto
ReadonlyfontReadonlyinteractiveReadonlyplatformReadonlyreadyResolves after the first frame has been drawn.
ReadonlyrendererReadonlyrootReadonlyshTarget frame time in milliseconds (calculated from targetFPS)
ReadonlytextReadonlytxReadonlytxWalk a node's subtree and feed quads + stencil clip ops to the active renderer without touching the cached render list.
Root of the subtree to render
Create default PixelTexture
Start a new frame draw
Initialize a text engine on first use.
Emit all queued frame events
This method should be called after the frame has been rendered to emit all events that were queued during the frame.
App-facing (fpsUpdate, quadsUpdate, criticalCleanup*): each event
is fanned out via emitSafe, so one bad listener neither blocks the
remaining listeners nor the remaining queued events, and never kills rAF.
See queueFrameEvent for more information.
Check if the scene has updates
Register a font using a specific text renderer type
The type of text renderer ('canvas', 'sdf', etc.)
Font loading options specific to the renderer type
Promise that resolves when the font is registered
This method allows consumers to explicitly register fonts for a specific text renderer type (e.g., 'canvas', 'sdf'). Consumers must specify the renderer type to ensure fonts are loaded with the correct pipeline.
Registration only stores where to find the font — no fetch, decode, or GPU upload happens here. Loading starts automatically on first use of the font family (or via preloadFont for eager loading), so registered fonts that are never rendered cost nothing.
For Canvas fonts, provide fontUrl (e.g., .ttf, .woff, .woff2) For SDF fonts, provide atlasUrl (image) and atlasDataUrl (JSON glyph data)
Eagerly load a font, resolving only after it is renderable.
The type of text renderer ('canvas', 'sdf', etc.)
Font loading options specific to the renderer type
Promise that resolves when the font is loaded
Unlike loadFont (register-only), this fetches, decodes, and uploads the font immediately. Use when first-paint readiness of a font must be guaranteed (e.g. awaited before drawing).
Queue an event to be emitted after the current/next frame is rendered
When we are operating in the context of the render loop, we may want to emit events that are related to the current frame. However, we generally do NOT want to emit events directly in the middle of the render loop, since this could enable event handlers to modify the scene graph and cause unexpected behavior. Instead, we queue up events to be emitted and then flush the queue after the frame has been rendered.
Request a render pass without forcing an update
ProtectedresolveResolves the default property values for a Node
Given a font name, and possible renderer override, return the best compatible text renderer.
Will try to return a canvas renderer if no other suitable renderer can be resolved.
As a side effect the returned engine is initialized (see ensureTextEngineInitialized) and a load of the requested font family is kicked off when the handler supports it, so the first text node warms everything its first frame needs.
Update animations
Update the target frame time based on the current targetFPS setting
Update the viewport bounds
Stage constructor