Reference · Playable surface mazes
mountSolidfunction
Draw a maze over a solid into host and play it. Returns the handle that drives it, or null for a recipe that is none.
Import it
import { mountSolid } from "@johnmorrisdotca/meikyuu/3d/play";
Definition
function mountSolid(host: HTMLElement, options: SolidMountOptions): SolidMount | null
Parameters
| Name | Type | Description |
|---|---|---|
host | HTMLElement | The DOM host receiving the native player or styles. |
options | SolidMountOptions | Native display/mount choices, or the point tuple specified by this signature. |
Returns
SolidMount | null
The native surface player, or null for invalid recipe or a view that cannot be mounted.
Examples
import type { MazeRecipe } from "@johnmorrisdotca/meikyuu";
import { buildMaze } from "@johnmorrisdotca/meikyuu";
import type { SolidRecipe } from "@johnmorrisdotca/meikyuu/3d";
import { mountSolid } from "@johnmorrisdotca/meikyuu/3d/play";
const recipe: MazeRecipe = {shape:"square",w:5,h:5,algorithm:"backtracker",mode:"to-goal",seed:42};
const maze = buildMaze(recipe);
const grid = maze.grid;
const solidRecipe: SolidRecipe = {kind:"cube",n:2,algorithm:"backtracker",seed:42};
const host = document.createElement("div");
document.body.append(host);
const player = mountSolid(host,{recipe:solidRecipe});
console.log(player?.maze().grid.cells);
player?.destroy();