ThreeplayInit
Defined in: packages/threeplay/src/index.ts:10
Options of threeplay.
Extends
Section titled “Extends”Properties
Section titled “Properties”antialias?
Section titled “antialias?”
optionalantialias?:boolean
Defined in: packages/threeplay/src/plugins/render/types.ts:58
Antialiasing (default true).
Inherited from
Section titled “Inherited from”background?
Section titled “background?”
optionalbackground?:ColorLike|null
Defined in: packages/threeplay/src/plugins/render/types.ts:52
Clear color (default a soft sky blue). null keeps the canvas transparent.
Inherited from
Section titled “Inherited from”buttons?
Section titled “buttons?”
optionalbuttons?: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.
Inherited from
Section titled “Inherited from”canvas?
Section titled “canvas?”
optionalcanvas?:HTMLCanvasElement
Defined in: packages/threeplay/src/plugins/render/types.ts:48
Draw into this canvas instead of creating one.
Inherited from
Section titled “Inherited from”
optionalcore?: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.
debug?
Section titled “debug?”
optionaldebug?:boolean
Defined in: packages/threeplay/src/plugins/debug/types.ts:12
Start with the inspector on.
Inherited from
Section titled “Inherited from”debugKey?
Section titled “debugKey?”
optionaldebugKey?: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).
Inherited from
Section titled “Inherited from”fixedHz?
Section titled “fixedHz?”
optionalfixedHz?:number
Defined in: packages/threeplay/src/core/types.ts:182
Fixed update rate in Hz, used by physics (default 50).
Inherited from
Section titled “Inherited from”global?
Section titled “global?”
optionalglobal?:boolean
Defined in: packages/threeplay/src/core/types.ts:178
Put the API on window like kaplay does (default true).
Inherited from
Section titled “Inherited from”height?
Section titled “height?”
optionalheight?:number
Defined in: packages/threeplay/src/plugins/render/types.ts:44
Inherited from
Section titled “Inherited from”letterbox?
Section titled “letterbox?”
optionalletterbox?:boolean
Defined in: packages/threeplay/src/plugins/render/types.ts:46
Keep the aspect ratio with bars when scaling (default true with width/height).
Inherited from
Section titled “Inherited from”lighting?
Section titled “lighting?”
optionallighting?:"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.
Inherited from
Section titled “Inherited from”
optionalloop?:"auto"|"manual"
Defined in: packages/threeplay/src/core/types.ts:184
"auto" drives the loop with requestAnimationFrame; "manual" waits for k.step(dt).
Inherited from
Section titled “Inherited from”maxDt?
Section titled “maxDt?”
optionalmaxDt?:number
Defined in: packages/threeplay/src/core/types.ts:186
Largest frame delta in seconds; longer frames are clamped (default 0.1).
Inherited from
Section titled “Inherited from”physics?
Section titled “physics?”
optionalphysics?:boolean| {gravity?:number|Vec3Like; }
Defined in: packages/threeplay/src/plugins/physics/types.ts:189
false disables physics (Rapier is not downloaded). Default true.
Inherited from
Section titled “Inherited from”pixelRatio?
Section titled “pixelRatio?”
optionalpixelRatio?:number
Defined in: packages/threeplay/src/plugins/render/types.ts:56
Device pixel ratio cap (default Math.min(devicePixelRatio, 2)).
Inherited from
Section titled “Inherited from”plugins?
Section titled “plugins?”
optionalplugins?:PluginLike[]
Defined in: packages/threeplay/src/core/types.ts:180
Extra plugins, installed after the built-in ones.
Inherited from
Section titled “Inherited from”renderer?
Section titled “renderer?”
optionalrenderer?:"auto"|RendererKind
Defined in: packages/threeplay/src/plugins/render/types.ts:54
"auto" (WebGPU with WebGL2 fallback, default), "webgpu", "webgl" or "none" (headless).
Inherited from
Section titled “Inherited from”
optionalroot?:HTMLElement
Defined in: packages/threeplay/src/plugins/render/types.ts:50
Element that receives the canvas and overlays (default document.body).
Inherited from
Section titled “Inherited from”shadows?
Section titled “shadows?”
optionalshadows?:boolean
Defined in: packages/threeplay/src/plugins/render/types.ts:60
Shadow maps (default true).
Inherited from
Section titled “Inherited from”width?
Section titled “width?”
optionalwidth?: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.