babylonjs note 02 using babylon viewer

64 阅读1分钟

babylon tag can be used display supported modal

pnpm i @babylonjs/viewer
import * as BabylonViewer from '@babylonjs/viewer';
<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <link rel="icon" type="image/svg+xml" href="/vite.svg" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Vite + TS</title>

    <style>
      html, body {
          overflow: hidden;
          width: 100%;
          height: 100%;
          margin: 0;
          padding: 0;
      }

      #renderCanvas {
          width: 100%;
          height: 100%;
          touch-action: none;
      }
      
      #canvasZone {
          width: 100%;
          height: 100%;
      }
  </style>
  </head>
  <body>
    <!-- <div id="canvasZone"><canvas id="renderCanvas"></canvas></div> -->
    <babylon id="babylon-viewer" camera.behaviors.auto-rotate="0"></babylon>
    <script type="module" src="/src/main.ts"></script>
  </body>
</html>

ref: