CapsuleGeometry.html 2.0 KB

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