Class cc.LayerColor

Class Summary
Constructor Attributes Constructor Name and Description
 

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

Method Summary

Class Detail

cc.LayerColor()

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

Method Detail

  • changeHeight(h)
    change height in Points
    Parameters:
    {Number} h
    height
  • changeWidth(w)
    change width in Points
    Parameters:
    {Number} w
    width
  • changeWidthAndHeight(w, h)
    change width and height in Points
    Parameters:
    {Number} w
    width
    {Number} h
    height
  • <static> {cc.LayerColor} cc.LayerColor.create(color, width, height)
    creates a cc.Layer with color, width and height in Points
    // Example
    //Create a yellow color layer as background
    var yellowBackground = cc.LayerColor.create(cc.color(255,255,0,255));
    //If you didnt 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 = cc.LayerColor.create(cc.color(255,255,0,255), 200, 200);
    Parameters:
    {cc.Color} color
    {Number|Null} width Optional
    {Number|Null} height Optional
    Returns:
    {cc.LayerColor}
  • ctor(color, width, height)
    Parameters:
    {cc.Color} color Optional
    {Number} width Optional
    {Number} height Optional
  • draw(ctx)
    Renders the layer
    Parameters:
    {CanvasRenderingContext2D|WebGLRenderingContext} ctx
  • {cc.BlendFunc} getBlendFunc()
    blendFunc getter
    Returns:
    {cc.BlendFunc}
  • {Boolean} init(color, width, height)
    Parameters:
    {cc.Color} color Optional
    {Number} width Optional
    {Number} height Optional
    Returns:
    {Boolean}
  • {Boolean} isOpacityModifyRGB()
    is OpacityModifyRGB
    Returns:
    {Boolean}
  • setBlendFunc(src, dst)
    blendFunc setter
    Parameters:
    {Number} src
    {Number} dst
  • setContentSize(size, height)
    Sets the untransformed size of the LayerColor.
    Parameters:
    {cc.Size|Number} size
    The untransformed size of the LayerColor or The untransformed size's width of the LayerColor.
    {Number} height Optional
    The untransformed size's height of the LayerColor.
  • setOpacityModifyRGB(value)
    set OpacityModifyRGB of cc.LayerColor
    Parameters:
    {Boolean} value