SpriteMaterial.html 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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:Material] &rarr;
  11. <h1>[name]</h1>
  12. <p class="desc">A material for a use with a [page:Sprite].</p>
  13. <h2>Code Example</h2>
  14. <code>
  15. const map = new THREE.TextureLoader().load( 'textures/sprite.png' );
  16. const material = new THREE.SpriteMaterial( { map: map, color: 0xffffff } );
  17. const sprite = new THREE.Sprite( material );
  18. sprite.scale.set(200, 200, 1)
  19. scene.add( sprite );
  20. </code>
  21. <h2>Examples</h2>
  22. <p>
  23. [example:webgl_raycaster_sprite WebGL / raycast / sprite]<br />
  24. [example:webgl_sprites WebGL / sprites]<br />
  25. [example:svg_sandbox SVG / sandbox]
  26. </p>
  27. <h2>Constructor</h2>
  28. <h3>[name]( [param:Object parameters] )</h3>
  29. <p>
  30. [page:Object parameters] - (optional) an object with one or more
  31. properties defining the material's appearance. Any property of the
  32. material (including any property inherited from [page:Material]) can be
  33. passed in here.<br /><br />
  34. The exception is the property [page:Hexadecimal color], which can be
  35. passed in as a hexadecimal string and is `0xffffff` (white) by default.
  36. [page:Color.set]( color ) is called internally. SpriteMaterials are not
  37. clipped by using [page:Material.clippingPlanes].
  38. </p>
  39. <h2>Properties</h2>
  40. <p>See the base [page:Material] class for common properties.</p>
  41. <h3>[property:Texture alphaMap]</h3>
  42. <p>
  43. The alpha map is a grayscale texture that controls the opacity across the
  44. surface (black: fully transparent; white: fully opaque). Default is
  45. null.<br /><br />
  46. Only the color of the texture is used, ignoring the alpha channel if one
  47. exists. For RGB and RGBA textures, the [page:WebGLRenderer WebGL] renderer
  48. will use the green channel when sampling this texture due to the extra bit
  49. of precision provided for green in DXT-compressed and uncompressed RGB 565
  50. formats. Luminance-only and luminance/alpha textures will also still work
  51. as expected.
  52. </p>
  53. <h3>[property:Color color]</h3>
  54. <p>
  55. [page:Color] of the material, by default set to white (0xffffff). The
  56. [page:.map] is multiplied by the color.
  57. </p>
  58. <h3>[property:Boolean fog]</h3>
  59. <p>Whether the material is affected by fog. Default is `true`.</p>
  60. <h3>[property:Boolean isSpriteMaterial]</h3>
  61. <p>Read-only flag to check if a given object is of type [name].</p>
  62. <h3>[property:Texture map]</h3>
  63. <p>
  64. The color map. May optionally include an alpha channel, typically combined
  65. with [page:Material.transparent .transparent] or [page:Material.alphaTest .alphaTest].
  66. Default is null.
  67. </p>
  68. <h3>[property:Radians rotation]</h3>
  69. <p>The rotation of the sprite in radians. Default is `0`.</p>
  70. <h3>[property:Boolean sizeAttenuation]</h3>
  71. <p>
  72. Whether the size of the sprite is attenuated by the camera depth.
  73. (Perspective camera only.) Default is `true`.
  74. </p>
  75. <h3>[property:Boolean transparent]</h3>
  76. <p>Defines whether this material is transparent. Default is `true`.</p>
  77. <h2>Methods</h2>
  78. <p>See the base [page:Material] class for common methods.</p>
  79. <h2>Source</h2>
  80. <p>
  81. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  82. </p>
  83. </body>
  84. </html>