Color.html 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <script src="../../list.js"></script>
  6. <script src="../../page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="../../page.css" />
  8. </head>
  9. <body>
  10. <h1>[name]</h1>
  11. <div class="desc">
  12. Represents a color. See also [page:ColorUtils].
  13. </div>
  14. <h2>Example</h2>
  15. <code>var color = new THREE.Color( 0xff0000 );</code>
  16. <h2>Constructor</h2>
  17. <h3>[name]( [page:Integer hex])</h3>
  18. <div>
  19. hex — initial color in hexadecimal<br />
  20. </div>
  21. <h2>Properties</h2>
  22. <h3>.[page:Float r]</h3>
  23. <div>
  24. Red channel value between 0 and 1. Default is 1.
  25. </div>
  26. <h3>.[page:Float g]</h3>
  27. <div>
  28. Green channel value between 0 and 1. Default is 1.
  29. </div>
  30. <h3>.[page:Float b]</h3>
  31. <div>
  32. Blue channel value between 0 and 1. Default is 1.
  33. </div>
  34. <h2>Methods</h2>
  35. <h3>.copy( [page:Color color] ) [page:this]</h3>
  36. <div>
  37. color — Color to copy.
  38. </div>
  39. <div>
  40. Copies given color.
  41. </div>
  42. <h3>.copyGammaToLinear( [page:Color color] ) [page:this]</h3>
  43. <div>
  44. color — Color to copy.
  45. </div>
  46. <div>
  47. Copies given color making conversion from gamma to linear space.
  48. </div>
  49. <h3>.copyLinearToGamma( [page:Color color] ) [page:this]</h3>
  50. <div>
  51. color — Color to copy.
  52. </div>
  53. <div>
  54. Copies given color making conversion from linear to gamma space.
  55. </div>
  56. <h3>.convertGammaToLinear() [page:this]</h3>
  57. <div>
  58. Converts this color from gamma to linear space.
  59. </div>
  60. <h3>.convertLinearToGamma() [page:this]</h3>
  61. <div>
  62. Converts this color from linear to gamma space.
  63. </div>
  64. <h3>.setRGB( [page:Float r], [page:Float g], [page:Float b] ) [page:this]</h3>
  65. <div>
  66. r — Red channel value between 0 and 1.<br />
  67. g — Green channel value between 0 and 1.<br />
  68. b — Blue channel value between 0 and 1.
  69. </div>
  70. <div>
  71. Sets this color from RGB values.
  72. </div>
  73. <h3>.setHSV( [page:Float h], [page:Float s], [page:Float v] ) [page:this]</h3>
  74. <div>
  75. h — Hue channel value between 0 and 1.<br />
  76. s — Saturation value channel between 0 and 1.<br />
  77. v — Value channel value between 0 and 1.
  78. </div>
  79. <div>
  80. Sets this color from HSV values.<br />
  81. Based on MochiKit implementation by Bob Ippolito.
  82. </div>
  83. <h3>.getHex() [page:Integer]</h3>
  84. <div>
  85. Returns the hexadecimal value of this color.
  86. </div>
  87. <h3>.getHexString() [page:String]</h3>
  88. <div>
  89. Returns the string formated hexadecimal value of this color.
  90. </div>
  91. <h3>.setHex( [page:Integer hex] ) [page:this]</h3>
  92. <div>
  93. hex — Color in hexadecimal.<br />
  94. </div>
  95. <div>
  96. Sets this color from a hexadecimal value.
  97. </div>
  98. <h3>.getContextStyle() [page:String]</h3>
  99. <div>
  100. Returns the value of this color in CSS context style.<br />
  101. Example: rgb(r, g, b)
  102. </div>
  103. <h3>.setContextStyle( [page:String contextStyle] ) [page:this]</h3>
  104. <div>
  105. contextStyle — Color in CSS context style format.<br />
  106. </div>
  107. <div>
  108. Sets this color from a CSS context style string.
  109. </div>
  110. <h3>.clone() [page:Color]</h3>
  111. <div>
  112. Clones this color.
  113. </div>
  114. <h2>Source</h2>
  115. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  116. </body>
  117. </html>