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