Sprite.html 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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">
  13. A sprite is a plane that always faces towards the camera, generally with a
  14. partially transparent texture applied.<br /><br />
  15. Sprites do not cast shadows, setting <code>castShadow = true</code> will have no effect.
  16. </p>
  17. <h2>Code Example</h2>
  18. <code>
  19. const map = new THREE.TextureLoader().load( 'sprite.png' );
  20. const material = new THREE.SpriteMaterial( { map: map } );
  21. const sprite = new THREE.Sprite( material );
  22. scene.add( sprite );
  23. </code>
  24. <h2>Constructor</h2>
  25. <h3>[name]( [param:Material material] )</h3>
  26. <p>
  27. [page:Material material] - (optional) an instance of [page:SpriteMaterial]. Default is a white [page:SpriteMaterial].<br /><br />
  28. Creates a new [name].
  29. </p>
  30. <h2>Properties</h2>
  31. <p>See the base [page:Object3D] class for common properties.</p>
  32. <h3>[property:SpriteMaterial material]</h3>
  33. <p>
  34. An instance of [page:SpriteMaterial], defining the object's appearance.
  35. Default is a white [page:SpriteMaterial].
  36. </p>
  37. <h3>[property:Vector2 center]</h3>
  38. <p>
  39. The sprite's anchor point, and the point around which the sprite rotates. A value of (0.5, 0.5) corresponds to the midpoint of the sprite.
  40. A value of (0, 0) corresponds to the lower left corner of the sprite. The default is (0.5, 0.5).
  41. </p>
  42. <h2>Methods</h2>
  43. <p>See the base [page:Object3D] class for common methods.</p>
  44. <h3>[method:Sprite clone]()</h3>
  45. <p>
  46. Returns a clone of this Sprite object and any descendants.
  47. </p>
  48. <h3>[method:Sprite copy]( [param:Sprite sprite] )</h3>
  49. <p>
  50. Copies the properties of the passed sprite to this one.
  51. </p>
  52. <h3>[method:null raycast]( [param:Raycaster raycaster], [param:Array intersects] )</h3>
  53. <p>
  54. Get intersections between a casted ray and this sprite. [page:Raycaster.intersectObject]() will call this method.
  55. The raycaster must be initialized by calling [page:Raycaster.setFromCamera]() before raycasting against sprites.
  56. </p>
  57. <h2>Source</h2>
  58. <p>
  59. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  60. </p>
  61. </body>
  62. </html>