ShapePath.html 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. <h1>[name]</h1>
  11. <p class="desc">
  12. This class is used to convert a series of shapes to an array of
  13. [page:Path]s, for example an SVG shape to a path.
  14. </p>
  15. <h2>Constructor</h2>
  16. <h3>[name]( )</h3>
  17. <p>
  18. Creates a new ShapePath. Unlike a [page:Path], no points are passed in as
  19. the ShapePath is designed to be generated after creation.
  20. </p>
  21. <h2>Properties</h2>
  22. <h3>[property:Array subPaths]</h3>
  23. <p>Array of [page:Path]s.</p>
  24. <h3>[property:Array currentPath]</h3>
  25. <p>The current [page:Path] that is being generated.</p>
  26. <h3>[property:Color color]</h3>
  27. <p>[page:Color] of the shape, by default set to white (0xffffff).</p>
  28. <h2>Methods</h2>
  29. <h3>[method:this moveTo]( [param:Float x], [param:Float y] )</h3>
  30. <p>
  31. Starts a new [page:Path] and calls [page:Path.moveTo]( x, y ) on that
  32. [page:Path]. Also points [page:ShapePath.currentPath currentPath] to that
  33. [page:Path].
  34. </p>
  35. <h3>[method:this lineTo]( [param:Float x], [param:Float y] )</h3>
  36. <p>
  37. This creates a line from the [page:ShapePath.currentPath currentPath]'s
  38. offset to X and Y and updates the offset to X and Y.
  39. </p>
  40. <h3>
  41. [method:this quadraticCurveTo]( [param:Float cpX], [param:Float cpY], [param:Float x], [param:Float y] )
  42. </h3>
  43. <p>
  44. This creates a quadratic curve from the [page:ShapePath.currentPath currentPath]'s offset to x and y with cpX and cpY as control point and
  45. updates the [page:ShapePath.currentPath currentPath]'s offset to x and y.
  46. </p>
  47. <h3>
  48. [method:this bezierCurveTo]( [param:Float cp1X], [param:Float cp1Y], [param:Float cp2X], [param:Float cp2Y], [param:Float x], [param:Float y] )
  49. </h3>
  50. <p>
  51. This creates a bezier curve from the [page:ShapePath.currentPath currentPath]'s offset to x and y with cp1X, cp1Y and cp2X, cp2Y as control
  52. points and updates the [page:ShapePath.currentPath currentPath]'s offset
  53. to x and y.
  54. </p>
  55. <h3>[method:this splineThru] ( [param:Array points] )</h3>
  56. <p>points - An array of [page:Vector2]s</p>
  57. <p>
  58. Connects a new [page:SplineCurve] onto the [page:ShapePath.currentPath currentPath].
  59. </p>
  60. <h3>[method:Array toShapes]( [param:Boolean isCCW] )</h3>
  61. <p>isCCW -- Changes how solids and holes are generated</p>
  62. <p>
  63. Converts the [page:ShapePath.subPaths subPaths] array into an array of
  64. Shapes. By default solid shapes are defined clockwise (CW) and holes are
  65. defined counterclockwise (CCW). If isCCW is set to true, then those are
  66. flipped.
  67. <br />
  68. </p>
  69. <h2>Source</h2>
  70. <p>
  71. [link:https://github.com/mrdoob/three.js/blob/master/src/extras/core/ShapePath.js src/extras/core/ShapePath.js]
  72. </p>
  73. </body>
  74. </html>