1
0

TextGeometry.html 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>TextGeometry - 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="BufferGeometry.html">BufferGeometry</a> → <a href="ExtrudeGeometry.html">ExtrudeGeometry</a> → </p>
  13. <h1 translate="no">TextGeometry</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A class for generating text as a single geometry. It is constructed by providing a string of text, and a set of
  17. parameters consisting of a loaded font and extrude settings.</p>
  18. <p>See the <a href="FontLoader.html">FontLoader</a> page for additional details.</p>
  19. <p><code>TextGeometry</code> uses <a href="http://gero3.github.io/facetype.js/" target="_blank" rel="noopener">typeface.json</a> generated fonts.
  20. Some existing fonts can be found located in <code>/examples/fonts</code>.</p></div>
  21. <h2>Code Example</h2>
  22. <div translate="no"><pre><code class="language-js">const loader = new FontLoader();
  23. const font = await loader.loadAsync( 'fonts/helvetiker_regular.typeface.json' );
  24. const geometry = new TextGeometry( 'Hello three.js!', {
  25. font: font,
  26. size: 80,
  27. depth: 5,
  28. curveSegments: 12
  29. } );
  30. </code></pre></div>
  31. </header>
  32. <article>
  33. <h2 class="subsection-title">Import</h2>
  34. <p><span translate="no">TextGeometry</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>
  35. <pre><code class="language-js">import { TextGeometry } from 'three/addons/geometries/TextGeometry.js';</code></pre>
  36. <div class="container-overview">
  37. <h2>Constructor</h2>
  38. <h3 class="name name-method" id="TextGeometry" translate="no">new <a href="#TextGeometry">TextGeometry</a><span class="signature">( text : <span class="param-type">string</span>, parameters : <span class="param-type"><a href="TextGeometry.html#~Options">TextGeometry~Options</a></span> )</span> </h3>
  39. <div class="method">
  40. <div class="description">
  41. <p>Constructs a new text geometry.</p>
  42. </div>
  43. <table class="params">
  44. <tbody>
  45. <tr>
  46. <td class="name">
  47. <strong>text</strong>
  48. </td>
  49. <td class="description last">
  50. <p>The text that should be transformed into a geometry.</p>
  51. </td>
  52. </tr>
  53. <tr>
  54. <td class="name">
  55. <strong>parameters</strong>
  56. </td>
  57. <td class="description last">
  58. <p>The text settings.</p>
  59. </td>
  60. </tr>
  61. </tbody>
  62. </table>
  63. </div>
  64. </div>
  65. <h2 class="subsection-title">Type Definitions</h2>
  66. <div class="member">
  67. <h3 class="name" id="~Options" translate="no">.<a href="#~Options">Options</a> </h3>
  68. <div class="description">
  69. <p>Represents the <code>options</code> type of the geometry's constructor.</p>
  70. </div>
  71. <table class="props">
  72. <tbody>
  73. <tr>
  74. <td class="name">
  75. <strong>font</strong>
  76. <br>
  77. <span class="param-type"><a href="Font.html">Font</a></span>
  78. </td>
  79. <td class="description last">
  80. <p>The font.</p>
  81. </td>
  82. </tr>
  83. <tr>
  84. <td class="name">
  85. <strong>size</strong>
  86. <br>
  87. <span class="param-type">number</span>
  88. </td>
  89. <td class="description last">
  90. <p>The text size.</p>
  91. <p>Default is <code>100</code>.</p>
  92. </td>
  93. </tr>
  94. <tr>
  95. <td class="name">
  96. <strong>depth</strong>
  97. <br>
  98. <span class="param-type">number</span>
  99. </td>
  100. <td class="description last">
  101. <p>Depth to extrude the shape.</p>
  102. <p>Default is <code>50</code>.</p>
  103. </td>
  104. </tr>
  105. <tr>
  106. <td class="name">
  107. <strong>curveSegments</strong>
  108. <br>
  109. <span class="param-type">number</span>
  110. </td>
  111. <td class="description last">
  112. <p>Number of points on the curves.</p>
  113. <p>Default is <code>12</code>.</p>
  114. </td>
  115. </tr>
  116. <tr>
  117. <td class="name">
  118. <strong>steps</strong>
  119. <br>
  120. <span class="param-type">number</span>
  121. </td>
  122. <td class="description last">
  123. <p>Number of points used for subdividing segments along the depth of the extruded spline.</p>
  124. <p>Default is <code>1</code>.</p>
  125. </td>
  126. </tr>
  127. <tr>
  128. <td class="name">
  129. <strong>bevelEnabled</strong>
  130. <br>
  131. <span class="param-type">boolean</span>
  132. </td>
  133. <td class="description last">
  134. <p>Whether to beveling to the shape or not.</p>
  135. <p>Default is <code>false</code>.</p>
  136. </td>
  137. </tr>
  138. <tr>
  139. <td class="name">
  140. <strong>bevelThickness</strong>
  141. <br>
  142. <span class="param-type">number</span>
  143. </td>
  144. <td class="description last">
  145. <p>How deep into the original shape the bevel goes.</p>
  146. <p>Default is <code>10</code>.</p>
  147. </td>
  148. </tr>
  149. <tr>
  150. <td class="name">
  151. <strong>bevelSize</strong>
  152. <br>
  153. <span class="param-type">number</span>
  154. </td>
  155. <td class="description last">
  156. <p>Distance from the shape outline that the bevel extends.</p>
  157. <p>Default is <code>8</code>.</p>
  158. </td>
  159. </tr>
  160. <tr>
  161. <td class="name">
  162. <strong>bevelOffset</strong>
  163. <br>
  164. <span class="param-type">number</span>
  165. </td>
  166. <td class="description last">
  167. <p>Distance from the shape outline that the bevel starts.</p>
  168. <p>Default is <code>0</code>.</p>
  169. </td>
  170. </tr>
  171. <tr>
  172. <td class="name">
  173. <strong>bevelSegments</strong>
  174. <br>
  175. <span class="param-type">number</span>
  176. </td>
  177. <td class="description last">
  178. <p>Number of bevel layers.</p>
  179. <p>Default is <code>3</code>.</p>
  180. </td>
  181. </tr>
  182. <tr>
  183. <td class="name">
  184. <strong>direction</strong>
  185. <br>
  186. <span class="param-type">string</span>
  187. </td>
  188. <td class="description last">
  189. <p>Char direction: ltr(left to right), rtl(right to left) &amp; tb(top bottom).</p>
  190. <p>Default is <code>'ltr'</code>.</p>
  191. </td>
  192. </tr>
  193. <tr>
  194. <td class="name">
  195. <strong>extrudePath</strong>
  196. <br>
  197. <span class="param-type"><a href="Curve.html">Curve</a></span>
  198. </td>
  199. <td class="description last">
  200. <p>A 3D spline path along which the shape should be extruded. Bevels not supported for path extrusion.</p>
  201. <p>Default is <code>null</code>.</p>
  202. </td>
  203. </tr>
  204. <tr>
  205. <td class="name">
  206. <strong>UVGenerator</strong>
  207. <br>
  208. <span class="param-type">Object</span>
  209. </td>
  210. <td class="description last">
  211. <p>An object that provides UV generator functions for custom UV generation.</p>
  212. </td>
  213. </tr>
  214. </tbody>
  215. </table>
  216. </div>
  217. <h2 class="subsection-title">Source</h2>
  218. <p>
  219. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/geometries/TextGeometry.js" translate="no" target="_blank" rel="noopener">examples/jsm/geometries/TextGeometry.js</a>
  220. </p>
  221. </article>
  222. </section>
  223. <script src="../scripts/linenumber.js"></script>
  224. <script src="../scripts/page.js"></script>
  225. </body>
  226. </html>
粤ICP备19079148号