Class Index | File Index

Classes


Class cc.LayerGradient


Extends cc.LayerColor.

Defined in: CCLayer.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
CCLayerGradient is a subclass of cc.LayerColor that draws gradients across
the background.
Method Summary
Method Attributes Method Name and Description
<static>  
cc.LayerGradient.create(start, end, v)
creates a gradient layer
 
ctor()
Constructor
 
draw(ctx)
 
get the end color
 
get the end gradient opacity
 
get the starting color
 
get the starting gradient opacity
 
 
init(start, end, v)
 
is Compressed Interpolation
 
 
setEndColor(color)
set the end gradient color
 
set the end gradient opacity
 
set the starting color
 
set starting gradient opacity
 
setVector(Var)
set vector
Methods borrowed from class cc.LayerColor:
changeHeight, changeWidth, changeWidthAndHeight, getBlendFunc, getColor, getOpacity, isOpacityModifyRGB, setBlendFunc, setColor, setContentSize, setOpacity, setOpacityModifyRGB
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.LayerGradient()
CCLayerGradient is a subclass of cc.LayerColor that draws gradients across
the background.

All features from cc.LayerColor are valid, plus the following new features:
  • direction
  • final color
  • interpolation mode

Color is interpolated between the startColor and endColor along the given
vector (starting at the origin, ending at the terminus). If no vector is
supplied, it defaults to (0, -1) -- a fade from top to bottom.

If 'compressedInterpolation' is disabled, you will not see either the start or end color for
non-cardinal vectors; a smooth gradient implying both end points will be still
be drawn, however.

If ' compressedInterpolation' is enabled (default mode) you will see both the start and end colors of the gradient.
Method Detail
<static> {cc.LayerGradient} cc.LayerGradient.create(start, end, v)
creates a gradient layer
Parameters:
{cc.Color3B} start
starting color
{cc.Color3B} end
ending color
{cc.Point|Null} v
Returns:
{cc.LayerGradient}

ctor()
Constructor

draw(ctx)
Parameters:
ctx

{cc.Color3B} getEndColor()
get the end color
Returns:
{cc.Color3B}

{Number} getEndOpacity()
get the end gradient opacity
Returns:
{Number}

{cc.Color3B} getStartColor()
get the starting color
Returns:
{cc.Color3B}

{Number} getStartOpacity()
get the starting gradient opacity
Returns:
{Number}

{cc.Point} getVector()
Returns:
{cc.Point}

{Boolean} init(start, end, v)
Parameters:
{cc.Color3B} start
starting color
{cc.Color3B} end
{cc.Point|Null} v
Returns:
{Boolean}

{Boolean} isCompressedInterpolation()
is Compressed Interpolation
Returns:
{Boolean}

setCompressedInterpolation(compress)
Parameters:
{Boolean} compress

setEndColor(color)
set the end gradient color
// Example
myGradientLayer.setEndColor(cc.c3b(255,0,0));
//set the ending gradient to red
Parameters:
{cc.Color3B} color

setEndOpacity(o)
set the end gradient opacity
Parameters:
{Number} o

setStartColor(color)
set the starting color
// Example
myGradientLayer.setStartColor(cc.c3b(255,0,0));
//set the starting gradient to red
Parameters:
{cc.Color3B} color

setStartOpacity(o)
set starting gradient opacity
Parameters:
{Number} o
from 0 to 255, 0 is transparent

setVector(Var)
set vector
Parameters:
{cc.Point} Var

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Jan 09 2013 07:51:52 GMT-0800 (PST)