PositionalAudioHelper.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>PositionalAudioHelper - 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. <p class="inheritance" translate="no"><a href="EventDispatcher.html">EventDispatcher</a> → <a href="Object3D.html">Object3D</a> → <a href="Line.html">Line</a> → </p>
  13. <h1 translate="no">PositionalAudioHelper</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>This helper displays the directional cone of a positional audio.</p>
  17. <p><code>PositionalAudioHelper</code> must be added as a child of the positional audio.</p></div>
  18. <h2>Code Example</h2>
  19. <div translate="no"><pre><code class="language-js">const positionalAudio = new THREE.PositionalAudio( listener );
  20. positionalAudio.setDirectionalCone( 180, 230, 0.1 );
  21. scene.add( positionalAudio );
  22. const helper = new PositionalAudioHelper( positionalAudio );
  23. positionalAudio.add( helper );
  24. </code></pre></div>
  25. </header>
  26. <article>
  27. <h2 class="subsection-title">Import</h2>
  28. <p><span translate="no">PositionalAudioHelper</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>
  29. <pre><code class="language-js">import { PositionalAudioHelper } from 'three/addons/helpers/PositionalAudioHelper.js';</code></pre>
  30. <div class="container-overview">
  31. <h2>Constructor</h2>
  32. <h3 class="name name-method" id="PositionalAudioHelper" translate="no">new <a href="#PositionalAudioHelper">PositionalAudioHelper</a><span class="signature">( audio : <span class="param-type"><a href="PositionalAudio.html">PositionalAudio</a></span>, range : <span class="param-type">number</span>, divisionsInnerAngle : <span class="param-type">number</span>, divisionsOuterAngle : <span class="param-type">number</span> )</span> </h3>
  33. <div class="method">
  34. <div class="description">
  35. <p>Constructs a new positional audio helper.</p>
  36. </div>
  37. <table class="params">
  38. <tbody>
  39. <tr>
  40. <td class="name">
  41. <strong>audio</strong>
  42. </td>
  43. <td class="description last">
  44. <p>The audio to visualize.</p>
  45. </td>
  46. </tr>
  47. <tr>
  48. <td class="name">
  49. <strong>range</strong>
  50. </td>
  51. <td class="description last">
  52. <p>The range of the directional cone.</p>
  53. <p>Default is <code>1</code>.</p>
  54. </td>
  55. </tr>
  56. <tr>
  57. <td class="name">
  58. <strong>divisionsInnerAngle</strong>
  59. </td>
  60. <td class="description last">
  61. <p>The number of divisions of the inner part of the directional cone.</p>
  62. <p>Default is <code>16</code>.</p>
  63. </td>
  64. </tr>
  65. <tr>
  66. <td class="name">
  67. <strong>divisionsOuterAngle</strong>
  68. </td>
  69. <td class="description last">
  70. <p>The number of divisions of the outer part of the directional cone.</p>
  71. <p>Default is <code>2</code>.</p>
  72. </td>
  73. </tr>
  74. </tbody>
  75. </table>
  76. </div>
  77. </div>
  78. <h2 class="subsection-title">Properties</h2>
  79. <div class="member">
  80. <h3 class="name" id="audio" translate="no">.<a href="#audio">audio</a><span class="type-signature"> : <a href="PositionalAudio.html">PositionalAudio</a></span> </h3>
  81. <div class="description">
  82. <p>The audio to visualize.</p>
  83. </div>
  84. </div>
  85. <div class="member">
  86. <h3 class="name" id="divisionsInnerAngle" translate="no">.<a href="#divisionsInnerAngle">divisionsInnerAngle</a><span class="type-signature"> : number</span> </h3>
  87. <div class="description">
  88. <p>The number of divisions of the inner part of the directional cone.</p>
  89. <p>Default is <code>16</code>.</p>
  90. </div>
  91. </div>
  92. <div class="member">
  93. <h3 class="name" id="divisionsOuterAngle" translate="no">.<a href="#divisionsOuterAngle">divisionsOuterAngle</a><span class="type-signature"> : number</span> </h3>
  94. <div class="description">
  95. <p>The number of divisions of the outer part of the directional cone.</p>
  96. <p>Default is <code>2</code>.</p>
  97. </div>
  98. </div>
  99. <div class="member">
  100. <h3 class="name" id="range" translate="no">.<a href="#range">range</a><span class="type-signature"> : number</span> </h3>
  101. <div class="description">
  102. <p>The range of the directional cone.</p>
  103. <p>Default is <code>1</code>.</p>
  104. </div>
  105. </div>
  106. <h2 class="subsection-title">Methods</h2>
  107. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  108. <div class="method">
  109. <div class="description">
  110. <p>Frees the GPU-related resources allocated by this instance. Call this
  111. method whenever this instance is no longer used in your app.</p>
  112. </div>
  113. </div>
  114. <h3 class="name name-method" id="update" translate="no">.<a href="#update">update</a><span class="signature">()</span> </h3>
  115. <div class="method">
  116. <div class="description">
  117. <p>Updates the helper. This method must be called whenever the directional cone
  118. of the positional audio is changed.</p>
  119. </div>
  120. </div>
  121. <h2 class="subsection-title">Source</h2>
  122. <p>
  123. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/helpers/PositionalAudioHelper.js" translate="no" target="_blank" rel="noopener">examples/jsm/helpers/PositionalAudioHelper.js</a>
  124. </p>
  125. </article>
  126. </section>
  127. <script src="../scripts/linenumber.js"></script>
  128. <script src="../scripts/page.js"></script>
  129. </body>
  130. </html>
粤ICP备19079148号