AsciiEffect.html 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>AsciiEffect - 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">AsciiEffect</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>A class that creates an ASCII effect.</p>
  16. <p>The ASCII generation is based on <a href="https://github.com/hassadee/jsascii/blob/master/jsascii.js">jsascii</a>.</p></div>
  17. </header>
  18. <article>
  19. <h2 class="subsection-title">Import</h2>
  20. <p><span translate="no">AsciiEffect</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank">Installation#Addons</a>.</p>
  21. <pre><code class="language-js">import { AsciiEffect } from 'three/addons/effects/AsciiEffect.js';</code></pre>
  22. <div class="container-overview">
  23. <h2>Constructor</h2>
  24. <h3 class="name name-method" id="AsciiEffect" translate="no">new <a href="#AsciiEffect">AsciiEffect</a><span class="signature">( renderer : <span class="param-type">WebGLRenderer</span>, charSet : <span class="param-type">string</span>, options : <span class="param-type">AsciiEffect~Options</span> )</span> </h3>
  25. <div class="method">
  26. <div class="description">
  27. <p>Constructs a new ASCII effect.</p>
  28. </div>
  29. <table class="params">
  30. <tbody>
  31. <tr>
  32. <td class="name"><code>renderer</code></td>
  33. <td class="description last"><p>The renderer.</p></td>
  34. </tr>
  35. <tr>
  36. <td class="name"><code>charSet</code></td>
  37. <td class="description last"><p>The char set.<br/>Default is <code>' .:-=+*#%@'</code>.</p></td>
  38. </tr>
  39. <tr>
  40. <td class="name"><code>options</code></td>
  41. <td class="description last"><p>The configuration parameter.</p></td>
  42. </tr>
  43. </tbody>
  44. </table>
  45. </div>
  46. </div>
  47. <h2 class="subsection-title">Properties</h2>
  48. <div class="member">
  49. <h3 class="name" id="domElement" translate="no">.<a href="#domElement">domElement</a><span class="type-signature"> : HTMLDivElement</span> </h3>
  50. <div class="description">
  51. <p>The DOM element of the effect. This element must be used instead of the
  52. default <a href="WebGLRenderer.html#domElement">WebGLRenderer#domElement</a>.</p>
  53. </div>
  54. </div>
  55. <h2 class="subsection-title">Methods</h2>
  56. <h3 class="name name-method" id="render" translate="no">.<a href="#render">render</a><span class="signature">( scene : <span class="param-type">Object3D</span>, camera : <span class="param-type">Camera</span> )</span> </h3>
  57. <div class="method">
  58. <div class="description">
  59. <p>When using this effect, this method should be called instead of the
  60. default <a href="WebGLRenderer.html#render">WebGLRenderer#render</a>.</p>
  61. </div>
  62. <table class="params">
  63. <tbody>
  64. <tr>
  65. <td class="name"><code>scene</code></td>
  66. <td class="description last"><p>The scene to render.</p></td>
  67. </tr>
  68. <tr>
  69. <td class="name"><code>camera</code></td>
  70. <td class="description last"><p>The camera.</p></td>
  71. </tr>
  72. </tbody>
  73. </table>
  74. </div>
  75. <h3 class="name name-method" id="setSize" translate="no">.<a href="#setSize">setSize</a><span class="signature">( w : <span class="param-type">number</span>, h : <span class="param-type">number</span> )</span> </h3>
  76. <div class="method">
  77. <div class="description">
  78. <p>Resizes the effect.</p>
  79. </div>
  80. <table class="params">
  81. <tbody>
  82. <tr>
  83. <td class="name"><code>w</code></td>
  84. <td class="description last"><p>The width of the effect in logical pixels.</p></td>
  85. </tr>
  86. <tr>
  87. <td class="name"><code>h</code></td>
  88. <td class="description last"><p>The height of the effect in logical pixels.</p></td>
  89. </tr>
  90. </tbody>
  91. </table>
  92. </div>
  93. <h2 class="subsection-title">Type Definitions</h2>
  94. <div class="member">
  95. <h3 class="name" id="~Options" translate="no">.<a href="#~Options">Options</a> </h3>
  96. <div class="description">
  97. <p>This type represents configuration settings of <code>AsciiEffect</code>.</p>
  98. </div>
  99. <h5 class="subsection-title">Properties:</h5>
  100. <table class="props">
  101. <thead>
  102. <tr>
  103. <th>Name</th>
  104. <th>Type</th>
  105. <th>Attributes</th>
  106. <th>Default</th>
  107. <th class="last">Description</th>
  108. </tr>
  109. </thead>
  110. <tbody>
  111. <tr>
  112. <td class="name"><code>resolution</code></td>
  113. <td class="type">
  114. <span class="param-type">number</span>
  115. </td>
  116. <td class="attributes">
  117. &lt;optional><br>
  118. </td>
  119. <td class="default">
  120. 0.15
  121. </td>
  122. <td class="description last"><p>A higher value leads to more details.</p></td>
  123. </tr>
  124. <tr>
  125. <td class="name"><code>scale</code></td>
  126. <td class="type">
  127. <span class="param-type">number</span>
  128. </td>
  129. <td class="attributes">
  130. &lt;optional><br>
  131. </td>
  132. <td class="default">
  133. 1
  134. </td>
  135. <td class="description last"><p>The scale of the effect.</p></td>
  136. </tr>
  137. <tr>
  138. <td class="name"><code>color</code></td>
  139. <td class="type">
  140. <span class="param-type">boolean</span>
  141. </td>
  142. <td class="attributes">
  143. &lt;optional><br>
  144. </td>
  145. <td class="default">
  146. false
  147. </td>
  148. <td class="description last"><p>Whether colors should be enabled or not. Better quality but slows down rendering.</p></td>
  149. </tr>
  150. <tr>
  151. <td class="name"><code>alpha</code></td>
  152. <td class="type">
  153. <span class="param-type">boolean</span>
  154. </td>
  155. <td class="attributes">
  156. &lt;optional><br>
  157. </td>
  158. <td class="default">
  159. false
  160. </td>
  161. <td class="description last"><p>Whether transparency should be enabled or not.</p></td>
  162. </tr>
  163. <tr>
  164. <td class="name"><code>block</code></td>
  165. <td class="type">
  166. <span class="param-type">boolean</span>
  167. </td>
  168. <td class="attributes">
  169. &lt;optional><br>
  170. </td>
  171. <td class="default">
  172. false
  173. </td>
  174. <td class="description last"><p>Whether blocked characters should be enabled or not.</p></td>
  175. </tr>
  176. <tr>
  177. <td class="name"><code>invert</code></td>
  178. <td class="type">
  179. <span class="param-type">boolean</span>
  180. </td>
  181. <td class="attributes">
  182. &lt;optional><br>
  183. </td>
  184. <td class="default">
  185. false
  186. </td>
  187. <td class="description last"><p>Whether colors should be inverted or not.</p></td>
  188. </tr>
  189. <tr>
  190. <td class="name"><code>strResolution</code></td>
  191. <td class="type">
  192. <span class="param-type">'low'</span>
  193. |
  194. <span class="param-type">'medium'</span>
  195. |
  196. <span class="param-type">'high'</span>
  197. </td>
  198. <td class="attributes">
  199. &lt;optional><br>
  200. </td>
  201. <td class="default">
  202. 'low'
  203. </td>
  204. <td class="description last"><p>The string resolution.</p></td>
  205. </tr>
  206. </tbody>
  207. </table>
  208. </div>
  209. <h2 class="subsection-title">Source</h2>
  210. <p>
  211. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/effects/AsciiEffect.js" target="_blank" rel="noopener" translate="no">examples/jsm/effects/AsciiEffect.js</a>
  212. </p>
  213. </article>
  214. </section>
  215. <script src="../scripts/linenumber.js"></script>
  216. <script src="../scripts/page.js"></script>
  217. </body>
  218. </html>
粤ICP备19079148号