the CSS background color of the parent element that holds the canvas.
Applied during initialization to prevent a white flash before the first render.
Set to "transparent" to disable, or any valid CSS color value.
Optionalbatcher?: new (renderer: any) => Batchera custom batcher class (WebGL only)
the default blend mode to use ("normal", "multiply", "lighter", "additive", "screen")
Optionalcompositor?: new (renderer: any) => Batchera custom batcher class (WebGL only)
whether to display melonJS version and basic device information in the console
if true, the renderer will fail if the browser reports a major performance caveat (e.g. software WebGL). Set to false to allow WebGL on machines with blocklisted GPU drivers or software renderers.
Enable the WebGL2 procedural shader path for orthogonal tile layers.
When true (default), eligible layers render via a single quad per
tileset + a fragment shader doing per-fragment GID lookup, bypassing
the per-tile draw loop entirely. Layers that don't qualify
(Canvas/WebGL1, non-orthogonal, collection-of-image tilesets,
tilerendersize "grid", non-zero tileoffset, oversampled beyond the
shader's overflow window) fall back to the legacy path automatically.
Set to false to disable globally.
enable high precision shaders (WebGL only). When false, shaders prefer "mediump" precision for better performance on some mobile GPUs, falling back to "lowp" if "mediump" is not supported. When true (default), the highest precision supported by the device is used. This setting is ignored by the Canvas renderer.
whether to enable legacy mode (enables deprecated video.init() entry point)
The physics system to use. Accepts:
"builtin" (default) — the built-in SAT physics adapter"none" — disables physics; World.step skips the simulation,
the world container behaves like a pure scene graphPhysicsAdapter instance — e.g. new MatterAdapter() from
@melonjs/matter-adapter, or any third-party adapter{ adapter: PhysicsAdapter } — explicit form, reserved for
future per-app physics optionsThe adapter's physicLabel becomes world.physic so user code
can branch on the active engine without importing the concrete
adapter class (app.world.physic === "matter", etc.).
a hint to the user agent indicating what configuration of GPU is suitable for the WebGL context. To be noted that Safari and Chrome (since version 80) both default to "low-power" to save battery life and improve the user experience on these dual-GPU machines.
if true the renderer will only use WebGL 1
renderer to use (CANVAS, WEBGL, AUTO), or a custom renderer class
enable scaling of the canvas ('auto' for automatic scaling)
screen scaling modes
the HTML Element to be used as the reference target when using automatic scaling (by default melonJS will use the parent container of the div element containing the canvas)
whether to enable sub-pixel rendering (avoid sprite flickering when using transforms)
whether to allow transparent pixels in the front buffer (screen).
whether to enable verbose mode (additional console output for debugging)
Optionalcanvas?: neverthe DOM parent element (or its string ID) to hold the canvas in the HTML file
an existing canvas element to use as the renderer target (by default melonJS will create its own canvas based on given parameters)
Optionalparent?: never
whether to enable or not video scaling interpolation