SpriteMaterial.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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">
  37. <strong>parameters</strong>
  38. </td>
  39. <td class="description last">
  40. <p>An object with one or more properties
  41. defining the material's appearance. Any property of the material
  42. (including any property from inherited materials) can be passed
  43. in here. Color values can be passed any type of value accepted
  44. by <a href="Color.html#set">Color#set</a>.</p>
  45. </td>
  46. </tr>
  47. </tbody>
  48. </table>
  49. </div>
  50. </div>
  51. <h2 class="subsection-title">Properties</h2>
  52. <div class="member">
  53. <h3 class="name" id="alphaMap" translate="no">.<a href="#alphaMap">alphaMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  54. <div class="description">
  55. <p>The alpha map is a grayscale texture that controls the opacity across the
  56. surface (black: fully transparent; white: fully opaque).</p>
  57. <p>Only the color of the texture is used, ignoring the alpha channel if one
  58. exists. For RGB and RGBA textures, the renderer will use the green channel
  59. when sampling this texture due to the extra bit of precision provided for
  60. green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
  61. luminance/alpha textures will also still work as expected.</p>
  62. <p>Default is <code>null</code>.</p>
  63. </div>
  64. </div>
  65. <div class="member">
  66. <h3 class="name" id="color" translate="no">.<a href="#color">color</a><span class="type-signature"> : <a href="Color.html">Color</a></span> </h3>
  67. <div class="description">
  68. <p>Color of the material.</p>
  69. <p>Default is <code>(1,1,1)</code>.</p>
  70. </div>
  71. </div>
  72. <div class="member">
  73. <h3 class="name" id="fog" translate="no">.<a href="#fog">fog</a><span class="type-signature"> : boolean</span> </h3>
  74. <div class="description">
  75. <p>Whether the material is affected by fog or not.</p>
  76. <p>Default is <code>true</code>.</p>
  77. </div>
  78. </div>
  79. <div class="member">
  80. <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>
  81. <div class="description">
  82. <p>This flag can be used for type testing.</p>
  83. <p>Default is <code>true</code>.</p>
  84. </div>
  85. </div>
  86. <div class="member">
  87. <h3 class="name" id="map" translate="no">.<a href="#map">map</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  88. <div class="description">
  89. <p>The color map. May optionally include an alpha channel, typically combined
  90. with <a href="Material.html#transparent">Material#transparent</a> or <a href="Material.html#alphaTest">Material#alphaTest</a>. The texture map
  91. color is modulated by the diffuse <code>color</code>.</p>
  92. <p>Default is <code>null</code>.</p>
  93. </div>
  94. </div>
  95. <div class="member">
  96. <h3 class="name" id="rotation" translate="no">.<a href="#rotation">rotation</a><span class="type-signature"> : number</span> </h3>
  97. <div class="description">
  98. <p>The rotation of the sprite in radians.</p>
  99. <p>Default is <code>0</code>.</p>
  100. </div>
  101. </div>
  102. <div class="member">
  103. <h3 class="name" id="sizeAttenuation" translate="no">.<a href="#sizeAttenuation">sizeAttenuation</a><span class="type-signature"> : boolean</span> </h3>
  104. <div class="description">
  105. <p>Specifies whether size of the sprite is attenuated by the camera depth (perspective camera only).</p>
  106. <p>Default is <code>true</code>.</p>
  107. </div>
  108. </div>
  109. <div class="member">
  110. <h3 class="name" id="transparent" translate="no">.<a href="#transparent">transparent</a><span class="type-signature"> : boolean</span> </h3>
  111. <div class="description">
  112. <p>Overwritten since sprite materials are transparent
  113. by default.</p>
  114. <p>Default is <code>true</code>.</p>
  115. </div>
  116. <dl class="details">
  117. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Material.html#transparent">Material#transparent</a></dt>
  118. </dl>
  119. </div>
  120. <h2 class="subsection-title">Source</h2>
  121. <p>
  122. <a href="https://github.com/mrdoob/three.js/blob/master/src/materials/SpriteMaterial.js" translate="no" target="_blank" rel="noopener">src/materials/SpriteMaterial.js</a>
  123. </p>
  124. </article>
  125. </section>
  126. <script src="../scripts/linenumber.js"></script>
  127. <script src="../scripts/page.js"></script>
  128. </body>
  129. </html>
粤ICP备19079148号