2
0

SpriteMaterial.html 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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_raycast_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 properties defining the material's appearance.
  31. Any property of the material (including any property inherited from [page:Material]) can be passed in here.<br /><br />
  32. The exception is the property [page:Hexadecimal color], which can be passed in as a hexadecimal
  33. string and is *0xffffff* (white) by default. [page:Color.set]( color ) is called internally.
  34. SpriteMaterials are not clipped by using [page:Material.clippingPlanes].
  35. </p>
  36. <h2>Properties</h2>
  37. <p>See the base [page:Material] class for common properties.</p>
  38. <h3>[property:Texture alphaMap]</h3>
  39. <p>The alpha map is a grayscale texture that controls the opacity across the surface
  40. (black: fully transparent; white: fully opaque). Default is null.<br /><br />
  41. Only the color of the texture is used, ignoring the alpha channel if one exists.
  42. For RGB and RGBA textures, the [page:WebGLRenderer WebGL] renderer will use the
  43. green channel when sampling this texture due to the extra bit of precision provided
  44. for green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
  45. luminance/alpha textures will also still work as expected.
  46. </p>
  47. <h3>[property:Color color]</h3>
  48. <p>[page:Color] of the material, by default set to white (0xffffff). The [page:.map] is mutiplied by the color.</p>
  49. <h3>[property:Texture map]</h3>
  50. <p>The texture map. Default is null.</p>
  51. <h3>[property:Radians rotation]</h3>
  52. <p>The rotation of the sprite in radians. Default is 0.</p>
  53. <h3>[property:Boolean sizeAttenuation]</h3>
  54. <p>Whether the size of the sprite is attenuated by the camera depth. (Perspective camera only.) Default is *true*.</p>
  55. <h2>Methods</h2>
  56. <p>See the base [page:Material] class for common methods.</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>