mirror of
https://github.com/wassname/phaser.git
synced 2026-08-17 11:23:42 +08:00
Updated documentation.
This commit is contained in:
+90
-31
@@ -54,6 +54,10 @@
|
||||
<a href="Phaser.AnimationParser.html">AnimationParser</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.BitmapData.html">BitmapData</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.BitmapText.html">BitmapText</a>
|
||||
</li>
|
||||
@@ -138,6 +142,10 @@
|
||||
<a href="Phaser.Events.html">Events</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Filter.html">Filter</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Frame.html">Frame</a>
|
||||
</li>
|
||||
@@ -302,6 +310,26 @@
|
||||
<a href="Phaser.Text.html">Text</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Tile.html">Tile</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Tilemap.html">Tilemap</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.TilemapLayer.html">TilemapLayer</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.TilemapParser.html">TilemapParser</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Tileset.html">Tileset</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.TileSprite.html">TileSprite</a>
|
||||
</li>
|
||||
@@ -310,6 +338,10 @@
|
||||
<a href="Phaser.Time.html">Time</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Timer.html">Timer</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Touch.html">Touch</a>
|
||||
</li>
|
||||
@@ -356,6 +388,14 @@
|
||||
<a href="global.html#HEXtoRGB">HEXtoRGB</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="global.html#render">render</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="global.html#renderXY">renderXY</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="global.html#right">right</a>
|
||||
</li>
|
||||
@@ -398,6 +438,7 @@ Phaser.Color = {
|
||||
* Given an alpha and 3 color values this will return an integer representation of it.
|
||||
*
|
||||
* @method Phaser.Color.getColor32
|
||||
* @static
|
||||
* @param {number} alpha - The Alpha value (between 0 and 255).
|
||||
* @param {number} red - The Red channel value (between 0 and 255).
|
||||
* @param {number} green - The Green channel value (between 0 and 255).
|
||||
@@ -412,6 +453,7 @@ Phaser.Color = {
|
||||
* Given 3 color values this will return an integer representation of it.
|
||||
*
|
||||
* @method Phaser.Color.getColor
|
||||
* @static
|
||||
* @param {number} red - The Red channel value (between 0 and 255).
|
||||
* @param {number} green - The Green channel value (between 0 and 255).
|
||||
* @param {number} blue - The Blue channel value (between 0 and 255).
|
||||
@@ -422,17 +464,19 @@ Phaser.Color = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts the given hex string into an object containing the RGB values.
|
||||
* Converts the given hex string into an integer color value.
|
||||
*
|
||||
* @method Phaser.Color.hexToRGB
|
||||
* @static
|
||||
* @param {string} h - The string hex color to convert.
|
||||
* @returns {object} An object with 3 properties: r,g and b.
|
||||
* @returns {number} The rgb color value.
|
||||
*/
|
||||
hexToRGB: function (h) {
|
||||
|
||||
var hex16 = (h.charAt(0) == "#") ? h.substring(1, 7) : h;
|
||||
|
||||
if (hex16.length==3) {
|
||||
if (hex16.length==3)
|
||||
{
|
||||
hex16 = hex16.charAt(0) + hex16.charAt(0) + hex16.charAt(1) + hex16.charAt(1) + hex16.charAt(2) + hex16.charAt(2);
|
||||
}
|
||||
|
||||
@@ -449,6 +493,7 @@ Phaser.Color = {
|
||||
* RGB format information and HSL information. Each section starts on a newline, 3 lines in total.
|
||||
*
|
||||
* @method Phaser.Color.getColorInfo
|
||||
* @static
|
||||
* @param {number} color - A color value in the format 0xAARRGGBB.
|
||||
* @returns {string} String containing the 3 lines of information.
|
||||
*/
|
||||
@@ -457,13 +502,13 @@ Phaser.Color = {
|
||||
var argb = Phaser.Color.getRGB(color);
|
||||
var hsl = Phaser.Color.RGBtoHSV(color);
|
||||
|
||||
// Hex format
|
||||
// Hex format
|
||||
var result = Phaser.Color.RGBtoHexstring(color) + "\n";
|
||||
|
||||
// RGB format
|
||||
// RGB format
|
||||
result = result.concat("Alpha: " + argb.alpha + " Red: " + argb.red + " Green: " + argb.green + " Blue: " + argb.blue) + "\n";
|
||||
|
||||
// HSL info
|
||||
// HSL info
|
||||
result = result.concat("Hue: " + hsl.hue + " Saturation: " + hsl.saturation + " Lightnes: " + hsl.lightness);
|
||||
|
||||
return result;
|
||||
@@ -474,6 +519,7 @@ Phaser.Color = {
|
||||
* Return a string representation of the color in the format 0xAARRGGBB.
|
||||
*
|
||||
* @method Phaser.Color.RGBtoHexstring
|
||||
* @static
|
||||
* @param {number} color - The color to get the string representation for
|
||||
* @returns {string} A string of length 10 characters in the format 0xAARRGGBB
|
||||
*/
|
||||
@@ -489,6 +535,7 @@ Phaser.Color = {
|
||||
* Return a string representation of the color in the format #RRGGBB.
|
||||
*
|
||||
* @method Phaser.Color.RGBtoWebstring
|
||||
* @static
|
||||
* @param {number} color - The color to get the string representation for.
|
||||
* @returns {string} A string of length 10 characters in the format 0xAARRGGBB.
|
||||
*/
|
||||
@@ -504,6 +551,7 @@ Phaser.Color = {
|
||||
* Return a string containing a hex representation of the given color.
|
||||
*
|
||||
* @method Phaser.Color.colorToHexstring
|
||||
* @static
|
||||
* @param {number} color - The color channel to get the hex value for, must be a value between 0 and 255).
|
||||
* @returns {string} A string of length 2 characters, i.e. 255 = FF, 0 = 00.
|
||||
*/
|
||||
@@ -520,11 +568,12 @@ Phaser.Color = {
|
||||
/**
|
||||
* Interpolates the two given colours based on the supplied step and currentStep properties.
|
||||
* @method Phaser.Color.interpolateColor
|
||||
* @param {number} color1 - Description.
|
||||
* @param {number} color2 - Description.
|
||||
* @param {number} steps - Description.
|
||||
* @param {number} currentStep - Description.
|
||||
* @param {number} alpha - Description.
|
||||
* @static
|
||||
* @param {number} color1 - The first color value.
|
||||
* @param {number} color2 - The second color value.
|
||||
* @param {number} steps - The number of steps to run the interpolation over.
|
||||
* @param {number} currentStep - The currentStep value. If the interpolation will take 100 steps, a currentStep value of 50 would be half-way between the two.
|
||||
* @param {number} alpha - The alpha of the returned color.
|
||||
* @returns {number} The interpolated color value.
|
||||
*/
|
||||
interpolateColor: function (color1, color2, steps, currentStep, alpha) {
|
||||
@@ -544,12 +593,13 @@ Phaser.Color = {
|
||||
/**
|
||||
* Interpolates the two given colours based on the supplied step and currentStep properties.
|
||||
* @method Phaser.Color.interpolateColorWithRGB
|
||||
* @param {number} color - Description.
|
||||
* @param {number} r - Description.
|
||||
* @param {number} g - Description.
|
||||
* @param {number} b - Description.
|
||||
* @param {number} steps - Description.
|
||||
* @param {number} currentStep - Description.
|
||||
* @static
|
||||
* @param {number} color - The first color value.
|
||||
* @param {number} r - The red color value, between 0 and 0xFF (255).
|
||||
* @param {number} g - The green color value, between 0 and 0xFF (255).
|
||||
* @param {number} b - The blue color value, between 0 and 0xFF (255).
|
||||
* @param {number} steps - The number of steps to run the interpolation over.
|
||||
* @param {number} currentStep - The currentStep value. If the interpolation will take 100 steps, a currentStep value of 50 would be half-way between the two.
|
||||
* @returns {number} The interpolated color value.
|
||||
*/
|
||||
interpolateColorWithRGB: function (color, r, g, b, steps, currentStep) {
|
||||
@@ -566,14 +616,15 @@ Phaser.Color = {
|
||||
/**
|
||||
* Interpolates the two given colours based on the supplied step and currentStep properties.
|
||||
* @method Phaser.Color.interpolateRGB
|
||||
* @param {number} r1 - Description.
|
||||
* @param {number} g1 - Description.
|
||||
* @param {number} b1 - Description.
|
||||
* @param {number} r2 - Description.
|
||||
* @param {number} g2 - Description.
|
||||
* @param {number} b2 - Description.
|
||||
* @param {number} steps - Description.
|
||||
* @param {number} currentStep - Description.
|
||||
* @static
|
||||
* @param {number} r1 - The red color value, between 0 and 0xFF (255).
|
||||
* @param {number} g1 - The green color value, between 0 and 0xFF (255).
|
||||
* @param {number} b1 - The blue color value, between 0 and 0xFF (255).
|
||||
* @param {number} r2 - The red color value, between 0 and 0xFF (255).
|
||||
* @param {number} g2 - The green color value, between 0 and 0xFF (255).
|
||||
* @param {number} b2 - The blue color value, between 0 and 0xFF (255).
|
||||
* @param {number} steps - The number of steps to run the interpolation over.
|
||||
* @param {number} currentStep - The currentStep value. If the interpolation will take 100 steps, a currentStep value of 50 would be half-way between the two.
|
||||
* @returns {number} The interpolated color value.
|
||||
*/
|
||||
interpolateRGB: function (r1, g1, b1, r2, g2, b2, steps, currentStep) {
|
||||
@@ -588,10 +639,11 @@ Phaser.Color = {
|
||||
|
||||
/**
|
||||
* Returns a random color value between black and white
|
||||
* <p>Set the min value to start each channel from the given offset.</p>
|
||||
* <p>Set the max value to restrict the maximum color used per channel</p>
|
||||
* Set the min value to start each channel from the given offset.
|
||||
* Set the max value to restrict the maximum color used per channel.
|
||||
*
|
||||
* @method Phaser.Color.getRandomColor
|
||||
* @static
|
||||
* @param {number} min - The lowest value to use for the color.
|
||||
* @param {number} max - The highest value to use for the color.
|
||||
* @param {number} alpha - The alpha value of the returning color (default 255 = fully opaque).
|
||||
@@ -603,7 +655,7 @@ Phaser.Color = {
|
||||
if (typeof max === "undefined") { max = 255; }
|
||||
if (typeof alpha === "undefined") { alpha = 255; }
|
||||
|
||||
// Sanity checks
|
||||
// Sanity checks
|
||||
if (max > 255) {
|
||||
return Phaser.Color.getColor(255, 255, 255);
|
||||
}
|
||||
@@ -623,9 +675,10 @@ Phaser.Color = {
|
||||
/**
|
||||
* Return the component parts of a color as an Object with the properties alpha, red, green, blue
|
||||
*
|
||||
* <p>Alpha will only be set if it exist in the given color (0xAARRGGBB)</p>
|
||||
* Alpha will only be set if it exist in the given color (0xAARRGGBB)
|
||||
*
|
||||
* @method Phaser.Color.getRGB
|
||||
* @static
|
||||
* @param {number} color - Color in RGB (0xRRGGBB) or ARGB format (0xAARRGGBB).
|
||||
* @returns {object} An Object with properties: alpha, red, green, blue.
|
||||
*/
|
||||
@@ -643,6 +696,7 @@ Phaser.Color = {
|
||||
/**
|
||||
* Returns a CSS friendly string value from the given color.
|
||||
* @method Phaser.Color.getWebRGB
|
||||
* @static
|
||||
* @param {number} color
|
||||
* @returns {string}A string in the format: 'rgba(r,g,b,a)'
|
||||
*/
|
||||
@@ -661,6 +715,7 @@ Phaser.Color = {
|
||||
* Given a native color value (in the format 0xAARRGGBB) this will return the Alpha component, as a value between 0 and 255.
|
||||
*
|
||||
* @method Phaser.Color.getAlpha
|
||||
* @static
|
||||
* @param {number} color - In the format 0xAARRGGBB.
|
||||
* @returns {number} The Alpha component of the color, will be between 0 and 1 (0 being no Alpha (opaque), 1 full Alpha (transparent)).
|
||||
*/
|
||||
@@ -672,6 +727,7 @@ Phaser.Color = {
|
||||
* Given a native color value (in the format 0xAARRGGBB) this will return the Alpha component as a value between 0 and 1.
|
||||
*
|
||||
* @method Phaser.Color.getAlphaFloat
|
||||
* @static
|
||||
* @param {number} color - In the format 0xAARRGGBB.
|
||||
* @returns {number} The Alpha component of the color, will be between 0 and 1 (0 being no Alpha (opaque), 1 full Alpha (transparent)).
|
||||
*/
|
||||
@@ -683,6 +739,7 @@ Phaser.Color = {
|
||||
* Given a native color value (in the format 0xAARRGGBB) this will return the Red component, as a value between 0 and 255.
|
||||
*
|
||||
* @method Phaser.Color.getRed
|
||||
* @static
|
||||
* @param {number} color In the format 0xAARRGGBB.
|
||||
* @returns {number} The Red component of the color, will be between 0 and 255 (0 being no color, 255 full Red).
|
||||
*/
|
||||
@@ -694,6 +751,7 @@ Phaser.Color = {
|
||||
* Given a native color value (in the format 0xAARRGGBB) this will return the Green component, as a value between 0 and 255.
|
||||
*
|
||||
* @method Phaser.Color.getGreen
|
||||
* @static
|
||||
* @param {number} color - In the format 0xAARRGGBB.
|
||||
* @returns {number} The Green component of the color, will be between 0 and 255 (0 being no color, 255 full Green).
|
||||
*/
|
||||
@@ -705,13 +763,14 @@ Phaser.Color = {
|
||||
* Given a native color value (in the format 0xAARRGGBB) this will return the Blue component, as a value between 0 and 255.
|
||||
*
|
||||
* @method Phaser.Color.getBlue
|
||||
* @static
|
||||
* @param {number} color - In the format 0xAARRGGBB.
|
||||
* @returns {number} The Blue component of the color, will be between 0 and 255 (0 being no color, 255 full Blue).
|
||||
*/
|
||||
getBlue: function (color) {
|
||||
return color & 0xFF;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
</pre>
|
||||
</article>
|
||||
@@ -734,7 +793,7 @@ Phaser.Color = {
|
||||
|
||||
<span class="jsdoc-message">
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
|
||||
on Thu Nov 07 2013 06:07:33 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
</span>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user