|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="zh"> |
| 3 | + <head> |
| 4 | + <meta charset="utf-8" /> |
| 5 | + <base href="../../../" /> |
| 6 | + <script src="page.js"></script> |
| 7 | + <link type="text/css" rel="stylesheet" href="page.css" /> |
| 8 | + </head> |
| 9 | + <body> |
| 10 | + [page:BufferGeometry] → [page:LatheGeometry] → |
| 11 | + |
| 12 | + <h1>[name]</h1> |
| 13 | + |
| 14 | + <p class="desc"> |
| 15 | + [name]是一个胶囊图形类,通过半径和高度来进行构造。使用lathe来进行构造。 |
| 16 | + </p> |
| 17 | + |
| 18 | + <iframe |
| 19 | + id="scene" |
| 20 | + src="scenes/geometry-browser.html#CapsuleGeometry" |
| 21 | + ></iframe> |
| 22 | + |
| 23 | + <script> |
| 24 | + |
| 25 | + // iOS iframe auto-resize workaround |
| 26 | + |
| 27 | + if ( /(iPad|iPhone|iPod)/g.test( navigator.userAgent ) ) { |
| 28 | + |
| 29 | + const scene = document.getElementById( 'scene' ); |
| 30 | + |
| 31 | + scene.style.width = getComputedStyle( scene ).width; |
| 32 | + scene.style.height = getComputedStyle( scene ).height; |
| 33 | + scene.setAttribute( 'scrolling', 'no' ); |
| 34 | + |
| 35 | + } |
| 36 | + |
| 37 | + </script> |
| 38 | + |
| 39 | + <h2>代码示例</h2> |
| 40 | + |
| 41 | + <code> |
| 42 | +const geometry = new THREE.CapsuleGeometry( 1, 1, 4, 8 ); |
| 43 | +const material = new THREE.MeshBasicMaterial( {color: 0x00ff00} ); |
| 44 | +const capsule = new THREE.Mesh( geometry, material ); scene.add( capsule ); |
| 45 | + </code> |
| 46 | + |
| 47 | + <h2>构造函数</h2> |
| 48 | + |
| 49 | + <h3> |
| 50 | + [name]([param:Float radius], [param:Float length], [param:Integer capSubdivisions], [param:Integer radialSegments]) |
| 51 | + </h3> |
| 52 | + <p> |
| 53 | + radius — 胶囊半径。可选的; 默认值为1。<br /> |
| 54 | + length — 中间区域的长度。可选的; 默认值为1。<br /> |
| 55 | + capSegments — 构造盖子的曲线部分的个数。可选的; 默认值为4。<br /> |
| 56 | + radialSegments — 覆盖胶囊圆周的分离的面的个数。可选的; 默认值为8。<br /> |
| 57 | + </p> |
| 58 | + |
| 59 | + <h2>属性</h2> |
| 60 | + <p>查看公共属性请参考基类[page:BufferGeometry]。</p> |
| 61 | + |
| 62 | + <h3>[property:Object parameters]</h3> |
| 63 | + <p> |
| 64 | + 有属性的构造函数参数对象。任何实例化之后的修改都不会改变图形。 |
| 65 | + </p> |
| 66 | + |
| 67 | + <h2>方法</h2> |
| 68 | + <p>查看公共属性请参考基类[page:BufferGeometry]。</p> |
| 69 | + |
| 70 | + <h2>源码</h2> |
| 71 | + |
| 72 | + <p> |
| 73 | + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] |
| 74 | + </p> |
| 75 | + </body> |
| 76 | +</html> |
0 commit comments