|
@@ -10,13 +10,13 @@
|
|
<body>
|
|
<body>
|
|
[page:CurvePath] →
|
|
[page:CurvePath] →
|
|
|
|
|
|
- <h1>[name]</h1>
|
|
|
|
|
|
+ <h1>路径([name])</h1>
|
|
|
|
|
|
<p class="desc">
|
|
<p class="desc">
|
|
- A 2D path representation. The class provides methods for creating paths and contours of 2D shapes similar to the 2D Canvas API.
|
|
|
|
|
|
+ 该类定义了二维路径,提供了一些类似2D Canvas API的方法来创建或者构造二维路径。
|
|
</p>
|
|
</p>
|
|
|
|
|
|
- <h2>Example</h2>
|
|
|
|
|
|
+ <h2>示例</h2>
|
|
|
|
|
|
<code>
|
|
<code>
|
|
var path = new THREE.Path();
|
|
var path = new THREE.Path();
|
|
@@ -35,110 +35,108 @@
|
|
</code>
|
|
</code>
|
|
|
|
|
|
|
|
|
|
- <h2>Constructor</h2>
|
|
|
|
|
|
+ <h2>构造函数</h2>
|
|
|
|
|
|
|
|
|
|
<h3>[name]( [param:Array points] )</h3>
|
|
<h3>[name]( [param:Array points] )</h3>
|
|
<p>
|
|
<p>
|
|
- points -- (optional) array of [page:Vector2 Vector2s].<br /><br />
|
|
|
|
|
|
+ points -- (可选)[page:Vector2 Vector2s]数组。<br /><br />
|
|
|
|
|
|
- Creates a Path from the points. The first point defines the offset, then successive points
|
|
|
|
- are added to the [page:CurvePath.curves curves] array as [page:LineCurve LineCurves].<br /><br />
|
|
|
|
|
|
+ 从传入的点中创建一条Path。第一个点定义了偏移量,
|
|
|
|
+ 接下来的点作为[page:LineCurve LineCurves]被添加到[page:CurvePath.curves curves]数组中。<br /><br />
|
|
|
|
|
|
- If no points are specified, an empty path is created and the [page:.currentPoint] is set to
|
|
|
|
- the origin.
|
|
|
|
|
|
+ 倘若没有点被指定,一条空路径将会被创建,[page:.currentPoint]将被设置为原点。
|
|
</p>
|
|
</p>
|
|
|
|
|
|
|
|
|
|
- <h2>Properties</h2>
|
|
|
|
- <p>See the base [page:CurvePath] class for common properties.</p>
|
|
|
|
|
|
+ <h2>属性</h2>
|
|
|
|
+ <p>请参阅其基类[page:CurvePath]来了解共有属性。</p>
|
|
|
|
|
|
<h3>[property:array currentPoint]</h3>
|
|
<h3>[property:array currentPoint]</h3>
|
|
- <p>The current offset of the path. Any new [page:Curve] added will start here.</p>
|
|
|
|
|
|
+ <p>路径当前的偏移量,任何新被加入的[page:Curve]将会从这里开始。</p>
|
|
|
|
|
|
|
|
|
|
- <h2>Methods</h2>
|
|
|
|
- <p>See the base [page:CurvePath] class for common methods.</p>
|
|
|
|
|
|
+ <h2>方法</h2>
|
|
|
|
+ <p>请参阅其基类[page:CurvePath]来了解共有方法。</p>
|
|
|
|
|
|
<h3>[method:null absarc]( [param:Float x], [param:Float y], [param:Float radius], [param:Float startAngle], [param:Float endAngle], [param:Float clockwise] )</h3>
|
|
<h3>[method:null absarc]( [param:Float x], [param:Float y], [param:Float radius], [param:Float startAngle], [param:Float endAngle], [param:Float clockwise] )</h3>
|
|
<p>
|
|
<p>
|
|
- x, y -- The absolute center of the arc.<br />
|
|
|
|
- radius -- The radius of the arc.<br />
|
|
|
|
- startAngle -- The start angle in radians.<br />
|
|
|
|
- endAngle -- The end angle in radians.<br />
|
|
|
|
- clockwise -- Sweep the arc clockwise. Defaults to *false*.<br /><br />
|
|
|
|
|
|
+ x, y -- 弧线的绝对中心。<br />
|
|
|
|
+ radius -- 弧线的半径。<br />
|
|
|
|
+ startAngle -- 起始角,以弧度来表示。<br />
|
|
|
|
+ endAngle -- 终止角,以弧度来表示。<br />
|
|
|
|
+ clockwise -- 以顺时针方向创建(扫过)弧线。默认值为*false*。<br /><br />
|
|
|
|
|
|
- Adds an absolutely positioned [page:EllipseCurve EllipseCurve] to the path.
|
|
|
|
|
|
+ 添加一条绝对定位的[page:EllipseCurve EllipseCurve]到路径中。
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h3>[method:null absellipse]( [param:Float x], [param:Float y], [param:Float xRadius], [param:Float yRadius], [param:Float startAngle], [param:Float endAngle], [param:Float clockwise], [param:Float rotation] )</h3>
|
|
<h3>[method:null absellipse]( [param:Float x], [param:Float y], [param:Float xRadius], [param:Float yRadius], [param:Float startAngle], [param:Float endAngle], [param:Float clockwise], [param:Float rotation] )</h3>
|
|
<p>
|
|
<p>
|
|
- x, y -- The absolute center of the ellipse.<br />
|
|
|
|
- xRadius -- The radius of the ellipse in the x axis.<br />
|
|
|
|
- yRadius -- The radius of the ellipse in the y axis.<br />
|
|
|
|
- startAngle -- The start angle in radians.<br />
|
|
|
|
- endAngle -- The end angle in radians.<br />
|
|
|
|
- clockwise -- Sweep the ellipse clockwise. Defaults to false.<br />
|
|
|
|
- rotation -- The rotation angle of the ellipse in radians, counterclockwise from the positive X axis. Optional, defaults to 0.<br /><br />
|
|
|
|
-
|
|
|
|
- Adds an absolutely positioned [page:EllipseCurve EllipseCurve] to the path.
|
|
|
|
|
|
+ x, y -- 椭圆的绝对中心。<br />
|
|
|
|
+ xRadius -- 椭圆x轴方向的半径。<br />
|
|
|
|
+ yRadius -- 椭圆y轴方向的半径。<br />
|
|
|
|
+ startAngle -- 起始角,以弧度来表示。<br />
|
|
|
|
+ endAngle -- 终止角,以弧度来表示。<br />
|
|
|
|
+ clockwise -- 以顺时针方向创建(扫过)椭圆。默认值为*false*。<br />
|
|
|
|
+ rotation -- 椭圆从X轴正方向逆时针的旋转角度(可选),以弧度表示,默认值为*0*。<br /><br />
|
|
|
|
+
|
|
|
|
+ 添加一条绝对定位的[page:EllipseCurve EllipseCurve]到路径中。
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h3>[method:null arc]( [param:Float x], [param:Float y], [param:Float radius], [param:Float startAngle], [param:Float endAngle], [param:Float clockwise] )</h3>
|
|
<h3>[method:null arc]( [param:Float x], [param:Float y], [param:Float radius], [param:Float startAngle], [param:Float endAngle], [param:Float clockwise] )</h3>
|
|
<p>
|
|
<p>
|
|
- x, y -- The center of the arc offset from the last call.<br />
|
|
|
|
- radius -- The radius of the arc.<br />
|
|
|
|
- startAngle -- The start angle in radians.<br />
|
|
|
|
- endAngle -- The end angle in radians.<br />
|
|
|
|
- clockwise -- Sweep the arc clockwise. Defaults to *false*.<br /><br />
|
|
|
|
|
|
+ x, y -- 弧线的中心来自上次调用后的偏移量。<br />
|
|
|
|
+ radius -- 弧线的半径。<br />
|
|
|
|
+ startAngle -- 起始角,以弧度来表示。<br />
|
|
|
|
+ endAngle -- 终止角,以弧度来表示。<br />
|
|
|
|
+ clockwise -- 以顺时针方向创建(扫过)弧线。默认值为*false*。<br /><br />
|
|
|
|
|
|
- Adds an [page:EllipseCurve EllipseCurve] to the path, positioned relative to [page:.currentPoint].
|
|
|
|
|
|
+ 添加一条[page:EllipseCurve EllipseCurve]到路径中,位置相对于[page:.currentPoint]。
|
|
</p>
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<h3>[method:null bezierCurveTo]( [param:Float cp1X], [param:Float cp1Y], [param:Float cp2X], [param:Float cp2Y], [param:Float x], [param:Float y] )</h3>
|
|
<h3>[method:null bezierCurveTo]( [param:Float cp1X], [param:Float cp1Y], [param:Float cp2X], [param:Float cp2Y], [param:Float x], [param:Float y] )</h3>
|
|
- <p>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.</p>
|
|
|
|
|
|
+ <p>从[page:.currentPoint]创建一条贝塞尔曲线,以(cp1X, cp1Y)和(cp2X, cp2Y)作为控制点,并将[page:.currentPoint]更新到x,y。</p>
|
|
|
|
|
|
<h3>[method:null ellipse]( [param:Float x], [param:Float y], [param:Float xRadius], [param:Float yRadius], [param:Float startAngle], [param:Float endAngle], [param:Float clockwise], [param:Float rotation] )</h3>
|
|
<h3>[method:null ellipse]( [param:Float x], [param:Float y], [param:Float xRadius], [param:Float yRadius], [param:Float startAngle], [param:Float endAngle], [param:Float clockwise], [param:Float rotation] )</h3>
|
|
<p>
|
|
<p>
|
|
- x, y -- The center of the ellipse offset from the last call.<br />
|
|
|
|
- xRadius -- The radius of the ellipse in the x axis.<br />
|
|
|
|
- yRadius -- The radius of the ellipse in the y axis.<br />
|
|
|
|
- startAngle -- The start angle in radians.<br />
|
|
|
|
- endAngle -- The end angle in radians.<br />
|
|
|
|
- clockwise -- Sweep the ellipse clockwise. Defaults to *false*.<br />
|
|
|
|
- rotation -- The rotation angle of the ellipse in radians, counterclockwise from the positive X axis. Optional, defaults to *0*.<br /><br />
|
|
|
|
-
|
|
|
|
- Adds an [page:EllipseCurve EllipseCurve] to the path, positioned relative to [page:.currentPoint].
|
|
|
|
|
|
+ x, y -- 椭圆的中心来自上次调用后的偏移量。The center of the ellipse offset from the last call.<br />
|
|
|
|
+ xRadius -- 椭圆x轴方向的半径。<br />
|
|
|
|
+ yRadius -- 椭圆y轴方向的半径。<br />
|
|
|
|
+ startAngle -- 起始角,以弧度来表示。<br />
|
|
|
|
+ endAngle -- 终止角,以弧度来表示。<br />
|
|
|
|
+ clockwise -- 以顺时针方向创建(扫过)椭圆。默认值为*false*。<br />
|
|
|
|
+ rotation -- 椭圆从X轴正方向逆时针的旋转角度(可选),以弧度表示,默认值为*0*。<br /><br />
|
|
|
|
+
|
|
|
|
+ 添加一条[page:EllipseCurve EllipseCurve]到路径中,位置相对于[page:.currentPoint]。
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h3>[method:null lineTo]( [param:Float x], [param:Float y] )</h3>
|
|
<h3>[method:null lineTo]( [param:Float x], [param:Float y] )</h3>
|
|
- <p>Connects a [page:LineCurve] from [page:.currentPoint] to x, y onto the path.</p>
|
|
|
|
|
|
+ <p>在当前路径上,从[page:.currentPoint]连接一条直线到x,y。</p>
|
|
|
|
|
|
|
|
|
|
<h3>[method:null moveTo]( [param:Float x], [param:Float y] )</h3>
|
|
<h3>[method:null moveTo]( [param:Float x], [param:Float y] )</h3>
|
|
- <p>Move the [page:.currentPoint] to x, y.</p>
|
|
|
|
|
|
+ <p>将[page:.currentPoint]移动到x, y。</p>
|
|
|
|
|
|
|
|
|
|
<h3>[method:null quadraticCurveTo]( [param:Float cpX], [param:Float cpY], [param:Float x], [param:Float y] )</h3>
|
|
<h3>[method:null quadraticCurveTo]( [param:Float cpX], [param:Float cpY], [param:Float x], [param:Float y] )</h3>
|
|
- <p>Creates a quadratic curve from [page:.currentPoint] with cpX and cpY as control point and updates [page:.currentPoint] to x and y.</p>
|
|
|
|
|
|
+ <p>从[page:.currentPoint]创建一条二次曲线,以(cpX,cpY)作为控制点,并将[page:.currentPoint]更新到x,y。</p>
|
|
|
|
|
|
<h3>[method:null setFromPoints]( [param:Array vector2s] )</h3>
|
|
<h3>[method:null setFromPoints]( [param:Array vector2s] )</h3>
|
|
<p>
|
|
<p>
|
|
- points -- array of [page:Vector2 Vector2s].<br /><br />
|
|
|
|
|
|
+ points -- [page:Vector2 Vector2]数组。<br /><br />
|
|
|
|
|
|
- Points are added to the [page:CurvePath.curves curves]
|
|
|
|
- array as [page:LineCurve LineCurves].
|
|
|
|
|
|
+ 点将被作为[page:LineCurve LineCurves]加入到[page:CurvePath.curves curves]数组中。
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h3>[method:null splineThru] ( [param:Array points] ) </h3>
|
|
<h3>[method:null splineThru] ( [param:Array points] ) </h3>
|
|
<p>
|
|
<p>
|
|
- points - An array of [page:Vector2 Vector2s]<br /><br />
|
|
|
|
|
|
+ points -[page:Vector2 Vector2]数组。<br /><br />
|
|
|
|
|
|
- Connects a new [page:SplineCurve] onto the path.
|
|
|
|
|
|
+ 连接一条新的[page:SplineCurve]到路径上。
|
|
</p>
|
|
</p>
|
|
|
|
|
|
- <h2>Source</h2>
|
|
|
|
|
|
+ <h2>源代码</h2>
|
|
|
|
|
|
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
|
|
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
|
|
</body>
|
|
</body>
|