2
0

Sprite.html 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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:Boolean isSprite]</h3>
  33. <p>
  34. Read-only flag to check if a given object is of type [name].
  35. </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. A value of (0.5, 0.5) corresponds to the midpoint of the sprite.
  44. A value of (0, 0) corresponds to the lower left corner of the sprite. The default is (0.5, 0.5).
  45. </p>
  46. <h2>Methods</h2>
  47. <p>See the base [page:Object3D] class for common methods.</p>
  48. <h3>[method:Sprite clone]()</h3>
  49. <p>
  50. Returns a clone of this Sprite object and any descendants.
  51. </p>
  52. <h3>[method:this copy]( [param:Sprite sprite] )</h3>
  53. <p>
  54. Copies the properties of the passed sprite to this one.
  55. </p>
  56. <h3>[method:undefined raycast]( [param:Raycaster raycaster], [param:Array intersects] )</h3>
  57. <p>
  58. Get intersections between a casted ray and this sprite. [page:Raycaster.intersectObject]() will call this method.
  59. The raycaster must be initialized by calling [page:Raycaster.setFromCamera]() before 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>