File: ShapePath.html

package info (click to toggle)
three.js 111%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 15,184 kB
  • sloc: javascript: 133,174; makefile: 24; sh: 1
file content (90 lines) | stat: -rw-r--r-- 3,231 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<base href="../../../../" />
		<script src="list.js"></script>
		<script src="page.js"></script>
		<link type="text/css" rel="stylesheet" href="page.css" />
	</head>
	<body>
		[page:Curve] &rarr; [page:CurvePath] &rarr;

		<h1>形状路径([name])</h1>

		<p class="desc">
		该类用于转换一系列的形状为一个[page:Path]数组,例如转换SVG中的Path为three.js中的Path(请参阅下方的example)。
		在内部它由[page:Font]所使用,用于将JSON字体转换为一系列路径。
		</p>

		<h2>示例</h2>

		[example:webgl_geometry_extrude_shapes2 geometry / extrude / shapes2]

		<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和cp1X、cp1Y为控制点,并将[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], [param:Boolean noHoles] )</h3>
		<p>
		isCCW -- 更改实体形状和孔洞的生成方式。<br/>
		noHoles -- 是否创建孔洞。
		</p>
		<p>
		将[page:ShapePath.subPaths subPaths]数组转换为到Shapes数组。默认情况下,实体形状按照顺时针(CW)来定义,孔洞按照逆时针(CCW)来定义。
		如果isCCW被设置为true,则孔洞和实体形状的定义将被反转。如果noHoles参数设置为true,则所有路径将被设置为实体形状,isCCW将被忽略。
		<br/>

		</p>


		<h2>源代码</h2>

		[link:https://github.com/mrdoob/three.js/blob/master/src/extras/core/Path.js src/extras/core/Path.js]
	</body>
</html>