> ## Documentation Index
> Fetch the complete documentation index at: https://glassen.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Render a nested bubble scene

> Mount the included nested glass composition, initialize its separate Rapier WASM module and choose automatic playback or deterministic frame stepping.

The nested entry point renders the included bubble composition using a separate Rust/Rapier simulation. It is a fixed composition API, not a general tree of arbitrary React children or nested meshes.

```js theme={null}
import { createNestedOrbScene, initNestedGlass } from 'glassen/nested'
import lens from 'glassen/wasm/goo_core_bg.wasm?url'
import scene from 'glassen/wasm/nested_scene_bg.wasm?url'

await initNestedGlass({ lens, scene })
const nested = await createNestedOrbScene(canvas, {
  seed: 7341,
  speed: 0.6,
  onError: console.error,
})
// nested.update({ speed: 0.4, playing: true })
// nested.destroy()
```

Give the canvas a CSS width. The renderer derives its aspect ratio from the scene. Defaults are `seed: 7341`, `speed: 0.6` and `playing: true`. Hidden/offscreen playback pauses; reduced-motion preferences stop automatic advancement.

For a host-controlled clock, call `nested.draw(elapsedSeconds)`. This stops automatic playback, advances the simulation by the supplied duration and renders once. It is an incremental step, not a seek to an absolute timestamp. Recreate the scene with the same seed to reset it.

```jsx theme={null}
import { NestedOrbs } from 'glassen/nested/react'

<NestedOrbs seed={7341} speed={0.6} style={{ width: '100%' }} />
```

The React wrapper also accepts `playing`, `className` and `onError`. It releases the scene on unmount. The single-lens entry point does not import or initialize this physics module.

`nested.stats` reports frames, instances, CPU submission, interval, texture storage, targets, draw calls, copied pixels and allocations. These are diagnostic counters; they do not establish displayed FPS.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.