ShapePath.html 10 KB

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