ArrowHelper.html 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <!DOCTYPE html>
  2. <html lang="en">
  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:Object3D] &rarr;
  11. <h1>[name]</h1>
  12. <p class="desc">An 3D arrow object for visualizing directions.</p>
  13. <h2>Code Example</h2>
  14. <code>
  15. const dir = new THREE.Vector3( 1, 2, 0 );
  16. //normalize the direction vector (convert to vector of length 1)
  17. dir.normalize();
  18. const origin = new THREE.Vector3( 0, 0, 0 );
  19. const length = 1;
  20. const hex = 0xffff00;
  21. const arrowHelper = new THREE.ArrowHelper( dir, origin, length, hex );
  22. scene.add( arrowHelper );
  23. </code>
  24. <h2>Examples</h2>
  25. <p>[example:webgl_shadowmesh WebGL / shadowmesh]</p>
  26. <h2>Constructor</h2>
  27. <h3>
  28. [name]([param:Vector3 dir], [param:Vector3 origin], [param:Number length],
  29. [param:Number hex], [param:Number headLength], [param:Number headWidth] )
  30. </h3>
  31. <p>
  32. [page:Vector3 dir] -- direction from origin. Must be a unit vector. <br />
  33. [page:Vector3 origin] -- Point at which the arrow starts.<br />
  34. [page:Number length] -- length of the arrow. Default is `1`.<br />
  35. [page:Number hex] -- hexadecimal value to define color. Default is
  36. 0xffff00.<br />
  37. [page:Number headLength] -- The length of the head of the arrow. Default
  38. is `0.2` * length.<br />
  39. [page:Number headWidth] -- The width of the head of the arrow. Default is
  40. `0.2` * headLength.<br />
  41. </p>
  42. <h2>Properties</h2>
  43. <p>See the base [page:Object3D] class for common properties.</p>
  44. <h3>[property:Line line]</h3>
  45. <p>Contains the line part of the arrowHelper.</p>
  46. <h3>[property:Mesh cone]</h3>
  47. <p>Contains the cone part of the arrowHelper.</p>
  48. <h2>Methods</h2>
  49. <p>See the base [page:Object3D] class for common methods.</p>
  50. <h3>[method:undefined setColor]([param:Color color])</h3>
  51. <p>
  52. color -- The desired color.<br /><br />
  53. Sets the color of the arrowHelper.
  54. </p>
  55. <h3>
  56. [method:undefined setLength]([param:Number length], [param:Number headLength], [param:Number headWidth])
  57. </h3>
  58. <p>
  59. length -- The desired length.<br />
  60. headLength -- The length of the head of the arrow.<br />
  61. headWidth -- The width of the head of the arrow.<br /><br />
  62. Sets the length of the arrowhelper.
  63. </p>
  64. <h3>[method:undefined setDirection]([param:Vector3 dir])</h3>
  65. <p>
  66. dir -- The desired direction. Must be a unit vector.<br /><br />
  67. Sets the direction of the arrowhelper.
  68. </p>
  69. <h3>[method:undefined dispose]()</h3>
  70. <p>
  71. Frees the GPU-related resources allocated by this instance. Call this
  72. method whenever this instance is no longer used in your app.
  73. </p>
  74. <h2>Source</h2>
  75. <p>
  76. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  77. </p>
  78. </body>
  79. </html>