Path.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="list.js"></script>
  7. <script src="page.js"></script>
  8. <link type="text/css" rel="stylesheet" href="page.css" />
  9. </head>
  10. <body>
  11. [page:CurvePath] &rarr;
  12. <h1>[name]</h1>
  13. <div class="desc">
  14. A 2d path representation, comprising of points, lines, and cubes, similar to the 2D Canvas API.
  15. It extends [page:CurvePath].
  16. </div>
  17. <h2>Example</h2>
  18. <code>
  19. var v1 = new THREE.Vector3();
  20. var v2 = new THREE.Vector3(1, 45, 6);
  21. var v3 = new THREE.Vector3(34, 34, 676);
  22. var vectors = [v1, v2, v3];
  23. var path = new THREE.Path(vectors);
  24. </code>
  25. <h2>Constructor</h2>
  26. <h3>[name]( [page:Array points] )</h3>
  27. <div>
  28. points -- (optional) array of [page:Vector2 Vector2s].<br /><br />
  29. Creates a Path from the points. The first point defines the offset, then successive points
  30. are added to the [page:CurvePath.curves curves] array as [page:LineCurve LineCurves].<br /><br />
  31. If no points are specified, an empty path is created and the [page:.currentPoint] is set to
  32. the origin.
  33. </div>
  34. <h2>Properties</h2>
  35. <div>See the base [page:CurvePath] class for common properties.</div>
  36. <h3>[property:array currentPoint]</h3>
  37. <div>The current offset of the path. Any new [page:Curve] added will start here.</div>
  38. <h2>Methods</h2>
  39. <div>See the base [page:CurvePath] class for common methods.</div>
  40. <h3>[method:null absarc]( [page:Float x], [page:Float y], [page:Float radius], [page:Float startAngle], [page:Float endAngle], [page:Float clockwise] )</h3>
  41. <div>
  42. x, y -- The absolute center of the arc.<br />
  43. radius -- The radius of the arc.<br />
  44. startAngle -- The start angle in radians.<br />
  45. endAngle -- The end angle in radians.<br />
  46. clockwise -- Sweep the arc clockwise. Defaults to *false*.<br /><br />
  47. Adds an absolutely positioned [page:EllipseCurve EllipseCurve] to the path.
  48. </div>
  49. <h3>[method:null absellipse]( [page:Float x], [page:Float y], [page:Float xRadius], [page:Float yRadius], [page:Float startAngle], [page:Float endAngle], [page:Float clockwise], [page:Float rotation] )</h3>
  50. <div>
  51. x, y -- The absolute center of the ellipse.<br />
  52. xRadius -- The radius of the ellipse in the x axis.<br />
  53. yRadius -- The radius of the ellipse in the y axis.<br />
  54. startAngle -- The start angle in radians.<br />
  55. endAngle -- The end angle in radians.<br />
  56. clockwise -- Sweep the ellipse clockwise. Defaults to false.<br />
  57. rotation -- The rotation angle of the ellipse in radians, counterclockwise from the positive X axis. Optional, defaults to 0.<br /><br />
  58. Adds an absolutely positioned [page:EllipseCurve EllipseCurve] to the path.
  59. </div>
  60. <h3>[method:null arc]( [page:Float x], [page:Float y], [page:Float radius], [page:Float startAngle], [page:Float endAngle], [page:Float clockwise] )</h3>
  61. <div>
  62. x, y -- The center of the arc offset from the last call.<br />
  63. radius -- The radius of the arc.<br />
  64. startAngle -- The start angle in radians.<br />
  65. endAngle -- The end angle in radians.<br />
  66. clockwise -- Sweep the arc clockwise. Defaults to *false*.<br /><br />
  67. Adds an [page:EllipseCurve EllipseCurve] to the path, positioned relative to [page:.currentPoint].
  68. </div>
  69. <h3>[method:null bezierCurveTo]( [page:Float cp1X], [page:Float cp1Y], [page:Float cp2X], [page:Float cp2Y], [page:Float x], [page:Float y] )</h3>
  70. <div>This creates a bezier curve from [page:.currentPoint] with (cp1X, cp1Y) and (cp2X, cp2Y) as control points and updates [page:.currentPoint] to x and y.</div>
  71. <h3>[method:null fromPoints]( [page:Array vector2s] )</h3>
  72. <div>
  73. points -- array of [page:Vector2 Vector2s].<br /><br />
  74. Adds to the from the points. Points are added to the [page:CurvePath.curves curves]
  75. array as [page:LineCurve LineCurves].
  76. </div>
  77. <h3>[method:null ellipse]( [page:Float x], [page:Float y], [page:Float xRadius], [page:Float yRadius], [page:Float startAngle], [page:Float endAngle], [page:Float clockwise], [page:Float rotation] )</h3>
  78. <div>
  79. x, y -- The center of the ellipse offset from the last call.<br />
  80. xRadius -- The radius of the ellipse in the x axis.<br />
  81. yRadius -- The radius of the ellipse in the y axis.<br />
  82. startAngle -- The start angle in radians.<br />
  83. endAngle -- The end angle in radians.<br />
  84. clockwise -- Sweep the ellipse clockwise. Defaults to *false*.<br />
  85. rotation -- The rotation angle of the ellipse in radians, counterclockwise from the positive X axis. Optional, defaults to *0*.<br /><br />
  86. Adds an [page:EllipseCurve EllipseCurve] to the path, positioned relative to [page:.currentPoint].
  87. </div>
  88. <h3>[method:null lineTo]( [page:Float x], [page:Float y] )</h3>
  89. <div>Connects a [page:LineCurve] from [page:.currentPoint] to x, y onto the path.</div>
  90. <h3>[method:null moveTo]( [page:Float x], [page:Float y] )</h3>
  91. <div>Move the [page:.currentPoint] to x, y.</div>
  92. <h3>[method:null quadraticCurveTo]( [page:Float cpX], [page:Float cpY], [page:Float x], [page:Float y] )</h3>
  93. <div>Creates a quadratic curve from [page:.currentPoint] with cpX and cpY as control point and updates [page:.currentPoint] to x and y.</div>
  94. <h3>[method:null splineThru] ( [page:Array points] ) </h3>
  95. <div>
  96. points - An array of [page:Vector2 Vector2s]<br /><br />
  97. Connects a new [page:SplineCurve] onto the path.
  98. </div>
  99. <h2>Source</h2>
  100. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  101. </body>
  102. </html>