ShapePath.html 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>ShapePath - 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">ShapePath</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>This class is used to convert a series of paths to an array of
  16. shapes. It is specifically used in context of fonts and SVG.</p></div>
  17. </header>
  18. <article>
  19. <div class="container-overview">
  20. <h2>Constructor</h2>
  21. <h3 class="name name-method" id="ShapePath" translate="no">new <a href="#ShapePath">ShapePath</a><span class="signature">()</span> </h3>
  22. <div class="method">
  23. <div class="description">
  24. <p>Constructs a new shape path.</p>
  25. </div>
  26. </div>
  27. </div>
  28. <h2 class="subsection-title">Properties</h2>
  29. <div class="member">
  30. <h3 class="name" id="color" translate="no">.<a href="#color">color</a><span class="type-signature"> : <a href="Color.html">Color</a></span> </h3>
  31. <div class="description">
  32. <p>The color of the shape.</p>
  33. </div>
  34. </div>
  35. <div class="member">
  36. <h3 class="name" id="currentPath" translate="no">.<a href="#currentPath">currentPath</a><span class="type-signature"> : <a href="Path.html">Path</a></span> </h3>
  37. <div class="description">
  38. <p>The current path that is being generated.<br/>Default is <code>null</code>.</p>
  39. </div>
  40. </div>
  41. <div class="member">
  42. <h3 class="name" id="subPaths" translate="no">.<a href="#subPaths">subPaths</a><span class="type-signature"> : Array.&lt;<a href="Path.html">Path</a>></span> </h3>
  43. <div class="description">
  44. <p>The paths that have been generated for this shape.<br/>Default is <code>null</code>.</p>
  45. </div>
  46. </div>
  47. <h2 class="subsection-title">Methods</h2>
  48. <h3 class="name name-method" id="bezierCurveTo" translate="no">.<a href="#bezierCurveTo">bezierCurveTo</a><span class="signature">( aCP1x : <span class="param-type">number</span>, aCP1y : <span class="param-type">number</span>, aCP2x : <span class="param-type">number</span>, aCP2y : <span class="param-type">number</span>, aX : <span class="param-type">number</span>, aY : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="ShapePath.html">ShapePath</a></span> </h3>
  49. <div class="method">
  50. <div class="description">
  51. <p>Adds an instance of <a href="CubicBezierCurve.html">CubicBezierCurve</a> to the path by connecting
  52. the current point with the given one.</p>
  53. </div>
  54. <table class="params">
  55. <tbody>
  56. <tr>
  57. <td class="name"><code>aCP1x</code></td>
  58. <td class="description last"><p>The x coordinate of the first control point.</p></td>
  59. </tr>
  60. <tr>
  61. <td class="name"><code>aCP1y</code></td>
  62. <td class="description last"><p>The y coordinate of the first control point.</p></td>
  63. </tr>
  64. <tr>
  65. <td class="name"><code>aCP2x</code></td>
  66. <td class="description last"><p>The x coordinate of the second control point.</p></td>
  67. </tr>
  68. <tr>
  69. <td class="name"><code>aCP2y</code></td>
  70. <td class="description last"><p>The y coordinate of the second control point.</p></td>
  71. </tr>
  72. <tr>
  73. <td class="name"><code>aX</code></td>
  74. <td class="description last"><p>The x coordinate of the end point.</p></td>
  75. </tr>
  76. <tr>
  77. <td class="name"><code>aY</code></td>
  78. <td class="description last"><p>The y coordinate of the end point.</p></td>
  79. </tr>
  80. </tbody>
  81. </table>
  82. <dl class="details">
  83. <dt class="tag-returns"><strong>Returns:</strong> A reference to this shape path.</dt>
  84. </dl>
  85. </div>
  86. <h3 class="name name-method" id="lineTo" translate="no">.<a href="#lineTo">lineTo</a><span class="signature">( x : <span class="param-type">number</span>, y : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="ShapePath.html">ShapePath</a></span> </h3>
  87. <div class="method">
  88. <div class="description">
  89. <p>Adds an instance of <a href="LineCurve.html">LineCurve</a> to the path by connecting
  90. the current point with the given one.</p>
  91. </div>
  92. <table class="params">
  93. <tbody>
  94. <tr>
  95. <td class="name"><code>x</code></td>
  96. <td class="description last"><p>The x coordinate of the end point.</p></td>
  97. </tr>
  98. <tr>
  99. <td class="name"><code>y</code></td>
  100. <td class="description last"><p>The y coordinate of the end point.</p></td>
  101. </tr>
  102. </tbody>
  103. </table>
  104. <dl class="details">
  105. <dt class="tag-returns"><strong>Returns:</strong> A reference to this shape path.</dt>
  106. </dl>
  107. </div>
  108. <h3 class="name name-method" id="moveTo" translate="no">.<a href="#moveTo">moveTo</a><span class="signature">( x : <span class="param-type">number</span>, y : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="ShapePath.html">ShapePath</a></span> </h3>
  109. <div class="method">
  110. <div class="description">
  111. <p>Creates a new path and moves it current point to the given one.</p>
  112. </div>
  113. <table class="params">
  114. <tbody>
  115. <tr>
  116. <td class="name"><code>x</code></td>
  117. <td class="description last"><p>The x coordinate.</p></td>
  118. </tr>
  119. <tr>
  120. <td class="name"><code>y</code></td>
  121. <td class="description last"><p>The y coordinate.</p></td>
  122. </tr>
  123. </tbody>
  124. </table>
  125. <dl class="details">
  126. <dt class="tag-returns"><strong>Returns:</strong> A reference to this shape path.</dt>
  127. </dl>
  128. </div>
  129. <h3 class="name name-method" id="quadraticCurveTo" translate="no">.<a href="#quadraticCurveTo">quadraticCurveTo</a><span class="signature">( aCPx : <span class="param-type">number</span>, aCPy : <span class="param-type">number</span>, aX : <span class="param-type">number</span>, aY : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="ShapePath.html">ShapePath</a></span> </h3>
  130. <div class="method">
  131. <div class="description">
  132. <p>Adds an instance of <a href="QuadraticBezierCurve.html">QuadraticBezierCurve</a> to the path by connecting
  133. the current point with the given one.</p>
  134. </div>
  135. <table class="params">
  136. <tbody>
  137. <tr>
  138. <td class="name"><code>aCPx</code></td>
  139. <td class="description last"><p>The x coordinate of the control point.</p></td>
  140. </tr>
  141. <tr>
  142. <td class="name"><code>aCPy</code></td>
  143. <td class="description last"><p>The y coordinate of the control point.</p></td>
  144. </tr>
  145. <tr>
  146. <td class="name"><code>aX</code></td>
  147. <td class="description last"><p>The x coordinate of the end point.</p></td>
  148. </tr>
  149. <tr>
  150. <td class="name"><code>aY</code></td>
  151. <td class="description last"><p>The y coordinate of the end point.</p></td>
  152. </tr>
  153. </tbody>
  154. </table>
  155. <dl class="details">
  156. <dt class="tag-returns"><strong>Returns:</strong> A reference to this shape path.</dt>
  157. </dl>
  158. </div>
  159. <h3 class="name name-method" id="splineThru" translate="no">.<a href="#splineThru">splineThru</a><span class="signature">( pts : <span class="param-type">Array.&lt;Vector2></span> )</span><span class="type-signature"> : <a href="ShapePath.html">ShapePath</a></span> </h3>
  160. <div class="method">
  161. <div class="description">
  162. <p>Adds an instance of <a href="SplineCurve.html">SplineCurve</a> to the path by connecting
  163. the current point with the given list of points.</p>
  164. </div>
  165. <table class="params">
  166. <tbody>
  167. <tr>
  168. <td class="name"><code>pts</code></td>
  169. <td class="description last"><p>An array of points in 2D space.</p></td>
  170. </tr>
  171. </tbody>
  172. </table>
  173. <dl class="details">
  174. <dt class="tag-returns"><strong>Returns:</strong> A reference to this shape path.</dt>
  175. </dl>
  176. </div>
  177. <h3 class="name name-method" id="toShapes" translate="no">.<a href="#toShapes">toShapes</a><span class="signature">( isCCW : <span class="param-type">boolean</span> )</span><span class="type-signature"> : Array.&lt;<a href="Shape.html">Shape</a>></span> </h3>
  178. <div class="method">
  179. <div class="description">
  180. <p>Converts the paths into an array of shapes.</p>
  181. </div>
  182. <table class="params">
  183. <tbody>
  184. <tr>
  185. <td class="name"><code>isCCW</code></td>
  186. <td class="description last"><p>By default solid shapes are defined clockwise (CW) and holes are defined counterclockwise (CCW).
  187. If this flag is set to <code>true</code>, then those are flipped.</p></td>
  188. </tr>
  189. </tbody>
  190. </table>
  191. <dl class="details">
  192. <dt class="tag-returns"><strong>Returns:</strong> An array of shapes.</dt>
  193. </dl>
  194. </div>
  195. <h2 class="subsection-title">Source</h2>
  196. <p>
  197. <a href="https://github.com/mrdoob/three.js/blob/master/src/extras/core/ShapePath.js" target="_blank" rel="noopener" translate="no">src/extras/core/ShapePath.js</a>
  198. </p>
  199. </article>
  200. </section>
  201. <script src="../scripts/linenumber.js"></script>
  202. <script src="../scripts/page.js"></script>
  203. </body>
  204. </html>
粤ICP备19079148号