Class cc.LayerColor
Extends
cc.Layer.
Defined in: CCLayer.js.
Constructor Attributes | Constructor Name and Description |
---|---|
CCLayerColor is a subclass of CCLayer that implements the CCRGBAProtocol protocol.
|
Method Attributes | Method Name and Description |
---|---|
changeHeight(h)
change height in Points
|
|
changeWidth(w)
change width in Points
|
|
changeWidthAndHeight(w, h)
change width and height in Points
|
|
<static> |
cc.LayerColor.create(color, width, height)
creates a cc.Layer with color, width and height in Points
|
ctor()
Constructor
|
|
draw(ctx)
renders the layer
|
|
blendFunc getter
|
|
getColor()
color getter
|
|
opacity getter
|
|
init(color, width, height)
|
|
is OpacityModifyRGB
|
|
setBlendFunc(src, dst)
blendFunc setter
|
|
setColor(Var)
color setter
|
|
setContentSize(size)
override contentSize
|
|
setOpacity(Var)
opacity setter
|
|
setOpacityModifyRGB(value)
set OpacityModifyRGB of cc.LayerColor
|
- Methods borrowed from class cc.Layer:
- didAccelerate, getMousePriority, getTouchMode, getTouchPriority, isAccelerometerEnabled, isKeyboardEnabled, isMouseEnabled, isTouchEnabled, onEnter, onEnterTransitionDidFinish, onExit, onMouseDown, onMouseDragged, onMouseEntered, onMouseExited, onMouseMoved, onMouseUp, onOtherMouseDown, onOtherMouseDragged, onOtherMouseUp, onRightMouseDown, onRightMouseDragged, onRightMouseUp, onScrollWheel, onTouchBegan, onTouchCancelled, onTouchEnded, onTouchesBegan, onTouchesCancelled, onTouchesEnded, onTouchesMoved, onTouchMoved, registerWithTouchDispatcher, setAccelerometerEnabled, setKeyboardEnabled, setMouseEnabled, setMousePriority, setTouchEnabled, setTouchMode, setTouchPriority
- Methods borrowed from class cc.Node:
- addChild, cleanup, convertToNodeSpace, convertToNodeSpaceAR, convertTouchToNodeSpace, convertTouchToNodeSpaceAR, convertToWorldSpace, convertToWorldSpaceAR, description, getActionByTag, getActionManager, getAnchorPoint, getAnchorPointInPoints, getBoundingBox, getBoundingBoxToWorld, getCamera, getChildByTag, getChildren, getChildrenCount, getContentSize, getGLServerState, getGrid, getOrderOfArrival, getParent, getPosition, getPositionX, getPositionY, getRotation, getScale, getScaleX, getScaleY, getScheduler, getShaderProgram, getSkewX, getSkewY, getTag, getUserData, getUserObject, getVertexZ, getZOrder, ignoreAnchorPointForPosition, isIgnoreAnchorPointForPosition, isRunning, isVisible, nodeToParentTransform, nodeToWorldTransform, numberOfRunningActions, onExitTransitionDidStart, parentToNodeTransform, pauseSchedulerAndActions, release, removeAllChildren, removeAllChildrenWithCleanup, removeChild, removeChildByTag, removeFromParent, removeFromParentAndCleanup, reorderChild, resumeSchedulerAndActions, retain, runAction, schedule, scheduleOnce, scheduleUpdate, scheduleUpdateWithPriority, setActionManager, setAnchorPoint, setGLServerState, setGrid, setNodeDirty, setOrderOfArrival, setParent, setPosition, setPositionX, setPositionY, setRotation, setScale, setScaleX, setScaleY, setScheduler, setShaderProgram, setSkewX, setSkewY, setTag, setUserData, setUserObject, setVertexZ, setVisible, setZOrder, sortAllChildren, stopAction, stopActionByTag, stopAllActions, transform, transformAncestors, unschedule, unscheduleAllCallbacks, unscheduleUpdate, update, updateTransform, visit, worldToNodeTransform
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:
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.c4b(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.c3b(255,255,0,255), 200, 200);
- Parameters:
- {cc.Color4B} color
- {Number|Null} width
- {Number|Null} height
- Returns:
- {cc.LayerColor}
ctor()
Constructor
draw(ctx)
renders the layer
- Parameters:
- {CanvasContext|Null} ctx
{cc.BlendFunc}
getBlendFunc()
blendFunc getter
- Returns:
- {cc.BlendFunc}
{cc.Color3B}
getColor()
color getter
- Returns:
- {cc.Color3B}
{Number}
getOpacity()
opacity getter
- Returns:
- {Number}
{Boolean}
init(color, width, height)
- Parameters:
- color
- width
- height
- Returns:
- {Boolean}
{Boolean}
isOpacityModifyRGB()
is OpacityModifyRGB
- Returns:
- {Boolean}
setBlendFunc(src, dst)
blendFunc setter
- Parameters:
- {Number} src
- {Number} dst
setColor(Var)
color setter
- Parameters:
- {cc.Color3B} Var
setContentSize(size)
override contentSize
- Parameters:
- {cc.Size} size
setOpacity(Var)
opacity setter
- Parameters:
- {Number} Var
- a number between 0 and 255, 0 is totally transparent
setOpacityModifyRGB(value)
set OpacityModifyRGB of cc.LayerColor
- Parameters:
- {Boolean} value