mountSolid関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
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 { mountSolid } from "@johnmorrisdotca/meikyuu/3d/play";
定義
function mountSolid(host: HTMLElement, options: SolidMountOptions): SolidMount | null
引数
| 名前 | 型 | 説明 |
|---|---|---|
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. |
戻り値
SolidMount | null
The native surface player, or null for invalid recipe or a view that cannot be mounted.
例
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();この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。