Skip to content

ThreeplayInit

Defined in: packages/threeplay/src/index.ts:10

Options of threeplay.

optional antialias?: boolean

Defined in: packages/threeplay/src/plugins/render/types.ts:58

Antialiasing (default true).

ThreeplayOpts.antialias


optional background?: ColorLike | null

Defined in: packages/threeplay/src/plugins/render/types.ts:52

Clear color (default a soft sky blue). null keeps the canvas transparent.

ThreeplayOpts.background


optional buttons?: Record<string, ButtonBinding>

Defined in: packages/threeplay/src/plugins/input/types.ts:40

Virtual buttons: { jump: { keyboard: ["space", "w"], gamepad: "south" } }. Merged over the defaults, which exist even if you pass nothing: left (arrows, A), right (arrows, D), up (arrows, W), down (arrows, S) and jump (space), each with its d-pad / south gamepad button. Redefining a name replaces its default binding entirely.

ThreeplayOpts.buttons


optional canvas?: HTMLCanvasElement

Defined in: packages/threeplay/src/plugins/render/types.ts:48

Draw into this canvas instead of creating one.

ThreeplayOpts.canvas


optional core?: PluginLike[]

Defined in: packages/threeplay/src/index.ts:15

Replaces the built-in plugin set. Leave it out to get every built-in plugin; pass a subset to build a smaller engine.


optional debug?: boolean

Defined in: packages/threeplay/src/plugins/debug/types.ts:12

Start with the inspector on.

ThreeplayOpts.debug


optional debugKey?: string | false

Defined in: packages/threeplay/src/plugins/debug/types.ts:10

Key that toggles the inspector (default "f1"; false disables it). Needs the input plugin (an optional dependency: without it the key does nothing). The browser default of the key is prevented while the canvas has focus (F1 would open help on Windows).

ThreeplayOpts.debugKey


optional fixedHz?: number

Defined in: packages/threeplay/src/core/types.ts:182

Fixed update rate in Hz, used by physics (default 50).

ThreeplayOpts.fixedHz


optional global?: boolean

Defined in: packages/threeplay/src/core/types.ts:178

Put the API on window like kaplay does (default true).

ThreeplayOpts.global


optional height?: number

Defined in: packages/threeplay/src/plugins/render/types.ts:44

ThreeplayOpts.height


optional letterbox?: boolean

Defined in: packages/threeplay/src/plugins/render/types.ts:46

Keep the aspect ratio with bars when scaling (default true with width/height).

ThreeplayOpts.letterbox


optional lighting?: "none" | "default"

Defined in: packages/threeplay/src/plugins/render/types.ts:62

"default" adds a hemisphere light and a sun with shadows; "none" adds nothing.

ThreeplayOpts.lighting


optional loop?: "auto" | "manual"

Defined in: packages/threeplay/src/core/types.ts:184

"auto" drives the loop with requestAnimationFrame; "manual" waits for k.step(dt).

ThreeplayOpts.loop


optional maxDt?: number

Defined in: packages/threeplay/src/core/types.ts:186

Largest frame delta in seconds; longer frames are clamped (default 0.1).

ThreeplayOpts.maxDt


optional physics?: boolean | { gravity?: number | Vec3Like; }

Defined in: packages/threeplay/src/plugins/physics/types.ts:189

false disables physics (Rapier is not downloaded). Default true.

ThreeplayOpts.physics


optional pixelRatio?: number

Defined in: packages/threeplay/src/plugins/render/types.ts:56

Device pixel ratio cap (default Math.min(devicePixelRatio, 2)).

ThreeplayOpts.pixelRatio


optional plugins?: PluginLike[]

Defined in: packages/threeplay/src/core/types.ts:180

Extra plugins, installed after the built-in ones.

ThreeplayOpts.plugins


optional renderer?: "auto" | RendererKind

Defined in: packages/threeplay/src/plugins/render/types.ts:54

"auto" (WebGPU with WebGL2 fallback, default), "webgpu", "webgl" or "none" (headless).

ThreeplayOpts.renderer


optional root?: HTMLElement

Defined in: packages/threeplay/src/plugins/render/types.ts:50

Element that receives the canvas and overlays (default document.body).

ThreeplayOpts.root


optional shadows?: boolean

Defined in: packages/threeplay/src/plugins/render/types.ts:60

Shadow maps (default true).

ThreeplayOpts.shadows


optional width?: number

Defined in: packages/threeplay/src/plugins/render/types.ts:43

Logical width. With width and height the game thinks in a fixed size (HUD coordinates, aspect) and the canvas is scaled to the container. Without them the canvas fills the container and the logical size follows it.

ThreeplayOpts.width