SpriteMaterial.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>SpriteMaterial - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <p class="inheritance" translate="no"><a href="EventDispatcher.html">EventDispatcher</a> → <a href="Material.html">Material</a> → </p>
  13. <h1 translate="no">SpriteMaterial</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A material for rendering instances of <a href="Sprite.html">Sprite</a>.</p></div>
  17. <h2>Code Example</h2>
  18. <div translate="no"><pre><code class="language-js">const map = new THREE.TextureLoader().load( 'textures/sprite.png' );
  19. const material = new THREE.SpriteMaterial( { map: map, color: 0xffffff } );
  20. const sprite = new THREE.Sprite( material );
  21. sprite.scale.set(200, 200, 1)
  22. scene.add( sprite );
  23. </code></pre></div>
  24. </header>
  25. <article>
  26. <div class="container-overview">
  27. <h2>Constructor</h2>
  28. <h3 class="name name-method" id="SpriteMaterial" translate="no">new <a href="#SpriteMaterial">SpriteMaterial</a><span class="signature">( parameters : <span class="param-type">Object</span> )</span> </h3>
  29. <div class="method">
  30. <div class="description">
  31. <p>Constructs a new sprite material.</p>
  32. </div>
  33. <table class="params">
  34. <tbody>
  35. <tr>
  36. <td class="name"><code>parameters</code></td>
  37. <td class="description last"><p>An object with one or more properties
  38. defining the material's appearance. Any property of the material
  39. (including any property from inherited materials) can be passed
  40. in here. Color values can be passed any type of value accepted
  41. by <a href="Color.html#set">Color#set</a>.</p></td>
  42. </tr>
  43. </tbody>
  44. </table>
  45. </div>
  46. </div>
  47. <h2 class="subsection-title">Properties</h2>
  48. <div class="member">
  49. <h3 class="name" id="alphaMap" translate="no">.<a href="#alphaMap">alphaMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  50. <div class="description">
  51. <p>The alpha map is a grayscale texture that controls the opacity across the
  52. surface (black: fully transparent; white: fully opaque).</p>
  53. <p>Only the color of the texture is used, ignoring the alpha channel if one
  54. exists. For RGB and RGBA textures, the renderer will use the green channel
  55. when sampling this texture due to the extra bit of precision provided for
  56. green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
  57. luminance/alpha textures will also still work as expected.<br/>Default is <code>null</code>.</p>
  58. </div>
  59. </div>
  60. <div class="member">
  61. <h3 class="name" id="color" translate="no">.<a href="#color">color</a><span class="type-signature"> : <a href="Color.html">Color</a></span> </h3>
  62. <div class="description">
  63. <p>Color of the material.<br/>Default is <code>(1,1,1)</code>.</p>
  64. </div>
  65. </div>
  66. <div class="member">
  67. <h3 class="name" id="fog" translate="no">.<a href="#fog">fog</a><span class="type-signature"> : boolean</span> </h3>
  68. <div class="description">
  69. <p>Whether the material is affected by fog or not.<br/>Default is <code>true</code>.</p>
  70. </div>
  71. </div>
  72. <div class="member">
  73. <h3 class="name" id="isSpriteMaterial" translate="no">.<a href="#isSpriteMaterial">isSpriteMaterial</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  74. <div class="description">
  75. <p>This flag can be used for type testing.<br/>Default is <code>true</code>.</p>
  76. </div>
  77. </div>
  78. <div class="member">
  79. <h3 class="name" id="map" translate="no">.<a href="#map">map</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  80. <div class="description">
  81. <p>The color map. May optionally include an alpha channel, typically combined
  82. with <a href="Material.html#transparent">Material#transparent</a> or <a href="Material.html#alphaTest">Material#alphaTest</a>. The texture map
  83. color is modulated by the diffuse <code>color</code>.<br/>Default is <code>null</code>.</p>
  84. </div>
  85. </div>
  86. <div class="member">
  87. <h3 class="name" id="rotation" translate="no">.<a href="#rotation">rotation</a><span class="type-signature"> : number</span> </h3>
  88. <div class="description">
  89. <p>The rotation of the sprite in radians.<br/>Default is <code>0</code>.</p>
  90. </div>
  91. </div>
  92. <div class="member">
  93. <h3 class="name" id="sizeAttenuation" translate="no">.<a href="#sizeAttenuation">sizeAttenuation</a><span class="type-signature"> : boolean</span> </h3>
  94. <div class="description">
  95. <p>Specifies whether size of the sprite is attenuated by the camera depth (perspective camera only).<br/>Default is <code>true</code>.</p>
  96. </div>
  97. </div>
  98. <div class="member">
  99. <h3 class="name" id="transparent" translate="no">.<a href="#transparent">transparent</a><span class="type-signature"> : boolean</span> </h3>
  100. <div class="description">
  101. <p>Overwritten since sprite materials are transparent
  102. by default.<br/>Default is <code>true</code>.</p>
  103. </div>
  104. <dl class="details">
  105. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Material.html#transparent">Material#transparent</a></dt>
  106. </dl>
  107. </div>
  108. <h2 class="subsection-title">Source</h2>
  109. <p>
  110. <a href="https://github.com/mrdoob/three.js/blob/master/src/materials/SpriteMaterial.js" target="_blank" rel="noopener" translate="no">src/materials/SpriteMaterial.js</a>
  111. </p>
  112. </article>
  113. </section>
  114. <script src="../scripts/linenumber.js"></script>
  115. <script src="../scripts/page.js"></script>
  116. </body>
  117. </html>
粤ICP备19079148号