Class cc.LayerColor

Class Summary
Constructor Attributes Constructor Name and Description
 
cc.LayerColor(color, width, height)

CCLayerColor is a subclass of CCLayer that implements the CCRGBAProtocol protocol.

Method Summary

Class Detail

cc.LayerColor(color, width, height)

CCLayerColor is a subclass of CCLayer that implements the CCRGBAProtocol protocol.
All features from CCLayer are valid, plus the following new features:
- opacity
- RGB colors

// Example
//Create a yellow color layer as background
var yellowBackground = new cc.LayerColor(cc.color(255,255,0,255));
//If you didn't pass in width and height, it defaults to the same size as the canvas

//create a yellow box, 200 by 200 in size
var yellowBox = new cc.LayerColor(cc.color(255,255,0,255), 200, 200);
Parameters:
{cc.Color} color Optional
The color of the layer
{Number} width Optional
The width of the layer
{Number} height Optional
The height of the layer

Method Detail

  • changeHeight(h)
    change height in Points
    Parameters:
    {Number} h
    height
    Deprecated:
    since v3.0 please use setContentSize instead
    See:
    cc.Node#setContentSize
  • changeWidth(w)
    Changes width in Points
    Parameters:
    {Number} w
    width
    Deprecated:
    since v3.0 please use setContentSize instead
    See:
    cc.Node#setContentSize
  • changeWidthAndHeight(w, h)
    Changes width and height
    Parameters:
    {Number} w
    width
    {Number} h
    height
    Deprecated:
    since v3.0 please use setContentSize instead
    See:
    cc.Node#setContentSize
  • <static> {cc.LayerColor} cc.LayerColor.create(color, width, height)
    Creates a cc.Layer with color, width and height in Points
    Parameters:
    {cc.Color} color
    {Number|Null} width Optional
    {Number|Null} height Optional
    Deprecated:
    since v3.0 please use the new construction instead
    Returns:
    {cc.LayerColor}
    See:
    cc.LayerColor
  • ctor(color, width, height)
    Constructor of cc.LayerColor
    Parameters:
    {cc.Color} color Optional
    {Number} width Optional
    {Number} height Optional
  • {cc.BlendFunc} getBlendFunc()
    Returns the blend function
    Returns:
    {cc.BlendFunc}
  • {Boolean} init(color, width, height)
    Initialization of the layer, please do not call this function by yourself, you should pass the parameters to constructor to initialize a layer
    Parameters:
    {cc.Color} color Optional
    {Number} width Optional
    {Number} height Optional
    Returns:
    {Boolean}
  • setBlendFunc(src, dst)
    Sets the blend func, you can pass either a cc.BlendFunc object or source and destination value separately
    Parameters:
    {Number|cc.BlendFunc} src
    {Number} dst Optional