ARButton.html 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>ARButton - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <h1 translate="no">ARButton</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>A utility class for creating a button that allows to initiate
  16. immersive AR sessions based on WebXR. The button can be created
  17. with a factory method and then appended ot the website's DOM.</p></div>
  18. <h2>Code Example</h2>
  19. <div translate="no"><pre><code class="language-js">document.body.appendChild( ARButton.createButton( renderer ) );
  20. </code></pre></div>
  21. </header>
  22. <article>
  23. <h2 class="subsection-title">Import</h2>
  24. <p><span translate="no">ARButton</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank" rel="noopener">Installation#Addons</a>.</p>
  25. <pre><code class="language-js">import { ARButton } from 'three/addons/webxr/ARButton.js';</code></pre>
  26. <div class="container-overview">
  27. <div class="method">
  28. </div>
  29. </div>
  30. <h2 class="subsection-title">Static Methods</h2>
  31. <h3 class="name name-method" id=".createButton" translate="no">.<a href="#.createButton">createButton</a><span class="signature">( renderer : <span class="param-type"><a href="WebGLRenderer.html">WebGLRenderer</a> | <a href="WebGPURenderer.html">WebGPURenderer</a></span>, sessionInit : <span class="param-type">XRSessionInit</span> )</span><span class="type-signature"> : HTMLElement</span> </h3>
  32. <div class="method">
  33. <div class="description">
  34. <p>Constructs a new AR button.</p>
  35. </div>
  36. <table class="params">
  37. <tbody>
  38. <tr>
  39. <td class="name">
  40. <strong>renderer</strong>
  41. </td>
  42. <td class="description last">
  43. <p>The renderer.</p>
  44. </td>
  45. </tr>
  46. <tr>
  47. <td class="name">
  48. <strong>sessionInit</strong>
  49. </td>
  50. <td class="description last">
  51. <p>The a configuration object for the AR session.</p>
  52. </td>
  53. </tr>
  54. </tbody>
  55. </table>
  56. <dl class="details">
  57. <dt class="tag-returns"><strong>Returns:</strong> The button or an error message if <code>immersive-ar</code> isn't supported.</dt>
  58. </dl>
  59. </div>
  60. <h2 class="subsection-title">Source</h2>
  61. <p>
  62. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/webxr/ARButton.js" translate="no" target="_blank" rel="noopener">examples/jsm/webxr/ARButton.js</a>
  63. </p>
  64. </article>
  65. </section>
  66. <script src="../scripts/linenumber.js"></script>
  67. <script src="../scripts/page.js"></script>
  68. </body>
  69. </html>
粤ICP备19079148号