Slide 10
Slide 10 text
シンプルなBabylon.jsコード(TypeScript)
import { Engine, MeshBuilder, Scene } from "@babylonjs/core";
const main = () => {
const renderCanvas = document.querySelector("#renderCanvas");
if (!renderCanvas) {
return;
}
const engine = new Engine(renderCanvas);
const scene = new Scene(engine);
scene.createDefaultCameraOrLight(true, true, true);
MeshBuilder.CreateBox("box", { size: 0.2 });
window.addEventListener("resize", () => engine.resize());
engine.runRenderLoop(() => scene.render());
};
main();
canvasを取得し、
engineやsceneを初期化して
サイズ0.2のCubeを表示する