You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
2.9 KiB
87 lines
2.9 KiB
<!DOCTYPE html>
|
|
<html lang="zh">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<base href="../../../../" />
|
|
<script src="page.js"></script>
|
|
<link type="text/css" rel="stylesheet" href="page.css" />
|
|
</head>
|
|
<body>
|
|
<h1>形状路径([name])</h1>
|
|
|
|
<p class="desc">
|
|
该类用于转换一系列的形状为一个[page:Path]数组,例如转换SVG中的Path为three.js中的Path(请参阅下方的example)。
|
|
</p>
|
|
|
|
<h2>例子</h2>
|
|
<p>
|
|
[example:webgl_geometry_extrude_shapes2 geometry / extrude / shapes2]
|
|
</p>
|
|
|
|
<h2>构造函数</h2>
|
|
|
|
|
|
<h3>[name]( )</h3>
|
|
<p>
|
|
创建一个新的ShapePath。和[page:Path]不同,因为ShapePath被设计为在创建之后生成,所以没有点被传入到构造函数中。
|
|
</p>
|
|
|
|
|
|
<h2>属性</h2>
|
|
|
|
<h3>[property:Array subPaths]</h3>
|
|
<p>
|
|
[page:Path]数组。
|
|
</p>
|
|
|
|
<h3>[property:Array currentPath]</h3>
|
|
<p>
|
|
当前将要被生成的路径。
|
|
</p>
|
|
|
|
<h2>方法</h2>
|
|
|
|
<h3>[method:this moveTo]( [param:Float x], [param:Float y] )</h3>
|
|
<p>
|
|
创建一个新的[page:Path],并在[page:Path]上调用[page:Path.moveTo]( x, y )。
|
|
</p>
|
|
|
|
<h3>[method:this lineTo]( [param:Float x], [param:Float y] )</h3>
|
|
<p>这一方法从[page:ShapePath.currentPath currentPath](当前路径)的偏移量创建一条到X和Y的线,并将偏移量更新为X和Y。
|
|
</p>
|
|
|
|
<h3>[method:this quadraticCurveTo]( [param:Float cpX], [param:Float cpY], [param:Float x], [param:Float y] )</h3>
|
|
<p>这一方法从[page:ShapePath.currentPath currentPath](当前路径)创建一条到X和Y的二次曲线,cpX和cpY作为控制点,
|
|
并将[page:ShapePath.currentPath currentPath]的偏移量更新为x和y。
|
|
</p>
|
|
|
|
<h3>[method:this bezierCurveTo]( [param:Float cp1X], [param:Float cp1Y], [param:Float cp2X], [param:Float cp2Y], [param:Float x], [param:Float y] )</h3>
|
|
<p>
|
|
这一方法从[page:ShapePath.currentPath currentPath](当前路径)的偏移量创建一条到X和Y的贝塞尔曲线,
|
|
cp1X、cp1Y和cp2X、cp2Y为控制点,并将[page:ShapePath.currentPath currentPath]的偏移量更新为x和y。
|
|
</p>
|
|
|
|
<h3>[method:this splineThru] ( [param:Array points] ) </h3>
|
|
<p>points - 一个[page:Vector2]数组。</p>
|
|
<p>
|
|
连接一个新的[page:SplineCurve](样条曲线)到[page:ShapePath.currentPath currentPath](当前路径)。</p>
|
|
|
|
|
|
<h3>[method:Array toShapes]( [param:Boolean isCCW] )</h3>
|
|
<p>
|
|
isCCW -- 更改实体形状和孔洞的生成方式。
|
|
</p>
|
|
<p>
|
|
将[page:ShapePath.subPaths subPaths]数组转换为到Shapes数组。默认情况下,实体形状按照顺时针(CW)来定义,孔洞按照逆时针(CCW)来定义。
|
|
如果isCCW被设置为true,则孔洞和实体形状的定义将被反转。
|
|
<br/>
|
|
|
|
</p>
|
|
|
|
|
|
<h2>源代码</h2>
|
|
<p>
|
|
[link:https://github.com/mrdoob/three.js/blob/master/src/extras/core/Path.js src/extras/core/Path.js]
|
|
</p>
|
|
</body>
|
|
</html>
|
|
|