ArrowHelper.html 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="list.js"></script>
  7. <script src="page.js"></script>
  8. <link type="text/css" rel="stylesheet" href="page.css" />
  9. </head>
  10. <body>
  11. [page:Object3D] &rarr;
  12. <h1>[name]</h1>
  13. <p class="desc">用于模拟方向的3维箭头对象.</p>
  14. <h2>代码示例</h2>
  15. <code>
  16. var dir = new THREE.Vector3( 1, 2, 0 );
  17. //normalize the direction vector (convert to vector of length 1)
  18. dir.normalize();
  19. var origin = new THREE.Vector3( 0, 0, 0 );
  20. var length = 1;
  21. var hex = 0xffff00;
  22. var arrowHelper = new THREE.ArrowHelper( dir, origin, length, hex );
  23. scene.add( arrowHelper );
  24. </code>
  25. <h2>例子</h2>
  26. <p>
  27. [example:webgl_shadowmesh WebGL / shadowmesh]
  28. </p>
  29. <h2>构造函数</h2>
  30. <h3>[name]([param:Vector3 dir], [param:Vector3 origin], [param:Number length], [param:Number hex], [param:Number headLength], [param:Number headWidth] )</h3>
  31. <p>
  32. [page:Vector3 dir] -- 基于箭头原点的方向. 必须为单位向量. <br />
  33. [page:Vector3 origin] -- 箭头的原点.<br />
  34. [page:Number length] -- 箭头的长度. 默认为 *1*.<br />
  35. [page:Number hex] -- 定义的16进制颜色值. 默认为 0xffff00.<br />
  36. [page:Number headLength] -- 箭头头部(锥体)的长度. 默认为箭头长度的0.2倍(0.2 * length).<br />
  37. [page:Number headWidth] -- The width of the head of the arrow. Default is 0.2 * headLength.
  38. </p>
  39. <h2>属性</h2>
  40. <p>请到基类 [page:Object3D] 页面查看公共属性.</p>
  41. <h3>[property:Line line]</h3>
  42. <p>包含箭头辅助对象的线段部分.</p>
  43. <h3>[property:Mesh cone]</h3>
  44. <p>包含箭头辅助对象的锥体部分.</p>
  45. <h2>方法</h2>
  46. <p>请到基类 [page:Object3D] 页面查看公共方法.</p>
  47. <h3>[method:null setColor]([param:Color color])</h3>
  48. <p>
  49. color -- 所需的颜色。<br /><br />
  50. 设置箭头辅助对象的颜色.
  51. </p>
  52. <h3>[method:null setLength]([param:Number length], [param:Number headLength], [param:Number headWidth])</h3>
  53. <p>
  54. length -- 要设置的长度.<br />
  55. headLength -- 要设置的箭头头部(锥体)的长度.<br />
  56. headWidth -- The width of the head of the arrow.<br /><br />
  57. 设置箭头辅助对象的长度.
  58. </p>
  59. <h3>[method:null setDirection]([param:Vector3 dir])</h3>
  60. <p>
  61. dir -- 要设置的方向. 必须为单位向量.<br /><br />
  62. 设置箭头辅助对象的方向.
  63. </p>
  64. <h2>源码</h2>
  65. <p>
  66. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  67. </p>
  68. </body>
  69. </html>