123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <!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>
- [page:Object3D] →
- <h1>线([name])</h1>
- <p class="desc">
- 一条连续的线。<br /><br />
- 它几乎和[page:LineSegments]是一样的,唯一的区别是它在渲染时使用的是[link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawElements gl.LINE_STRIP],
- 而不是[link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawElements gl.LINES]。
- </p>
- <h2>代码示例</h2>
- <code>
- const material = new THREE.LineBasicMaterial({
- color: 0x0000ff
- });
- const points = [];
- points.push( new THREE.Vector3( - 10, 0, 0 ) );
- points.push( new THREE.Vector3( 0, 10, 0 ) );
- points.push( new THREE.Vector3( 10, 0, 0 ) );
- const geometry = new THREE.BufferGeometry().setFromPoints( points );
- const line = new THREE.Line( geometry, material );
- scene.add( line );
- </code>
- <h2>构造器</h2>
- <h3>[name]( [param:BufferGeometry geometry], [param:Material material] )</h3>
- <p>
- [page:BufferGeometry geometry] —— 表示线段的顶点,默认值是一个新的[page:BufferGeometry]。<br />
- [page:Material material] —— 线的材质,默认值是一个新的具有随机颜色的[page:LineBasicMaterial]。<br />
- </p>
- <h2>属性</h2>
- <p>共有属性请参见其基类[page:Object3D]。</p>
- <h3>[property:BufferGeometry geometry]</h3>
- <p>表示线段的顶点。</p>
- <h3>[property:Boolean isLine]</h3>
- <p>
- Read-only flag to check if a given object is of type [name].
- </p>
- <h3>[property:Material material]</h3>
- <p>线的材质。</p>
- <h3>[property:Array morphTargetInfluences]</h3>
- <p>
- An array of weights typically from 0-1 that specify how much of the morph is applied.
- Undefined by default, but reset to a blank array by [page:.updateMorphTargets]().
- </p>
- <h3>[property:Object morphTargetDictionary]</h3>
- <p>
- A dictionary of morphTargets based on the morphTarget.name property.
- Undefined by default, but rebuilt [page:.updateMorphTargets]().
- </p>
- <h2>方法</h2>
- <p>共有方法请参见其基类 [page:Object3D]。</p>
- <h3>[method:this computeLineDistances]()</h3>
- <p>
- 计算[page:LineDashedMaterial]所需的距离的值的数组。
- 对于几何体中的每一个顶点,这个方法计算出了当前点到线的起始点的累积长度。
- </p>
- <h3>[method:undefined raycast]( [param:Raycaster raycaster], [param:Array intersects] )</h3>
- <p>
- 在一条投射出去的[page:Ray](射线)和这条线之间产生交互。
- [page:Raycaster.intersectObject]将会调用这个方法。
- </p>
- <h3>[method:undefined updateMorphTargets]()</h3>
- <p>
- Updates the morphTargets to have no influence on the object. Resets the
- [page:.morphTargetInfluences] and [page:.morphTargetDictionary] properties.
- </p>
- <h2>源代码</h2>
- <p>
- [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
- </p>
- </body>
- </html>
|