ShapePath.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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.</p>
  39. <p>Default is <code>null</code>.</p>
  40. </div>
  41. </div>
  42. <div class="member">
  43. <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>
  44. <div class="description">
  45. <p>The paths that have been generated for this shape.</p>
  46. <p>Default is <code>null</code>.</p>
  47. </div>
  48. </div>
  49. <h2 class="subsection-title">Methods</h2>
  50. <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>
  51. <div class="method">
  52. <div class="description">
  53. <p>Adds an instance of <a href="CubicBezierCurve.html">CubicBezierCurve</a> to the path by connecting
  54. the current point with the given one.</p>
  55. </div>
  56. <table class="params">
  57. <tbody>
  58. <tr>
  59. <td class="name">
  60. <strong>aCP1x</strong>
  61. </td>
  62. <td class="description last">
  63. <p>The x coordinate of the first control point.</p>
  64. </td>
  65. </tr>
  66. <tr>
  67. <td class="name">
  68. <strong>aCP1y</strong>
  69. </td>
  70. <td class="description last">
  71. <p>The y coordinate of the first control point.</p>
  72. </td>
  73. </tr>
  74. <tr>
  75. <td class="name">
  76. <strong>aCP2x</strong>
  77. </td>
  78. <td class="description last">
  79. <p>The x coordinate of the second control point.</p>
  80. </td>
  81. </tr>
  82. <tr>
  83. <td class="name">
  84. <strong>aCP2y</strong>
  85. </td>
  86. <td class="description last">
  87. <p>The y coordinate of the second control point.</p>
  88. </td>
  89. </tr>
  90. <tr>
  91. <td class="name">
  92. <strong>aX</strong>
  93. </td>
  94. <td class="description last">
  95. <p>The x coordinate of the end point.</p>
  96. </td>
  97. </tr>
  98. <tr>
  99. <td class="name">
  100. <strong>aY</strong>
  101. </td>
  102. <td class="description last">
  103. <p>The y coordinate of the end point.</p>
  104. </td>
  105. </tr>
  106. </tbody>
  107. </table>
  108. <dl class="details">
  109. <dt class="tag-returns"><strong>Returns:</strong> A reference to this shape path.</dt>
  110. </dl>
  111. </div>
  112. <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>
  113. <div class="method">
  114. <div class="description">
  115. <p>Adds an instance of <a href="LineCurve.html">LineCurve</a> to the path by connecting
  116. the current point with the given one.</p>
  117. </div>
  118. <table class="params">
  119. <tbody>
  120. <tr>
  121. <td class="name">
  122. <strong>x</strong>
  123. </td>
  124. <td class="description last">
  125. <p>The x coordinate of the end point.</p>
  126. </td>
  127. </tr>
  128. <tr>
  129. <td class="name">
  130. <strong>y</strong>
  131. </td>
  132. <td class="description last">
  133. <p>The y coordinate of the end point.</p>
  134. </td>
  135. </tr>
  136. </tbody>
  137. </table>
  138. <dl class="details">
  139. <dt class="tag-returns"><strong>Returns:</strong> A reference to this shape path.</dt>
  140. </dl>
  141. </div>
  142. <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>
  143. <div class="method">
  144. <div class="description">
  145. <p>Creates a new path and moves it current point to the given one.</p>
  146. </div>
  147. <table class="params">
  148. <tbody>
  149. <tr>
  150. <td class="name">
  151. <strong>x</strong>
  152. </td>
  153. <td class="description last">
  154. <p>The x coordinate.</p>
  155. </td>
  156. </tr>
  157. <tr>
  158. <td class="name">
  159. <strong>y</strong>
  160. </td>
  161. <td class="description last">
  162. <p>The y coordinate.</p>
  163. </td>
  164. </tr>
  165. </tbody>
  166. </table>
  167. <dl class="details">
  168. <dt class="tag-returns"><strong>Returns:</strong> A reference to this shape path.</dt>
  169. </dl>
  170. </div>
  171. <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>
  172. <div class="method">
  173. <div class="description">
  174. <p>Adds an instance of <a href="QuadraticBezierCurve.html">QuadraticBezierCurve</a> to the path by connecting
  175. the current point with the given one.</p>
  176. </div>
  177. <table class="params">
  178. <tbody>
  179. <tr>
  180. <td class="name">
  181. <strong>aCPx</strong>
  182. </td>
  183. <td class="description last">
  184. <p>The x coordinate of the control point.</p>
  185. </td>
  186. </tr>
  187. <tr>
  188. <td class="name">
  189. <strong>aCPy</strong>
  190. </td>
  191. <td class="description last">
  192. <p>The y coordinate of the control point.</p>
  193. </td>
  194. </tr>
  195. <tr>
  196. <td class="name">
  197. <strong>aX</strong>
  198. </td>
  199. <td class="description last">
  200. <p>The x coordinate of the end point.</p>
  201. </td>
  202. </tr>
  203. <tr>
  204. <td class="name">
  205. <strong>aY</strong>
  206. </td>
  207. <td class="description last">
  208. <p>The y coordinate of the end point.</p>
  209. </td>
  210. </tr>
  211. </tbody>
  212. </table>
  213. <dl class="details">
  214. <dt class="tag-returns"><strong>Returns:</strong> A reference to this shape path.</dt>
  215. </dl>
  216. </div>
  217. <h3 class="name name-method" id="splineThru" translate="no">.<a href="#splineThru">splineThru</a><span class="signature">( pts : <span class="param-type">Array.&lt;<a href="Vector2.html">Vector2</a>></span> )</span><span class="type-signature"> : <a href="ShapePath.html">ShapePath</a></span> </h3>
  218. <div class="method">
  219. <div class="description">
  220. <p>Adds an instance of <a href="SplineCurve.html">SplineCurve</a> to the path by connecting
  221. the current point with the given list of points.</p>
  222. </div>
  223. <table class="params">
  224. <tbody>
  225. <tr>
  226. <td class="name">
  227. <strong>pts</strong>
  228. </td>
  229. <td class="description last">
  230. <p>An array of points in 2D space.</p>
  231. </td>
  232. </tr>
  233. </tbody>
  234. </table>
  235. <dl class="details">
  236. <dt class="tag-returns"><strong>Returns:</strong> A reference to this shape path.</dt>
  237. </dl>
  238. </div>
  239. <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>
  240. <div class="method">
  241. <div class="description">
  242. <p>Converts the paths into an array of shapes.</p>
  243. </div>
  244. <table class="params">
  245. <tbody>
  246. <tr>
  247. <td class="name">
  248. <strong>isCCW</strong>
  249. </td>
  250. <td class="description last">
  251. <p>By default solid shapes are defined clockwise (CW) and holes are defined counterclockwise (CCW).
  252. If this flag is set to <code>true</code>, then those are flipped.</p>
  253. </td>
  254. </tr>
  255. </tbody>
  256. </table>
  257. <dl class="details">
  258. <dt class="tag-returns"><strong>Returns:</strong> An array of shapes.</dt>
  259. </dl>
  260. </div>
  261. <h2 class="subsection-title">Source</h2>
  262. <p>
  263. <a href="https://github.com/mrdoob/three.js/blob/master/src/extras/core/ShapePath.js" translate="no" target="_blank" rel="noopener">src/extras/core/ShapePath.js</a>
  264. </p>
  265. </article>
  266. </section>
  267. <script src="../scripts/linenumber.js"></script>
  268. <script src="../scripts/page.js"></script>
  269. </body>
  270. </html>
粤ICP备19079148号