Namespace cc

Method Summary

Field Detail

<static> <constant> cc.ACTION_TAG_INVALID
Default Action tag
Defined in: CCAction.js.
<static> <constant> {Number} cc.ADJUST_FACTOR
The adjust factor is needed to prevent issue #442
One solution is to use DONT_RENDER_IN_SUBPIXELS images, but NO
The other issue is that in some transitions (and I don't know why)
the order should be reversed (In in top of Out or vice-versa).
Defined in: CCTransition.js.
<static> <constant> {Number} cc.ALIGN_BOTTOM
Horizontal center and vertical bottom.
Defined in: CCTexture2D.js.
<static> <constant> {Number} cc.ALIGN_BOTTOM_LEFT
Horizontal left and vertical bottom.
Defined in: CCTexture2D.js.
<static> <constant> {Number} cc.ALIGN_BOTTOM_RIGHT
Horizontal right and vertical bottom.
Defined in: CCTexture2D.js.
<static> <constant> {Number} cc.ALIGN_CENTER
Horizontal center and vertical center.
Defined in: CCTexture2D.js.
<static> <constant> {Number} cc.ALIGN_LEFT
Horizontal left and vertical center.
Defined in: CCTexture2D.js.
<static> <constant> {Number} cc.ALIGN_RIGHT
Horizontal right and vertical center.
Defined in: CCTexture2D.js.
<static> <constant> {Number} cc.ALIGN_TOP
Horizontal center and vertical top.
Defined in: CCTexture2D.js.
<static> <constant> {Number} cc.ALIGN_TOP_LEFT
Horizontal left and vertical top.
Defined in: CCTexture2D.js.
<static> <constant> {Number} cc.ALIGN_TOP_RIGHT
Horizontal right and vertical top.
Defined in: CCTexture2D.js.
<static> <constant> cc.ATTRIBUTE_NAME_COLOR

Defined in: CCMacro.js.
<static> <constant> cc.ATTRIBUTE_NAME_POSITION

Defined in: CCMacro.js.
<static> <constant> cc.ATTRIBUTE_NAME_TEX_COORD

Defined in: CCMacro.js.
<static> cc.Audio
Encapsulate DOM and webAudio
Defined in: CCAudio.js.
<static> <constant> {Number} cc.BLEND_DST
default gl blend dst function. Compatible with premultiplied alpha images.
Defined in: CCMacro.js.
<static> <constant> {Number} cc.BLEND_SRC
default gl blend src function. Compatible with premultiplied alpha images.
Defined in: CCMacro.js.
<static> cc.Camera

A CCCamera is used in every CCNode.
The OpenGL gluLookAt() function is used to locate the camera.

If the object is transformed by any of the scale, rotation or position attributes, then they will override the camera.

IMPORTANT: Either your use the camera or the rotation/scale/position properties. You can't use both.
World coordinates won't work if you use the camera.

Limitations:
- Some nodes, like CCParallaxNode, CCParticle uses world node coordinates, and they won't work properly if you move them (or any of their ancestors)
using the camera.

- It doesn't work on batched nodes like CCSprite objects when they are parented to a CCSpriteBatchNode object.

- It is recommended to use it ONLY if you are going to create 3D effects. For 2D effecs, use the action CCFollow or position/scale/rotate. *


Defined in: CCCamera.js.
<static> <constant> {Number} cc.CLAMP_TO_EDGE
the constant variable equals gl.CLAMP_TO_EDGE for texture
Defined in: CCMacro.js.
<static> <constant> cc.COCOSNODE_RENDER_SUBPIXEL

If enabled, the cc.Node objects (cc.Sprite, cc.Label,etc) will be able to render in subpixels.
If disabled, integer pixels will be used.

To enable set it to 1. Enabled by default.
To modify it, in Web engine please refer to CCConfig.js, in JSB please refer to CCConfig.h


Defined in: CCConfig.js.
<static> cc.CONTROL_EVENT_TOTAL_NUMBER
Number of kinds of control event.
Defined in: CCControl.js.
<static> cc.CONTROL_EVENT_TOUCH_DOWN
Kinds of possible events for the control objects.
Defined in: CCControl.js.
<static> cc.CONTROL_STATE_NORMAL
The possible state for a control.
Defined in: CCControl.js.
<static> {Array} cc.copyControlPoints
returns a new clone of the controlPoints
Defined in: CCActionCatmullRom.js.
Deprecated:
since v3.0 please use cc.cloneControlPoints() instead.
<static> <constant> {Number} cc.CURRENT_ITEM
default tag for current item
Defined in: CCMacro.js.
<static> <constant> cc.DEFAULT_ENGINE
Default engine
Defined in: CCConfig.js.
<static> <constant> {Number} cc.DEFAULT_PADDING

Defined in: CCMenu.js.
<static> cc.defaultFPS
Default fps is 60
Defined in: CCDirector.js.
<static> <constant> {Number} cc.DEG

Defined in: CCMacro.js.
<static> <constant> {Number} cc.DEVICE_MAX_ORIENTATIONS
In browsers, we only support 2 orientations by change window size.
Defined in: CCMacro.js.
<static> <constant> {Number} cc.DEVICE_ORIENTATION_LANDSCAPE_LEFT
Device oriented horizontally, home button on the right (UIDeviceOrientationLandscapeLeft)
Defined in: CCMacro.js.
<static> <constant> {Number} cc.DEVICE_ORIENTATION_LANDSCAPE_RIGHT
Device oriented horizontally, home button on the left (UIDeviceOrientationLandscapeRight)
Defined in: CCMacro.js.
<static> <constant> {Number} cc.DEVICE_ORIENTATION_PORTRAIT
Device oriented vertically, home button on the bottom (UIDeviceOrientationPortrait)
Defined in: CCMacro.js.
<static> <constant> {Number} cc.DEVICE_ORIENTATION_PORTRAIT_UPSIDE_DOWN
Device oriented vertically, home button on the top (UIDeviceOrientationPortraitUpsideDown)
Defined in: CCMacro.js.
<static> cc.director
<static> <constant> cc.DIRECTOR_FPS_INTERVAL

Seconds between FPS updates.
0.5 seconds, means that the FPS number will be updated every 0.5 seconds.
Having a bigger number means a more reliable FPS

Default value: 0.1f
To modify it, in Web engine please refer to CCConfig.js, in JSB please refer to CCConfig.h


Defined in: CCConfig.js.
<static> <constant> cc.DIRECTOR_STATS_POSITION
Position of the FPS (Default: 0,0 (bottom-left corner))
To modify it, in Web engine please refer to CCConfig.js, in JSB please refer to CCConfig.h
Defined in: CCConfig.js.
<static> <constant> {Number} cc.DISABLE_TAG
default disabled tag
Defined in: CCMacro.js.
<static> cc.DisplayLinkDirector
************************************************ implementation of DisplayLinkDirector ************************************************
Defined in: CCDirector.js.
<static> <constant> {Number} cc.DST_ALPHA

Defined in: CCMacro.js.
<static> <constant> {Number} cc.DST_COLOR

Defined in: CCMacro.js.
<static> <constant> {Number} cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_ALL_CHARACTERS
Capitalize all characters automatically.
Defined in: CCEditBox.js.
<static> <constant> {Number} cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_SENTENCE
This flag is a hint to the implementation that during text editing, the initial letter of each sentence should be capitalized.
Defined in: CCEditBox.js.
<static> <constant> {Number} cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_WORD
This flag is a hint to the implementation that during text editing, the initial letter of each word should be capitalized.
Defined in: CCEditBox.js.
<static> <constant> {Number} cc.EDITBOX_INPUT_FLAG_PASSWORD
Indicates that the text entered is confidential data that should be obscured whenever possible. This implies EDIT_BOX_INPUT_FLAG_SENSITIVE.
Defined in: CCEditBox.js.
<static> <constant> {Number} cc.EDITBOX_INPUT_FLAG_SENSITIVE
Indicates that the text entered is sensitive data that the implementation must never store into a dictionary or table for use in predictive, auto-completing, or other accelerated input schemes. A credit card number is an example of sensitive data.
Defined in: CCEditBox.js.
<static> <constant> {Number} cc.EDITBOX_INPUT_MODE_ANY
The EditBoxInputMode defines the type of text that the user is allowed * to enter.
Defined in: CCEditBox.js.
<static> <constant> {Number} cc.EDITBOX_INPUT_MODE_DECIMAL
The user is allowed to enter a real number value. This extends kEditBoxInputModeNumeric by allowing a decimal point.
Defined in: CCEditBox.js.
<static> <constant> {Number} cc.EDITBOX_INPUT_MODE_EMAILADDR
The user is allowed to enter an e-mail address.
Defined in: CCEditBox.js.
<static> <constant> {Number} cc.EDITBOX_INPUT_MODE_NUMERIC
The user is allowed to enter an integer value.
Defined in: CCEditBox.js.
<static> <constant> {Number} cc.EDITBOX_INPUT_MODE_PHONENUMBER
The user is allowed to enter a phone number.
Defined in: CCEditBox.js.
<static> <constant> {Number} cc.EDITBOX_INPUT_MODE_SINGLELINE
The user is allowed to enter any text, except for line breaks.
Defined in: CCEditBox.js.
<static> <constant> {Number} cc.EDITBOX_INPUT_MODE_URL
The user is allowed to enter a URL.
Defined in: CCEditBox.js.
<static> <constant> cc.ENABLE_GL_STATE_CACHE

If enabled, cocos2d will maintain an OpenGL state cache internally to avoid unnecessary switches.
In order to use them, you have to use the following functions, instead of the the GL ones:
- ccGLUseProgram() instead of glUseProgram()
- ccGLDeleteProgram() instead of glDeleteProgram()
- ccGLBlendFunc() instead of glBlendFunc()

If this functionality is disabled, then ccGLUseProgram(), ccGLDeleteProgram(), ccGLBlendFunc() will call the GL ones, without using the cache.
It is recommend to enable whenever possible to improve speed.
If you are migrating your code from GL ES 1.1, then keep it disabled. Once all your code works as expected, turn it on.


Defined in: CCConfig.js.
<static> <constant> cc.ENABLE_STACKABLE_ACTIONS

If enabled, actions that alter the position property (eg: CCMoveBy, CCJumpBy, CCBezierBy, etc..) will be stacked.
If you run 2 or more 'position' actions at the same time on a node, then end position will be the sum of all the positions.
If disabled, only the last run action will take effect.


Defined in: CCConfig.js.
<static> cc.ENGINE_VERSION
The current version of Cocos2d-JS being used.
Please DO NOT remove this String, it is an important flag for bug tracking.
If you post a bug to forum, please attach this flag.
Defined in: CCConfig.js.
<static> <constant> cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL

If enabled, the texture coordinates will be calculated by using this formula:
- texCoord.left = (rect.x*2+1) / (texture.wide*2);
- texCoord.right = texCoord.left + (rect.width*2-2)/(texture.wide*2);

The same for bottom and top.

This formula prevents artifacts by using 99% of the texture.
The "correct" way to prevent artifacts is by using the spritesheet-artifact-fixer.py or a similar tool.

Affected nodes:
- cc.Sprite / cc.SpriteBatchNode and subclasses: cc.LabelBMFont, cc.TMXTiledMap
- cc.LabelAtlas
- cc.QuadParticleSystem
- cc.TileMap

To enabled set it to 1. Disabled by default.
To modify it, in Web engine please refer to CCConfig.js, in JSB please refer to CCConfig.h


Defined in: CCConfig.js.
<static> <constant> {Number} cc.FLT_EPSILON

Defined in: CCMacro.js.
<static> <constant> {Number} cc.FLT_MAX

Defined in: CCMacro.js.
<static> <constant> {Number} cc.FLT_MIN

Defined in: CCMacro.js.
<static> <constant> cc.FMT_JPG
Image Format:JPG
Defined in: CCCommon.js.
<static> <constant> cc.FMT_PNG
Image Format:PNG
Defined in: CCCommon.js.
<static> <constant> cc.FMT_RAWDATA
Image Format:RAWDATA
Defined in: CCCommon.js.
<static> <constant> cc.FMT_TIFF
Image Format:TIFF
Defined in: CCCommon.js.
<static> <constant> cc.FMT_UNKNOWN
Image Format:UNKNOWN
Defined in: CCCommon.js.
<static> <constant> cc.FMT_WEBP
Image Format:WEBP
Defined in: CCCommon.js.
<static> cc.g_NumberOfDraws
************************************************************************* Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2011-2012 cocos2d-x.org Copyright (c) 2013-2014 Chukong Technologies Inc. http://www.cocos2d-x.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************
Defined in: CCDirector.js.
<static> <constant> cc.GL_ALL
GL server side states
Defined in: CCMacro.js.
<static> cc.HashTimerEntry
Hash Element used for "selectors with interval"
Defined in: CCScheduler.js.
<static> cc.HashUpdateEntry
A update entry list
Defined in: CCScheduler.js.
<static> <constant> {Number} cc.IMAGE_FORMAT_JPEG
enum for jpg
Defined in: CCRenderTexture.js.
<static> <constant> {Number} cc.IMAGE_FORMAT_PNG
enum for png
Defined in: CCRenderTexture.js.
<static> <constant> {Number} cc.IMAGE_FORMAT_RAWDATA
enum for raw
Defined in: CCRenderTexture.js.
<static> <constant> {Number} cc.INVALID_INDEX

Defined in: CCMacro.js.
<static> <constant> cc.IS_RETINA_DISPLAY_SUPPORTED
Whether or not support retina display
Defined in: CCConfig.js.
<static> <constant> {Number} cc.ITEM_SIZE
default size for font size
Defined in: CCMacro.js.
<static> <constant> cc.KEY
Key map for keyboard event
Defined in: CCCommon.js.
    cc.eventManager.addListener({
        event: cc.EventListener.KEYBOARD,
        onKeyPressed:  function(keyCode, event){
            if (cc.KEY["a"] == keyCode) {
                cc.log("A is pressed");
            }
        }
    }, this);
<static> <constant> {Number} cc.KEYBOARD_RETURNTYPE_DEFAULT

Defined in: CCEditBox.js.
<static> <constant> {Number} cc.KEYBOARD_RETURNTYPE_DONE

Defined in: CCEditBox.js.
<static> <constant> {Number} cc.KEYBOARD_RETURNTYPE_GO

Defined in: CCEditBox.js.

Defined in: CCEditBox.js.
<static> <constant> {Number} cc.KEYBOARD_RETURNTYPE_SEND

Defined in: CCEditBox.js.
<static> <constant> {Number} cc.LABEL_AUTOMATIC_WIDTH

Defined in: CCLabelBMFont.js.
<static> <constant> cc.LABELATLAS_DEBUG_DRAW

If enabled, all subclasses of cc.LabelAtlas will draw a bounding box
Useful for debugging purposes only. It is recommend to leave it disabled.

To enable set it to a value different than 0. Disabled by default.


Defined in: CCConfig.js.
<static> <constant> cc.LABELBMFONT_DEBUG_DRAW

If enabled, all subclasses of cc.LabelBMFont will draw a bounding box
Useful for debugging purposes only. It is recommend to leave it disabled.

To enable set it to a value different than 0. Disabled by default.


Defined in: CCConfig.js.
<static> <constant> {Number} cc.LINEAR
the constant variable equals gl.LINEAR for texture
Defined in: CCMacro.js.
<static> cc.ListEntry
A list double-linked list used for "updates with priority"
Defined in: CCScheduler.js.
<static> <constant> {Number} cc.MENU_HANDLER_PRIORITY

Defined in: CCMenu.js.
<static> <constant> {Number} cc.MENU_STATE_TRACKING_TOUCH

Defined in: CCMenu.js.
<static> <constant> {Number} cc.MENU_STATE_WAITING

Defined in: CCMenu.js.
<static> <constant> {Number} cc.MIRRORED_REPEAT
the constant variable equals gl.MIRRORED_REPEAT for texture
Defined in: CCMacro.js.
<static> <constant> {Number} cc.NODE_TAG_INVALID
Default Node tag
Defined in: CCNode.js.
<static> cc.NodeGrid

NodeGrid class is a class serves as a decorator of cc.Node,
Grid node can run grid actions over all its children (WebGL only)


Defined in: CCNodeGrid.js.
<static> <constant> {Number} cc.NORMAL_TAG
default tag for normal
Defined in: CCMacro.js.
<static> <constant> {Number} cc.ONE

Defined in: CCMacro.js.
<static> <constant> {Number} cc.ONE_MINUS_CONSTANT_ALPHA

Defined in: CCMacro.js.
<static> <constant> {Number} cc.ONE_MINUS_CONSTANT_COLOR

Defined in: CCMacro.js.
<static> <constant> {Number} cc.ONE_MINUS_DST_ALPHA

Defined in: CCMacro.js.
<static> <constant> {Number} cc.ONE_MINUS_DST_COLOR

Defined in: CCMacro.js.
<static> <constant> {Number} cc.ONE_MINUS_SRC_ALPHA

Defined in: CCMacro.js.
<static> <constant> {Number} cc.ONE_MINUS_SRC_COLOR

Defined in: CCMacro.js.
<static> <constant> cc.OPTIMIZE_BLEND_FUNC_FOR_PREMULTIPLIED_ALPHA

If most of your images have pre-multiplied alpha, set it to 1 (if you are going to use .PNG/.JPG file images).
Only set to 0 if ALL your images by-pass Apple UIImage loading system (eg: if you use libpng or PVR images)

To enable set it to a value different than 0. Enabled by default.
To modify it, in Web engine please refer to CCConfig.js, in JSB please refer to CCConfig.h


Defined in: CCConfig.js.
<static> <constant> cc.ORIENTATION_LANDSCAPE_LEFT
Device oriented horizontally, home button on the right
<static> <constant> cc.ORIENTATION_LANDSCAPE_RIGHT
Device oriented horizontally, home button on the left
<static> <constant> cc.ORIENTATION_PORTRAIT
Device oriented vertically, home button on the bottom
<static> <constant> cc.ORIENTATION_PORTRAIT_UPSIDE_DOWN
Device oriented vertically, home button on the top
<static> <constant> {Number} cc.PARTICLE_DEFAULT_CAPACITY
paticle default capacity
Defined in: CCParticleBatchNode.js.
<static> <constant> {Number} cc.PI
PI is the ratio of a circle's circumference to its diameter.
Defined in: CCMacro.js.
<static> cc.PI2
<static> cc.plistParser A Plist Parser
<static> <constant> {Number} cc.POINT_EPSILON
smallest such that 1.0+FLT_EPSILON != 1.0
Defined in: CCPointExtension.js.
<static> <constant> {Number} cc.PRIORITY_NON_SYSTEM
Minimum priority level for user scheduling.
Defined in: CCScheduler.js.
<static> <constant> {Number} cc.RAD

Defined in: CCMacro.js.
<static> <constant> {Number} cc.REPEAT
the constant variable equals gl.REPEAT for texture
Defined in: CCMacro.js.
<static> <constant> {Number} cc.REPEAT_FOREVER

Defined in: CCMacro.js.
<static> <constant> cc.RETINA_DISPLAY_FILENAME_SUFFIX

It's the suffix that will be appended to the files in order to load "retina display" images.

On an iPhone4 with Retina Display support enabled, the file @"sprite-hd.png" will be loaded instead of @"sprite.png".
If the file doesn't exist it will use the non-retina display image.

Platforms: Only used on Retina Display devices like iPhone 4.


Defined in: CCConfig.js.
<static> <constant> cc.RETINA_DISPLAY_SUPPORT

If enabled, cocos2d supports retina display.
For performance reasons, it's recommended disable it in games without retina display support, like iPad only games.

To enable set it to 1. Use 0 to disable it. Enabled by default.

This value governs only the PNG, GIF, BMP, images.
This value DOES NOT govern the PVR (PVR.GZ, PVR.CCZ) files. If NPOT PVR is loaded, then it will create an NPOT texture ignoring this value.
To modify it, in Web engine please refer to CCConfig.js, in JSB please refer to CCConfig.h


Defined in: CCConfig.js.
Deprecated:
This value will be removed in 1.1 and NPOT textures will be loaded by default if the device supports it.
<static> cc.s_globalOrderOfArrival
XXX: Yes, nodes might have a sort problem once every 15 days if the game runs at 60 FPS and each frame sprites are reordered.
Defined in: CCNode.js.
<static> <constant> {Number} cc.SCENE_FADE
A tag constant for identifying fade scenes
Defined in: CCTransition.js.
<static> <constant> {Number} cc.SCENE_RADIAL
tag for scene redial
Defined in: CCTransitionProgress.js.
<static> <constant> {Number} cc.SELECTED_TAG
default selected tag
Defined in: CCMacro.js.
<static> <constant> cc.SHADER_POSITION_COLOR

Defined in: CCMacro.js.
<static> <constant> cc.SHADER_POSITION_COLOR_FRAG

Defined in: CCShaders.js.
<static> <constant> cc.SHADER_POSITION_COLOR_LENGTH_TEXTURE_FRAG

Defined in: CCShaders.js.
<static> <constant> cc.SHADER_POSITION_COLOR_LENGTH_TEXTURE_VERT

Defined in: CCShaders.js.
<static> <constant> cc.SHADER_POSITION_COLOR_VERT

Defined in: CCShaders.js.
<static> <constant> cc.SHADER_POSITION_LENGTHTEXTURECOLOR

Defined in: CCMacro.js.
<static> <constant> cc.SHADER_POSITION_TEXTURE

Defined in: CCMacro.js.
<static> <constant> cc.SHADER_POSITION_TEXTURE_A8COLOR_FRAG

Defined in: CCShaders.js.
<static> <constant> cc.SHADER_POSITION_TEXTURE_A8COLOR_VERT

Defined in: CCShaders.js.
<static> <constant> cc.SHADER_POSITION_TEXTURE_COLOR_ALPHATEST_FRAG

Defined in: CCShaders.js.
<static> <constant> cc.SHADER_POSITION_TEXTURE_COLOR_FRAG

Defined in: CCShaders.js.
<static> <constant> cc.SHADER_POSITION_TEXTURE_COLOR_VERT

Defined in: CCShaders.js.
<static> <constant> cc.SHADER_POSITION_TEXTURE_FRAG

Defined in: CCShaders.js.
<static> <constant> cc.SHADER_POSITION_TEXTURE_UCOLOR

Defined in: CCMacro.js.
<static> <constant> cc.SHADER_POSITION_TEXTURE_UCOLOR_FRAG

Defined in: CCShaders.js.
<static> <constant> cc.SHADER_POSITION_TEXTURE_UCOLOR_VERT

Defined in: CCShaders.js.
<static> <constant> cc.SHADER_POSITION_TEXTURE_VERT

Defined in: CCShaders.js.
<static> <constant> cc.SHADER_POSITION_TEXTUREA8COLOR

Defined in: CCMacro.js.
<static> <constant> cc.SHADER_POSITION_TEXTURECOLOR

Defined in: CCMacro.js.
<static> <constant> cc.SHADER_POSITION_TEXTURECOLORALPHATEST

Defined in: CCMacro.js.
<static> <constant> cc.SHADER_POSITION_UCOLOR

Defined in: CCMacro.js.
<static> <constant> cc.SHADER_POSITION_UCOLOR_FRAG

Defined in: CCShaders.js.
<static> <constant> cc.SHADER_POSITION_UCOLOR_VERT

Defined in: CCShaders.js.
<static> <constant> cc.SHADEREX_SWITCHMASK_FRAG

Defined in: CCShaders.js.
<static> <constant> cc.SPRITE_DEBUG_DRAW

If enabled, all subclasses of cc.Sprite will draw a bounding box
Useful for debugging purposes only. It is recommend to leave it disabled.

To enable set it to a value different than 0. Disabled by default:
0 -- disabled
1 -- draw bounding box
2 -- draw texture box


Defined in: CCConfig.js.
<static> <constant> cc.SPRITEBATCHNODE_DEBUG_DRAW

If enabled, all subclasses of cc.Sprite that are rendered using an cc.SpriteBatchNode draw a bounding box.
Useful for debugging purposes only. It is recommend to leave it disabled.

To enable set it to a value different than 0. Disabled by default.


Defined in: CCConfig.js.
<static> <constant> cc.SPRITEBATCHNODE_RENDER_SUBPIXEL

If enabled, the cc.Sprite objects rendered with cc.SpriteBatchNode will be able to render in subpixels.
If disabled, integer pixels will be used.

To enable set it to 1. Enabled by default.
To modify it, in Web engine please refer to CCConfig.js, in JSB please refer to CCConfig.h


Defined in: CCConfig.js.
<static> <constant> {Number} cc.SRC_ALPHA

Defined in: CCMacro.js.
<static> <constant> {Number} cc.SRC_ALPHA_SATURATE

Defined in: CCMacro.js.
<static> <constant> {Number} cc.SRC_COLOR

Defined in: CCMacro.js.
<static> {Number} cc.stencilBits
the value of stencil bits.
Defined in: CCClippingNode.js.
<static> <constant> cc.TABLEVIEW_FILL_BOTTOMUP
The constant value of the fill style from bottom to top for cc.TableView
Defined in: CCTableView.js.
<static> <constant> cc.TABLEVIEW_FILL_TOPDOWN
The constant value of the fill style from top to bottom for cc.TableView
Defined in: CCTableView.js.
<static> cc.TableViewDataSource
Data source that governs table backend data.
Defined in: CCTableView.js.
<static> cc.TableViewDelegate
Sole purpose of this delegate is to single touch event in this version.
Defined in: CCTableView.js.
<static> <constant> {Number} cc.TEXT_ALIGNMENT_CENTER
text alignment : center
Defined in: CCTypes.js.
<static> <constant> {Number} cc.TEXT_ALIGNMENT_LEFT
text alignment : left
Defined in: CCTypes.js.
<static> <constant> {Number} cc.TEXT_ALIGNMENT_RIGHT
text alignment : right
Defined in: CCTypes.js.
<static> <constant> cc.TEXTURE_ATLAS_USE_TRIANGLE_STRIP

Use GL_TRIANGLE_STRIP instead of GL_TRIANGLES when rendering the texture atlas.
It seems it is the recommend way, but it is much slower, so, enable it at your own risk

To enable set it to a value different than 0. Disabled by default.
To modify it, in Web engine please refer to CCConfig.js, in JSB please refer to CCConfig.h


Defined in: CCConfig.js.
<static> <constant> cc.TEXTURE_ATLAS_USE_VAO

By default, cc.TextureAtlas (used by many cocos2d classes) will use VAO (Vertex Array Objects).
Apple recommends its usage but they might consume a lot of memory, specially if you use many of them.
So for certain cases, where you might need hundreds of VAO objects, it might be a good idea to disable it.

To disable it set it to 0. disable by default.(Not Supported on WebGL)
To modify it, in Web engine please refer to CCConfig.js, in JSB please refer to CCConfig.h


Defined in: CCConfig.js.
<static> <constant> cc.TEXTURE_NPOT_SUPPORT

If enabled, NPOT textures will be used where available. Only 3rd gen (and newer) devices support NPOT textures.
NPOT textures have the following limitations:
- They can't have mipmaps
- They only accept GL_CLAMP_TO_EDGE in GL_TEXTURE_WRAP_{S,T}

To enable set it to a value different than 0. Disabled by default.

This value governs only the PNG, GIF, BMP, images.
This value DOES NOT govern the PVR (PVR.GZ, PVR.CCZ) files. If NPOT PVR is loaded, then it will create an NPOT texture ignoring this value.
To modify it, in Web engine please refer to CCConfig.js, in JSB please refer to CCConfig.h


Defined in: CCConfig.js.
Deprecated:
This value will be removed in 1.1 and NPOT textures will be loaded by default if the device supports it.
<static> <constant> {Number} cc.TGA_ERROR_COMPRESSED_FILE

Defined in: CCTGAlib.js.
<static> <constant> {Number} cc.TGA_ERROR_FILE_OPEN

Defined in: CCTGAlib.js.
<static> <constant> {Number} cc.TGA_ERROR_INDEXED_COLOR

Defined in: CCTGAlib.js.
<static> <constant> {Number} cc.TGA_ERROR_MEMORY

Defined in: CCTGAlib.js.
<static> <constant> {Number} cc.TGA_ERROR_READING_FILE

Defined in: CCTGAlib.js.
<static> <constant> {Number} cc.TGA_OK

Defined in: CCTGAlib.js.
<static> <constant> {Number} cc.TMX_ORIENTATION_HEX
Hexagonal orientation
Defined in: CCTMXTiledMap.js.
<static> <constant> {Number} cc.TMX_ORIENTATION_ISO
Isometric orientation
Defined in: CCTMXTiledMap.js.
<static> <constant> {Number} cc.TMX_ORIENTATION_ORTHO
Orthogonal orientation
Defined in: CCTMXTiledMap.js.
<static> <constant> {Number} cc.TMX_PROPERTY_LAYER

Defined in: CCTMXXMLParser.js.
<static> <constant> {Number} cc.TMX_PROPERTY_MAP

Defined in: CCTMXXMLParser.js.
<static> <constant> {Number} cc.TMX_PROPERTY_NONE

Defined in: CCTMXXMLParser.js.
<static> <constant> {Number} cc.TMX_PROPERTY_OBJECT

Defined in: CCTMXXMLParser.js.
<static> <constant> {Number} cc.TMX_PROPERTY_OBJECTGROUP

Defined in: CCTMXXMLParser.js.
<static> <constant> {Number} cc.TMX_PROPERTY_TILE

Defined in: CCTMXXMLParser.js.
<static> <constant> {Number} cc.TMX_TILE_DIAGONAL_FLAG

Defined in: CCTMXXMLParser.js.
<static> <constant> {Number} cc.TMX_TILE_FLIPPED_ALL

Defined in: CCTMXXMLParser.js.
<static> <constant> {Number} cc.TMX_TILE_FLIPPED_MASK

Defined in: CCTMXXMLParser.js.
<static> <constant> {Number} cc.TMX_TILE_HORIZONTAL_FLAG

Defined in: CCTMXXMLParser.js.
<static> <constant> {Number} cc.TMX_TILE_VERTICAL_FLAG

Defined in: CCTMXXMLParser.js.
<static> <constant> {Number} cc.TRANSITION_ORIENTATION_DOWN_OVER
vertical orientation type where the Bottom is nearer
Defined in: CCTransition.js.
<static> <constant> {Number} cc.TRANSITION_ORIENTATION_LEFT_OVER
horizontal orientation Type where the Left is nearer
Defined in: CCTransition.js.
<static> <constant> {Number} cc.TRANSITION_ORIENTATION_RIGHT_OVER
horizontal orientation type where the Right is nearer
Defined in: CCTransition.js.
<static> <constant> {Number} cc.TRANSITION_ORIENTATION_UP_OVER
vertical orientation type where the Up is nearer
Defined in: CCTransition.js.
<static> <constant> cc.UIInterfaceOrientationLandscapeLeft

Defined in: CCInputManager.js.
<static> <constant> cc.UIInterfaceOrientationLandscapeRight

Defined in: CCInputManager.js.
<static> <constant> cc.UIInterfaceOrientationPortrait

Defined in: CCInputManager.js.
<static> <constant> cc.UIInterfaceOrientationPortraitUpsideDown

Defined in: CCInputManager.js.
<static> <constant> {Number} cc.UINT_MAX
maximum unsigned int value
Defined in: CCMacro.js.
<static> <constant> cc.UNIFORM_ALPHA_TEST_VALUE_S

Defined in: CCMacro.js.
<static> <constant> cc.UNIFORM_COSTIME

Defined in: CCMacro.js.
<static> <constant> cc.UNIFORM_COSTIME_S

Defined in: CCMacro.js.
<static> <constant> cc.UNIFORM_MAX

Defined in: CCMacro.js.
<static> <constant> cc.UNIFORM_MVMATRIX

Defined in: CCMacro.js.
<static> <constant> cc.UNIFORM_MVMATRIX_S

Defined in: CCMacro.js.
<static> <constant> cc.UNIFORM_MVPMATRIX

Defined in: CCMacro.js.
<static> <constant> cc.UNIFORM_MVPMATRIX_S

Defined in: CCMacro.js.
<static> <constant> cc.UNIFORM_PMATRIX

Defined in: CCMacro.js.
<static> <constant> cc.UNIFORM_PMATRIX_S

Defined in: CCMacro.js.
<static> <constant> cc.UNIFORM_RANDOM01

Defined in: CCMacro.js.
<static> <constant> cc.UNIFORM_RANDOM01_S

Defined in: CCMacro.js.
<static> <constant> cc.UNIFORM_SAMPLER

Defined in: CCMacro.js.
<static> <constant> cc.UNIFORM_SAMPLER_S

Defined in: CCMacro.js.
<static> <constant> cc.UNIFORM_SINTIME

Defined in: CCMacro.js.
<static> <constant> cc.UNIFORM_SINTIME_S

Defined in: CCMacro.js.
<static> <constant> cc.UNIFORM_TIME

Defined in: CCMacro.js.
<static> <constant> cc.UNIFORM_TIME_S

Defined in: CCMacro.js.
<static> <constant> cc.USE_LA88_LABELS

If enabled, it will use LA88 (Luminance Alpha 16-bit textures) for CCLabelTTF objects.
If it is disabled, it will use A8 (Alpha 8-bit textures).
LA88 textures are 6% faster than A8 textures, but they will consume 2x memory.

This feature is enabled by default.


Defined in: CCConfig.js.
<static> <constant> cc.VERTEX_ATTRIB_COLOR

Defined in: CCMacro.js.
<static> <constant> cc.VERTEX_ATTRIB_FLAG_COLOR

Defined in: CCMacro.js.
<static> <constant> cc.VERTEX_ATTRIB_FLAG_NONE

Defined in: CCMacro.js.
<static> <constant> cc.VERTEX_ATTRIB_FLAG_POS_COLOR_TEX

Defined in: CCMacro.js.
<static> <constant> cc.VERTEX_ATTRIB_FLAG_POSITION

Defined in: CCMacro.js.
<static> <constant> cc.VERTEX_ATTRIB_FLAG_TEX_COORDS

Defined in: CCMacro.js.
<static> <constant> cc.VERTEX_ATTRIB_MAX

Defined in: CCMacro.js.
<static> <constant> cc.VERTEX_ATTRIB_POSITION

Defined in: CCMacro.js.
<static> <constant> cc.VERTEX_ATTRIB_TEX_COORDS

Defined in: CCMacro.js.
<static> <constant> {Number} cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM
text alignment : bottom
Defined in: CCTypes.js.
<static> <constant> {Number} cc.VERTICAL_TEXT_ALIGNMENT_CENTER
text alignment : center
Defined in: CCTypes.js.
<static> <constant> {Number} cc.VERTICAL_TEXT_ALIGNMENT_TOP
text alignment : top
Defined in: CCTypes.js.
<static> <constant> {Number} cc.ZERO

Defined in: CCMacro.js.
<static> <constant> {Number} cc.ZOOM_ACTION_TAG
default tag for zoom action tag
Defined in: CCMacro.js.

Method Detail

  • <static> {cc.$} cc.$(x)
    the dollar sign, classic like jquery, this selector add extra methods to HTMLElement without touching its prototype
    it is also chainable like jquery
    Defined in: miniFramework.js.
    Parameters:
    {HTMLElement|String} x
    pass in a css selector in string or the whole HTMLElement
    Returns:
    {cc.$}
  • <static> {cc.$} cc.$new(x)
    Creates a new element, and adds cc.$ methods
    Defined in: miniFramework.js.
    Parameters:
    {String} x
    name of the element tag to create
    Returns:
    {cc.$}
  • <static> {cc.Action} cc.action()
    Allocates and initializes the action.
    Defined in: CCAction.js.
    // return {cc.Action}
    var action = cc.action();
    Returns:
    {cc.Action}
  • <static> {cc.ActionEase} cc.actionEase(action)
    creates the action of ActionEase
    Defined in: CCActionEase.js.
    // example
    var moveEase = cc.actionEase(action);
    Parameters:
    {cc.ActionInterval} action
    Returns:
    {cc.ActionEase}
  • <static> {cc.ActionInterval} cc.actionInterval(d)
    An interval action is an action that takes place within a certain period of time.
    Defined in: CCActionInterval.js.
    // example
    var actionInterval = cc.actionInterval(3);
    Parameters:
    {Number} d
    duration in seconds
    Returns:
    {cc.ActionInterval}
  • <static> {cc.ActionTween} cc.actionTween(duration, key, from, to)
    Creates an initializes the action with the property name (key), and the from and to parameters.
    Defined in: CCActionTween.js.
    Parameters:
    {Number} duration
    {String} key
    {Number} from
    {Number} to
    Returns:
    {cc.ActionTween}
  • <static> {cc.AffineTransform} cc.affineTransformConcat(t1, t2)
    Concatenate a transform matrix to another and return the result:
    t' = t1 * t2
    Defined in: CCAffineTransform.js.
    Parameters:
    {cc.AffineTransform} t1
    The first transform object
    {cc.AffineTransform} t2
    The transform object to concatenate
    Returns:
    {cc.AffineTransform} The result of concatenation
  • <static> {cc.AffineTransform} cc.affineTransformConcatIn(t1, t2)
    Concatenate a transform matrix to another
    The results are reflected in the first matrix.
    t' = t1 * t2
    Defined in: CCAffineTransform.js.
    Parameters:
    {cc.AffineTransform} t1
    The first transform object
    {cc.AffineTransform} t2
    The transform object to concatenate
    Returns:
    {cc.AffineTransform} The result of concatenation
  • <static> {Boolean} cc.affineTransformEqualToTransform(t1, t2)
    Return true if an affine transform equals to another, false otherwise.
    Defined in: CCAffineTransform.js.
    Parameters:
    {cc.AffineTransform} t1
    {cc.AffineTransform} t2
    Returns:
    {Boolean}
  • <static> {cc.AffineTransform} cc.affineTransformIdentity()

    Create a identity transformation matrix:
    [ 1, 0, 0,
    0, 1, 0 ]


    Defined in: CCAffineTransform.js.
    Deprecated:
    since v3.0, please use cc.affineTransformMakeIdentity() instead
    Returns:
    {cc.AffineTransform}
    See:
    cc.affineTransformMakeIdentity
  • <static> {cc.AffineTransform} cc.affineTransformInvert(t)
    Get the invert transform of an AffineTransform object
    Defined in: CCAffineTransform.js.
    Parameters:
    {cc.AffineTransform} t
    Returns:
    {cc.AffineTransform} The inverted transform object
  • <static> {cc.AffineTransform} cc.affineTransformMake(a, b, c, d, tx, ty)
    Create a cc.AffineTransform object with all contents in the matrix
    Defined in: CCAffineTransform.js.
    Parameters:
    {Number} a
    {Number} b
    {Number} c
    {Number} d
    {Number} tx
    {Number} ty
    Returns:
    {cc.AffineTransform}
  • <static> {cc.AffineTransform} cc.affineTransformMakeIdentity()

    Create a identity transformation matrix:
    [ 1, 0, 0,
    0, 1, 0 ]


    Defined in: CCAffineTransform.js.
    Returns:
    {cc.AffineTransform}
  • <static> {cc.AffineTransform} cc.affineTransformRotate(aTransform, anAngle)
    Create a new affine transformation with a base transformation matrix and a rotation based on it.
    Defined in: CCAffineTransform.js.
    Parameters:
    {cc.AffineTransform} aTransform
    The base affine transform object
    {Number} anAngle
    The angle to rotate
    Returns:
    {cc.AffineTransform}
  • <static> {cc.AffineTransform} cc.affineTransformScale(t, sx, sy)
    Create a new affine transformation with a base transformation matrix and a scale based on it.
    Defined in: CCAffineTransform.js.
    Parameters:
    {cc.AffineTransform} t
    The base affine transform object
    {Number} sx
    The scale on x axis
    {Number} sy
    The scale on y axis
    Returns:
    {cc.AffineTransform}
  • <static> {cc.AffineTransform} cc.affineTransformTranslate(t, tx, ty)
    Create a new affine transformation with a base transformation matrix and a translation based on it.
    Defined in: CCAffineTransform.js.
    Parameters:
    {cc.AffineTransform} t
    The base affine transform object
    {Number} tx
    The translation on x axis
    {Number} ty
    The translation on y axis
    Returns:
    {cc.AffineTransform}
  • <static> {cc.Animate} cc.animate(animation)
    create the animate with animation
    Defined in: CCActionInterval.js.
    // example
    // create the animation with animation
    var anim = cc.animate(dance_grey);
    Parameters:
    {cc.Animation} animation
    Returns:
    {cc.Animate}
  • <static> {Array} cc.arrayAppendObjectsToIndex(arr, addObjs, index)
    Inserts some objects at index
    Defined in: CCMacro.js.
    Parameters:
    {Array} arr
    {Array} addObjs
    {Number} index
    Returns:
    {Array}
  • <static> cc.arrayRemoveArray(arr, minusArr)
    Removes from arr all values in minusArr. For each Value in minusArr, the first matching instance in arr will be removed.
    Defined in: CCMacro.js.
    Parameters:
    {Array} arr
    Source Array
    {Array} minusArr
    minus Array
  • <static> cc.arrayRemoveObject(arr, delObj)
    Searches for the first occurance of object and removes it. If object is not found the function has no effect.
    Defined in: CCMacro.js.
    Parameters:
    {Array} arr
    Source Array
    {*} delObj
    remove object
  • <static> {Boolean} cc.arrayVerifyType(arr, type)
    Verify Array's Type
    Defined in: CCMacro.js.
    Parameters:
    {Array} arr
    {function} type
    Returns:
    {Boolean}
  • <static> cc.associateWithNative(jsObj, superclass)
    Function added for JS bindings compatibility. Not needed in cocos2d-html5.
    Defined in: CCCommon.js.
    Parameters:
    {object} jsObj
    subclass
    {object} superclass
  • <static> cc.base(me, opt_methodName, var_args)

    Defined in: CCCommon.js.
    Parameters:
    me
    opt_methodName
    var_args
    Deprecated:
    since v3.0, please use cc.Class.extend and _super
  • <static> {Number} cc.bezierAt(a, b, c, d, t)

    Defined in: CCActionInterval.js.
    Parameters:
    {Number} a
    {Number} b
    {Number} c
    {Number} d
    {Number} t
    Returns:
    {Number}
  • <static> {cc.BezierBy} cc.bezierBy(t, c)
    An action that moves the target with a cubic Bezier curve by a certain distance. Relative to its movement.
    Defined in: CCActionInterval.js.
    // example
    var bezier = [cc.p(0, windowSize.height / 2), cc.p(300, -windowSize.height / 2), cc.p(300, 100)];
    var bezierForward = cc.bezierBy(3, bezier);
    Parameters:
    {Number} t
    time in seconds
    {Array} c
    Array of points
    Returns:
    {cc.BezierBy}
  • <static> {cc.BezierTo} cc.bezierTo(t, c)
    An action that moves the target with a cubic Bezier curve to a destination point.
    Defined in: CCActionInterval.js.
    // example
    var bezier = [cc.p(0, windowSize.height / 2), cc.p(300, -windowSize.height / 2), cc.p(300, 100)];
    var bezierTo = cc.bezierTo(2, bezier);
    Parameters:
    {Number} t
    {Array} c
    array of points
    Returns:
    {cc.BezierTo}
  • <static> cc.BlendFunc(src1, dst1)
    Blend Function used for textures
    Defined in: CCTypes.js.
    Parameters:
    {Number} src1
    source blend function
    {Number} dst1
    destination blend function
  • <static> {cc.BlendFunc} cc.blendFuncDisable()

    Defined in: CCTypes.js.
    Returns:
    {cc.BlendFunc}
  • Blinks a cc.Node object by modifying it's visible attribute.
    Defined in: CCActionInterval.js.
    // example
    var action = cc.blink(2, 10);
    Parameters:
    {Number} duration
    duration in seconds
    blinks
    blinks in times
    Returns:
    {cc.Blink}
  • <static> {cc.CallFunc} cc.callFunc(selector, selectorTarget, data)
    Creates the action with the callback
    Defined in: CCActionInstant.js.
    // example
    // CallFunc without data
    var finish = cc.callFunc(this.removeSprite, this);
    
    // CallFunc with data
    var finish = cc.callFunc(this.removeFromParentAndCleanup, this._grossini,  true);
    Parameters:
    {function} selector
    {object|null} selectorTarget Optional
    {*|null} data Optional
    data for function, it accepts all data types.
    Returns:
    {cc.CallFunc}
  • <static> {cc.Point} cc.cardinalSplineAt(p0, p1, p2, p3, tension, t)
    Returns the Cardinal Spline position for a given set of control points, tension and time.
    CatmullRom Spline formula.
    s(-ttt + 2tt - t)P1 + s(-ttt + tt)P2 + (2ttt - 3tt + 1)P2 + s(ttt - 2tt + t)P3 + (-2ttt + 3tt)P3 + s(ttt - tt)P4
    Defined in: CCActionCatmullRom.js.
    Parameters:
    {cc.Point} p0
    {cc.Point} p1
    {cc.Point} p2
    {cc.Point} p3
    {Number} tension
    {Number} t
    Returns:
    {cc.Point}
  • <static> {cc.CardinalSplineBy} cc.cardinalSplineBy(duration, points, tension)
    creates an action with a Cardinal Spline array of points and tension.
    Defined in: CCActionCatmullRom.js.
    Parameters:
    {Number} duration
    {Array} points
    {Number} tension
    Returns:
    {cc.CardinalSplineBy}
  • <static> {cc.CardinalSplineTo} cc.cardinalSplineTo(duration, points, tension)
    creates an action with a Cardinal Spline array of points and tension.
    Defined in: CCActionCatmullRom.js.
    //create a cc.CardinalSplineTo
    var action1 = cc.cardinalSplineTo(3, array, 0);
    Parameters:
    {Number} duration
    {Array} points
    array of control points
    {Number} tension
    Returns:
    {cc.CardinalSplineTo}
  • <static> {cc.CatmullRomBy} cc.catmullRomBy(dt, points)
    Creates an action with a Cardinal Spline array of points and tension
    Defined in: CCActionCatmullRom.js.
    var action1 = cc.catmullRomBy(3, array);
    Parameters:
    {Number} dt
    {Array} points
    Returns:
    {cc.CatmullRomBy}
  • <static> {cc.CatmullRomTo} cc.catmullRomTo(dt, points)
    creates an action with a Cardinal Spline array of points and tension.
    Defined in: CCActionCatmullRom.js.
    var action1 = cc.catmullRomTo(3, array);
    Parameters:
    {Number} dt
    {Array} points
    Returns:
    {cc.CatmullRomTo}
  • <static> cc.CGAffineToGL(trans, mat)
    convert an affine transform object to a kmMat4 object
    Defined in: TransformUtils.js.
    Parameters:
    {cc.AffineTransform} trans
    {cc.kmMat4} mat
  • <static> cc.checkGLErrorDebug()
    Check webgl error.Error will be shown in console if exists.
    Defined in: CCMacro.js.
  • <static> {Number} cc.clampf(value, min_inclusive, max_inclusive)
    Clamp a value between from and to.
    Defined in: CCPointExtension.js.
    Parameters:
    {Number} value
    {Number} min_inclusive
    {Number} max_inclusive
    Returns:
    {Number}
  • <static> {Array|object} cc.clone(obj)
    Create a new object and copy all properties in an exist object to the new object
    Defined in: CCClass.js.
    Parameters:
    {object|Array} obj
    The source object
    Returns:
    {Array|object} The created object
  • <static> {Array} cc.cloneControlPoints(controlPoints)
    returns a new clone of the controlPoints
    Defined in: CCActionCatmullRom.js.
    Parameters:
    controlPoints
    Returns:
    {Array}
  • <static> {cc.Color} cc.color(r, g, b, a)
    Generate a color object based on multiple forms of parameters
    Defined in: CCTypes.js.
    // 1. All channels seperately as parameters
    var color1 = cc.color(255, 255, 255, 255);
    
    // 2. Convert a hex string to a color
    var color2 = cc.color("#000000");
    
    // 3. An color object as parameter
    var color3 = cc.color({r: 255, g: 255, b: 255, a: 255});
    
    Alpha channel is optional. Default value is 255
    Parameters:
    {Number|String|cc.Color} r
    {Number} g
    {Number} b
    {Number} a Optional, Default: 255
    Returns:
    {cc.Color}
  • <static> {Boolean} cc.colorEqual(color1, color2)
    returns true if both ccColor3B are equal. Otherwise it returns false.
    Defined in: CCTypes.js.
    Parameters:
    {cc.Color} color1
    {cc.Color} color2
    Returns:
    {Boolean} true if both ccColor3B are equal. Otherwise it returns false.
  • <static> {String} cc.colorToHex(color)
    convert Color to a string of color for style. e.g. cc.color(255,6,255) to : "#ff06ff"
    Defined in: CCTypes.js.
    Parameters:
    {cc.Color} color
    Returns:
    {String}
  • <static> {Number} cc.contentScaleFactor()

    On Mac it returns 1;
    On iPhone it returns 2 if RetinaDisplay is On. Otherwise it returns 1


    Defined in: CCMacro.js.
    Returns:
    {Number}
  • <static> {Array} cc.copyArray(arr)
    Copy an array's item to a new array (its performance is better than Array.slice)
    Defined in: CCMacro.js.
    Parameters:
    {Array} arr
    Returns:
    {Array}
  • <static> {WebGLRenderingContext} cc.create3DContext(canvas, opt_attribs)
    create a webgl context
    Parameters:
    {HTMLCanvasElement} canvas
    {Object} opt_attribs
    Returns:
    {WebGLRenderingContext}
  • <static> cc.defineGetterSetter(proto, prop, getter, setter, getterName, setterName)
    Common getter setter configuration function
    Defined in: CCClass.js.
    Parameters:
    {Object} proto
    A class prototype or an object to config
    {String} prop
    Property name
    {function} getter
    Getter function for the property
    {function} setter
    Setter function for the property
    {String} getterName
    Name of getter function for the property
    {String} setterName
    Name of setter function for the property
  • <static> {Number} cc.degreesToRadians(angle)
    converts degrees to radians
    Defined in: CCMacro.js.
    Parameters:
    {Number} angle
    Returns:
    {Number}
  • <static> {cc.DelayTime} cc.delayTime(d)
    Delays the action a certain amount of seconds
    Defined in: CCActionInterval.js.
    // example
    var delay = cc.delayTime(1);
    Parameters:
    {Number} d
    duration in seconds
    Returns:
    {cc.DelayTime}
  • <static> cc.disableDefaultGLStates()

    Disable default GL states:
    - GL_TEXTURE_2D
    - GL_TEXTURE_COORD_ARRAY
    - GL_COLOR_ARRAY


    Defined in: CCMacro.js.
  • <static> cc.each(obj, iterator, context)
    Iterate over an object or an array, executing a function for each matched element.
    Parameters:
    {object|array} obj
    {function} iterator
    {object} context Optional
  • <static> {Object} cc.easeBackIn()
    Creates the action easing object.
    In the opposite direction to move slowly, and then accelerated to the right direction.
    Defined in: CCActionEase.js.
    // example
    action.easing(cc.easeBackIn());
    Returns:
    {Object}
  • <static> {Object} cc.easeBackInOut()
    Creates the action easing object.
    Begining of cc.EaseBackIn. Ending of cc.EaseBackOut.
    Defined in: CCActionEase.js.
    // example
    action.easing(cc.easeBackInOut());
    Returns:
    {Object}
  • <static> {Object} cc.easeBackOut()
    Creates the action easing object.
    Fast moving more than the finish, and then slowly back to the finish.
    Defined in: CCActionEase.js.
    // example
    action.easing(cc.easeBackOut());
    Returns:
    {Object}
  • <static> {Object} cc.easeBezierAction(p0, p1, p2, p3)
    Creates the action easing object.
    Into the 4 reference point.
    To calculate the motion curve.
    Defined in: CCActionEase.js.
    // example
    action.easing(cc.easeBezierAction(0.5, 0.5, 1.0, 1.0));
    Parameters:
    {Number} p0
    The first bezier parameter
    {Number} p1
    The second bezier parameter
    {Number} p2
    The third bezier parameter
    {Number} p3
    The fourth bezier parameter
    Returns:
    {Object}
  • <static> {Object} cc.easeBounceIn()
    Creates the action easing object.
    Eased bounce effect at the beginning.
    Defined in: CCActionEase.js.
    // example
    action.easing(cc.easeBounceIn());
    Returns:
    {Object}
  • <static> {Object} cc.easeBounceInOut()
    Creates the action easing object.
    Eased bounce effect at the begining and ending.
    Defined in: CCActionEase.js.
    // example
    action.easing(cc.easeBounceInOut());
    Returns:
    {Object}
  • <static> {Object} cc.easeBounceOut()
    Creates the action easing object.
    Eased bounce effect at the ending.
    Defined in: CCActionEase.js.
    // example
    action.easing(cc.easeBounceOut());
    Returns:
    {Object}
  • <static> {Object} cc.easeCircleActionIn()
    Creates the action easing object.
    Reference easeInCirc:
    http://www.zhihu.com/question/21981571/answer/19925418
    Defined in: CCActionEase.js.
    //example
    action.easing(cc.easeCircleActionIn());
    Returns:
    {Object}
  • <static> {Object} cc.easeCircleActionInOut()
    Creates the action easing object.
    Reference easeInOutCirc:
    http://www.zhihu.com/question/21981571/answer/19925418
    Defined in: CCActionEase.js.
    //example
    action.easing(cc.easeCircleActionInOut());
    Returns:
    {Object}
  • <static> {Object} cc.easeCircleActionOut()
    Creates the action easing object.
    Reference easeOutCirc:
    http://www.zhihu.com/question/21981571/answer/19925418
    Defined in: CCActionEase.js.
    Returns:
    {Object}
  • <static> {Object} cc.easeCubicActionIn()
    Creates the action easing object.
    Reference easeInCubic:
    http://www.zhihu.com/question/21981571/answer/19925418
    Defined in: CCActionEase.js.
    //example
    action.easing(cc.easeCubicActionIn());
    Returns:
    {Object}
  • <static> {Object} cc.easeCubicActionInOut()
    Creates the action easing object.
    Reference easeInOutCubic:
    http://www.zhihu.com/question/21981571/answer/19925418
    Defined in: CCActionEase.js.
    Returns:
    {Object}
  • <static> {Object} cc.easeCubicActionOut()
    Creates the action easing object.
    Reference easeOutCubic:
    http://www.zhihu.com/question/21981571/answer/19925418
    Defined in: CCActionEase.js.
    //example
    action.easing(cc.easeCubicActionOut());
    Returns:
    {Object}
  • <static> {Object} cc.easeElasticIn(period)
    Creates the action easing obejct with the period in radians (default is 0.3).
    Reference easeInElastic:
    http://www.zhihu.com/question/21981571/answer/19925418
    Defined in: CCActionEase.js.
    // example
    action.easing(cc.easeElasticIn(3.0));
    Parameters:
    {Number} period Optional, Default: 0.3
    Returns:
    {Object}
  • <static> {Object} cc.easeElasticInOut(period)
    Creates the action easing object with the period in radians (default is 0.3).
    Reference easeInOutElastic:
    http://www.zhihu.com/question/21981571/answer/19925418
    Defined in: CCActionEase.js.
    // example
    action.easing(cc.easeElasticInOut(3.0));
    Parameters:
    {Number} period Optional, Default: 0.3
    Returns:
    {Object}
  • <static> {Object} cc.easeElasticOut(period)
    Creates the action easing object with the period in radians (default is 0.3).
    Reference easeOutElastic:
    http://www.zhihu.com/question/21981571/answer/19925418
    Defined in: CCActionEase.js.
    // example
    action.easing(cc.easeElasticOut(3.0));
    Parameters:
    {Number} period Optional, Default: 0.3
    Returns:
    {Object}
  • <static> {Object} cc.easeExponentialIn()
    Creates the action easing object with the rate parameter.
    Reference easeInExpo:
    http://www.zhihu.com/question/21981571/answer/19925418
    Defined in: CCActionEase.js.
    // example
    action.easing(cc.easeExponentialIn());
    Returns:
    {Object}
  • <static> {Object} cc.easeExponentialInOut()
    creates an EaseExponentialInOut action easing object.
    Reference easeInOutExpo:
    http://www.zhihu.com/question/21981571/answer/19925418
    Defined in: CCActionEase.js.
    // example
    action.easing(cc.easeExponentialInOut());
    Returns:
    {Object}
  • <static> {Object} cc.easeExponentialOut()
    creates the action easing object.
    Reference easeOutExpo:
    http://www.zhihu.com/question/21981571/answer/19925418
    Defined in: CCActionEase.js.
    // example
    action.easing(cc.easeExponentialOut());
    Returns:
    {Object}
  • <static> {Object} cc.easeIn(rate)
    Creates the action easing object with the rate parameter.
    From slow to fast.
    Defined in: CCActionEase.js.
    // example
    action.easing(cc.easeIn(3.0));
    Parameters:
    {Number} rate
    Returns:
    {Object}
  • <static> {Object} cc.easeInOut(rate)
    Creates the action easing object with the rate parameter.
    Slow to fast then to slow.
    Defined in: CCActionEase.js.
    //The new usage
    action.easing(cc.easeInOut(3.0));
    Parameters:
    {Number} rate
    Returns:
    {Object}
  • <static> {Object} cc.easeOut(rate)
    Creates the action easing object with the rate parameter.
    From fast to slow.
    Defined in: CCActionEase.js.
    // example
    action.easing(cc.easeOut(3.0));
    Parameters:
    {Number} rate
    Returns:
    {Object}
  • <static> {Object} cc.easeQuadraticActionIn()
    Creates the action easing object.
    Reference easeInQuad:
    http://www.zhihu.com/question/21981571/answer/19925418
    Defined in: CCActionEase.js.
    //example
    action.easing(cc.easeQuadraticActionIn());
    Returns:
    {Object}
  • <static> {Object} cc.easeQuadraticActionInOut()
    Creates the action easing object.
    Reference easeInOutQuad:
    http://www.zhihu.com/question/21981571/answer/19925418
    Defined in: CCActionEase.js.
    //example
    action.easing(cc.easeQuadraticActionInOut());
    Returns:
    {Object}
  • <static> {Object} cc.easeQuadraticActionOut()
    Creates the action easing object.
    Reference easeOutQuad:
    http://www.zhihu.com/question/21981571/answer/19925418
    Defined in: CCActionEase.js.
    //example
    action.easing(cc.easeQuadraticActionOut());
    Returns:
    {Object}
  • <static> {Object} cc.easeQuarticActionIn()
    Creates the action easing object.
    Reference easeIntQuart:
    http://www.zhihu.com/question/21981571/answer/19925418
    Defined in: CCActionEase.js.
    //example
    action.easing(cc.easeQuarticActionIn());
    Returns:
    {Object}
  • <static> {Object} cc.easeQuarticActionInOut()
    Creates the action easing object.
    Reference easeInOutQuart:
    http://www.zhihu.com/question/21981571/answer/19925418
    Defined in: CCActionEase.js.
    Returns:
    {Object}
  • <static> {Object} cc.easeQuarticActionOut()
    Creates the action easing object.
    Reference easeOutQuart:
    http://www.zhihu.com/question/21981571/answer/19925418
    Defined in: CCActionEase.js.
    //example
    action.easing(cc.QuarticActionOut());
    Returns:
    {Object}
  • <static> {Object} cc.easeQuinticActionIn()
    Creates the action easing object.
    Reference easeInQuint:
    http://www.zhihu.com/question/21981571/answer/19925418
    Defined in: CCActionEase.js.
    //example
    action.easing(cc.easeQuinticActionIn());
    Returns:
    {Object}
  • <static> {Object} cc.easeQuinticActionInOut()
    Creates the action easing object.
    Reference easeInOutQuint:
    http://www.zhihu.com/question/21981571/answer/19925418
    Defined in: CCActionEase.js.
    //example
    action.easing(cc.easeQuinticActionInOut());
    Returns:
    {Object}
  • <static> {Object} cc.easeQuinticActionOut()
    Creates the action easing object.
    Reference easeOutQuint:
    http://www.zhihu.com/question/21981571/answer/19925418
    Defined in: CCActionEase.js.
    //example
    action.easing(cc.easeQuadraticActionOut());
    Returns:
    {Object}
  • <static> {cc.EaseRateAction} cc.easeRateAction(action, rate)
    Creates the action with the inner action and the rate parameter.
    Defined in: CCActionEase.js.
    // example
    var moveEaseRateAction = cc.easeRateAction(action, 3.0);
    Parameters:
    {cc.ActionInterval} action
    {Number} rate
    Returns:
    {cc.EaseRateAction}
  • <static> {Object} cc.easeSineIn()
    creates an EaseSineIn action.
    Reference easeInSine:
    http://www.zhihu.com/question/21981571/answer/19925418
    Defined in: CCActionEase.js.
    // example
    action.easing(cc.easeSineIn());
    Returns:
    {Object}
  • <static> {Object} cc.easeSineInOut()
    creates the action easing object.
    Reference easeInOutSine:
    http://www.zhihu.com/question/21981571/answer/19925418
    Defined in: CCActionEase.js.
    // example
    action.easing(cc.easeSineInOut());
    Returns:
    {Object}
  • <static> {Object} cc.easeSineOut()
    Creates an EaseSineOut action easing object.
    Reference easeOutSine:
    http://www.zhihu.com/question/21981571/answer/19925418
    Defined in: CCActionEase.js.
    // example
    action.easing(cc.easeSineOut());
    Returns:
    {Object}
  • <static> cc.enableDefaultGLStates()

    GL states that are enabled:
    - GL_TEXTURE_2D
    - GL_VERTEX_ARRAY
    - GL_TEXTURE_COORD_ARRAY
    - GL_COLOR_ARRAY


    Defined in: CCMacro.js.
  • <static> {object} cc.extend(target, *sources)
    Copy all of the properties in source objects to target object and return the target object.
    Parameters:
    {object} target
    {object} *sources
    Returns:
    {object}
  • <static> {cc.FadeIn} cc.fadeIn(duration)
    Fades In an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from 0 to 255.
    Defined in: CCActionInterval.js.
    //example
    var action = cc.fadeIn(1.0);
    Parameters:
    {Number} duration
    duration in seconds
    Returns:
    {cc.FadeIn}
  • <static> {cc.FadeOut} cc.fadeOut(d)
    Fades Out an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from 255 to 0.
    Defined in: CCActionInterval.js.
    // example
    var action = cc.fadeOut(1.0);
    Parameters:
    {Number} d
    duration in seconds
    Returns:
    {cc.FadeOut}
  • <static> {cc.FadeOutBLTiles} cc.fadeOutBLTiles(duration, gridSize)
    Creates the action with the grid size and the duration.
    Reference the test cases (Effects Test)
    Defined in: CCActionTiledGrid.js.
    Parameters:
    duration
    gridSize
    Returns:
    {cc.FadeOutBLTiles}
  • <static> {cc.FadeOutDownTiles} cc.fadeOutDownTiles(duration, gridSize)
    Creates the action with the grid size and the duration.
    Reference the test cases (Effects Test)
    Defined in: CCActionTiledGrid.js.
    Parameters:
    {Number} duration
    {cc.Size} gridSize
    Returns:
    {cc.FadeOutDownTiles}
  • <static> {cc.FadeOutTRTiles} cc.fadeOutTRTiles(duration, gridSize)
    Creates the action with the grid size and the duration.
    Reference the test cases (Effects Test)
    Defined in: CCActionTiledGrid.js.
    Parameters:
    duration
    gridSize
    Returns:
    {cc.FadeOutTRTiles}
  • <static> {cc.FadeOutUpTiles} cc.fadeOutUpTiles(duration, gridSize)
    Creates the action with the grid size and the duration.
    Reference the test cases (Effects Test)
    Defined in: CCActionTiledGrid.js.
    Parameters:
    {Number} duration
    {cc.Size} gridSize
    Returns:
    {cc.FadeOutUpTiles}
  • <static> {cc.FadeTo} cc.fadeTo(duration, opacity)
    Fades an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from the current value to a custom one.
    Defined in: CCActionInterval.js.
    // example
    var action = cc.fadeTo(1.0, 0);
    Parameters:
    {Number} duration
    {Number} opacity
    0-255, 0 is transparent
    Returns:
    {cc.FadeTo}
  • <static> {cc.FlipX} cc.flipX(flip)
    Create a FlipX action to flip or unflip the target.
    Defined in: CCActionInstant.js.
    var flipXAction = cc.flipX(true);
    Parameters:
    {Boolean} flip
    Indicate whether the target should be flipped or not
    Returns:
    {cc.FlipX}
  • <static> {cc.FlipX3D} cc.flipX3D(duration)
    Create a Flip X 3D action with duration.
    Flip around.
    Defined in: CCActionGrid3D.js.
    Parameters:
    {Number} duration
    Returns:
    {cc.FlipX3D}
  • <static> {cc.FlipY} cc.flipY(flip)
    Create a FlipY action to flip or unflip the target.
    Defined in: CCActionInstant.js.
    var flipYAction = cc.flipY(true);
    Parameters:
    {Boolean} flip
    Returns:
    {cc.FlipY}
  • <static> {cc.FlipY3D} cc.flipY3D(duration)
    Create a flip Y 3d action with duration.
    Upside down.
    Defined in: CCActionGrid3D.js.
    Parameters:
    {Number} duration
    Returns:
    {cc.FlipY3D}
  • <static> {cc.Follow|Null} cc.follow(followedNode, rect)
    creates the action with a set boundary.
    creates the action with no boundary set.
    Defined in: CCAction.js.
    // example
    // creates the action with a set boundary
    var sprite = new cc.Sprite("spriteFileName");
    var followAction = cc.follow(sprite, cc.rect(0, 0, s.width * 2 - 100, s.height));
    this.runAction(followAction);
    
    // creates the action with no boundary set
    var sprite = new cc.Sprite("spriteFileName");
    var followAction = cc.follow(sprite);
    this.runAction(followAction);
    Parameters:
    {cc.Node} followedNode
    {cc.Rect} rect
    Returns:
    {cc.Follow|Null} returns the cc.Follow object on success
  • <static> {String} cc.formatStr()
    A string tool to construct a string with format string. for example: cc.formatStr("a: %d, b: %b", a, b); cc.formatStr(a, b, c);
    Returns:
    {String}
  • <static> {Array} cc.getControlPointAt(controlPoints, pos)
    returns a point from the array
    Defined in: CCActionCatmullRom.js.
    Parameters:
    {Array} controlPoints
    {Number} pos
    Returns:
    {Array}
  • <static> {Number} cc.getImageFormatByData(imgData)
    get image format by image data
    Defined in: CCCommon.js.
    Parameters:
    {Array} imgData
    Returns:
    {Number}
  • <static> cc.glBindTexture2D(textureId)
    If the texture is not already bound, it binds it.
    If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindTexture() directly.
    Defined in: CCGLStateCache.js.
    Parameters:
    {cc.Texture2D} textureId
  • <static> cc.glBindTexture2DN(textureUnit, textureId)
    If the texture is not already bound to a given unit, it binds it.
    If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindTexture() directly.
    Defined in: CCGLStateCache.js.
    Parameters:
    {Number} textureUnit
    {cc.Texture2D} textureId
  • <static> cc.glBindVAO(vaoId)
    If the vertex array is not already bound, it binds it.
    If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindVertexArray() directly.
    Defined in: CCGLStateCache.js.
    Parameters:
    {Number} vaoId
  • <static> cc.glBlendFunc(sfactor, dfactor)
    Uses a blending function in case it not already used.
    If CC_ENABLE_GL_STATE_CACHE is disabled, it will the glBlendFunc() directly.
    Defined in: CCGLStateCache.js.
    Parameters:
    {Number} sfactor
    {Number} dfactor
  • <static> cc.glBlendFuncForParticle(sfactor, dfactor)

    Defined in: CCGLStateCache.js.
    Parameters:
    {Number} sfactor
    {Number} dfactor
  • <static> cc.glBlendResetToCache()
    Resets the blending mode back to the cached state in case you used glBlendFuncSeparate() or glBlendEquation().
    If CC_ENABLE_GL_STATE_CACHE is disabled, it will just set the default blending mode using GL_FUNC_ADD.
    Defined in: CCGLStateCache.js.
  • <static> cc.glDeleteProgram(program)
    Deletes the GL program. If it is the one that is being used, it invalidates it.
    If CC_ENABLE_GL_STATE_CACHE is disabled, it will the glDeleteProgram() directly.
    Defined in: CCGLStateCache.js.
    Parameters:
    {WebGLProgram} program
  • <static> cc.glDeleteTexture(textureId)
    It will delete a given texture. If the texture was bound, it will invalidate the cached.
    If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glDeleteTextures() directly.
    Defined in: CCGLStateCache.js.
    Parameters:
    {WebGLTexture} textureId
  • <static> cc.glDeleteTextureN(textureUnit, textureId)
    It will delete a given texture. If the texture was bound, it will invalidate the cached for the given texture unit.
    If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glDeleteTextures() directly.
    Defined in: CCGLStateCache.js.
    Parameters:
    {Number} textureUnit
    {WebGLTexture} textureId
  • <static> cc.glEnable(flags)
    It will enable / disable the server side GL states.
    If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glEnable() directly.
    Defined in: CCGLStateCache.js.
    Parameters:
    {Number} flags
  • <static> cc.glEnableVertexAttribs(flags)

    Will enable the vertex attribs that are passed as flags.
    Possible flags:
    cc.VERTEX_ATTRIB_FLAG_POSITION
    cc.VERTEX_ATTRIB_FLAG_COLOR
    cc.VERTEX_ATTRIB_FLAG_TEX_COORDS

    These flags can be ORed. The flags that are not present, will be disabled.


    Defined in: CCGLStateCache.js.
    Parameters:
    {cc.VERTEX_ATTRIB_FLAG_POSITION | cc.VERTEX_ATTRIB_FLAG_COLOR | cc.VERTEX_ATTRIB_FLAG_TEX_OORDS} flags
  • <static> cc.glInvalidateStateCache()
    Invalidates the GL state cache.
    If CC_ENABLE_GL_STATE_CACHE it will reset the GL state cache.
    Defined in: CCGLStateCache.js.
  • <static> cc.GLToCGAffine(mat, trans)
    Convert a kmMat4 object to an affine transform object
    Defined in: TransformUtils.js.
    Parameters:
    {cc.kmMat4} mat
    {cc.AffineTransform} trans
  • <static> cc.glUseProgram(program)
    Uses the GL program in case program is different than the current one.
    If CC_ENABLE_GL_STATE_CACHE is disabled, it will the glUseProgram() directly.
    Defined in: CCGLStateCache.js.
    Parameters:
    {WebGLProgram} program
  • <static> {cc.Grid3DAction} cc.grid3DAction(duration, gridSize)
    creates the action with size and duration
    Defined in: CCActionGrid.js.
    Parameters:
    {Number} duration
    {cc.Size} gridSize
    Returns:
    {cc.Grid3DAction}
  • <static> {cc.GridAction} cc.gridAction(duration, gridSize)
    creates the action with size and duration
    Defined in: CCActionGrid.js.
    Parameters:
    {Number} duration
    {cc.Size} gridSize
    Returns:
    {cc.GridAction}
  • <static> cc.HashUniformEntry(value, location, hh)
    ************************************************************************* Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2011-2012 cocos2d-x.org Copyright (c) 2013-2014 Chukong Technologies Inc. Copyright 2011 Jeff Lamarche Copyright 2012 Goffredo Marocchi http://www.cocos2d-x.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************
    Defined in: CCGLProgram.js.
    Parameters:
    value
    location
    hh
  • <static> {cc.Color} cc.hexToColor(hex)
    convert a string of color for style to Color. e.g. "#ff06ff" to : cc.color(255,6,255)
    Defined in: CCTypes.js.
    Parameters:
    {String} hex
    Returns:
    {cc.Color}
  • <static> {cc.Hide} cc.hide()
    Hide the node.
    Defined in: CCActionInstant.js.
    // example
    var hideAction = cc.hide();
    Returns:
    {cc.Hide}
  • <static> cc.IMEKeyboardNotificationInfo(begin, end, duration)
    IME Keyboard Notification Info structure
    Defined in: CCIMEDispatcher.js.
    Parameters:
    {cc.Rect} begin
    the soft keyboard rectangle when animatin begin
    {cc.Rect} end
    the soft keyboard rectangle when animatin end
    {Number} duration
    the soft keyboard animation duration
  • <static> cc.incrementGLDraws(addNumber)

    Increments the GL Draws counts by one.
    The number of calls per frame are displayed on the screen when the CCDirector's stats are enabled.


    Defined in: CCMacro.js.
    Parameters:
    {Number} addNumber
  • <static> cc.inherits(childCtor, parentCtor)
    Another way to subclass: Using Google Closure. The following code was copied + pasted from goog.base / goog.inherits
    Defined in: CCCommon.js.
    Parameters:
    {Function} childCtor
    {Function} parentCtor
  • <static> {boolean} cc.isArray(obj)
    Check the obj whether is array or not
    Parameters:
    {*} obj
    Returns:
    {boolean}
  • <static> {boolean} cc.isCrossOrigin(url)
    Check the url whether cross origin
    Parameters:
    {String} url
    Returns:
    {boolean}
  • <static> {boolean} cc.isFunction(obj)
    Check the obj whether is function or not
    Parameters:
    {*} obj
    Returns:
    {boolean}
  • <static> {boolean} cc.isNumber(obj)
    Check the obj whether is number or not
    Parameters:
    {*} obj
    Returns:
    {boolean}
  • <static> {boolean} cc.isObject(obj)
    Check the obj whether is object or not
    Parameters:
    {*} obj
    Returns:
    {boolean}
  • <static> {boolean} cc.isString(obj)
    Check the obj whether is string or not
    Parameters:
    {*} obj
    Returns:
    {boolean}
  • <static> {boolean} cc.isUndefined(obj)
    Check the obj whether is undefined or not
    Parameters:
    {*} obj
    Returns:
    {boolean}
  • <static> {cc.JumpBy} cc.jumpBy(duration, position, y, height, jumps)
    Moves a cc.Node object simulating a parabolic jump movement by modifying it's position attribute. Relative to its movement.
    Defined in: CCActionInterval.js.
    // example
    var actionBy = cc.jumpBy(2, cc.p(300, 0), 50, 4);
    var actionBy = cc.jumpBy(2, 300, 0, 50, 4);
    Parameters:
    {Number} duration
    {cc.Point|Number} position
    {Number} y Optional
    {Number} height
    {Number} jumps
    Returns:
    {cc.JumpBy}
  • <static> {cc.JumpTiles3D} cc.jumpTiles3D(duration, gridSize, numberOfJumps, amplitude)
    creates the action with the number of jumps, the sin amplitude, the grid size and the duration.
    Reference the test cases (Effects Test)
    Defined in: CCActionTiledGrid.js.
    Parameters:
    {Number} duration
    {cc.Size} gridSize
    {Number} numberOfJumps
    {Number} amplitude
    Returns:
    {cc.JumpTiles3D}
  • <static> {cc.JumpTo} cc.jumpTo(duration, position, y, height, jumps)
    Moves a cc.Node object to a parabolic position simulating a jump movement by modifying it's position attribute.
    Jump to the specified location.
    Defined in: CCActionInterval.js.
    // example
    var actionTo = cc.jumpTo(2, cc.p(300, 300), 50, 4);
    var actionTo = cc.jumpTo(2, 300, 300, 50, 4);
    Parameters:
    {Number} duration
    {cc.Point|Number} position
    {Number} y Optional
    {Number} height
    {Number} jumps
    Returns:
    {cc.JumpTo}
  • <static> {cc.Lens3D} cc.lens3D(duration, gridSize, position, radius)
    creates a lens 3d action with center position, radius
    Defined in: CCActionGrid3D.js.
    Parameters:
    {Number} duration
    {cc.Size} gridSize
    {cc.Point} position
    {Number} radius
    Returns:
    {cc.Lens3D}
  • <static> cc.lerp(a, b, r)

    Linear interpolation between 2 numbers, the ratio sets how much it is biased to each end


    Defined in: CCMacro.js.
    cc.lerp(2,10,0.5)//returns 6
    cc.lerp(2,10,0.2)//returns 3.6
    Parameters:
    {Number} a
    number A
    {Number} b
    number B
    {Number} r
    ratio between 0 and 1
  • <static> {cc.Liquid} cc.liquid(duration, gridSize, waves, amplitude)
    creates the action with amplitude, a grid and duration
    Defined in: CCActionGrid3D.js.
    Parameters:
    {Number} duration
    {cc.Size} gridSize
    {Number} waves
    {Number} amplitude
    Returns:
    {cc.Liquid}
  • <static> {cc.MoveBy} cc.moveBy(duration, deltaPos, deltaY)
    Create the action. Relative to its coordinate moves a certain distance.
    Defined in: CCActionInterval.js.
    // example
    var actionTo = cc.moveBy(2, cc.p(windowSize.width - 40, windowSize.height - 40));
    Parameters:
    {Number} duration
    duration in seconds
    {cc.Point|Number} deltaPos
    {Number} deltaY
    Returns:
    {cc.MoveBy}
  • <static> {cc.MoveBy} cc.moveTo(duration, position, y)
    Create new action. Moving to the specified coordinates.
    Defined in: CCActionInterval.js.
    // example
    var actionBy = cc.moveTo(2, cc.p(80, 80));
    Parameters:
    {Number} duration
    duration in seconds
    {cc.Point} position
    {Number} y
    Returns:
    {cc.MoveBy}
  • <static> {Number} cc.NextPOT(x)

    Defined in: CCRenderTexture.js.
    Parameters:
    {Number} x
    Returns:
    {Number} Constructor
  • <static> cc.nodeDrawSetup(node)
    Helpful macro that setups the GL server state, the correct GL program and sets the Model View Projection matrix
    Defined in: CCMacro.js.
    Parameters:
    {cc.Node} node
    setup node
  • <static> {cc.Point} cc.p(x, y)
    Helper function that creates a cc.Point.
    Defined in: CCGeometry.js.
    var point1 = cc.p();
    var point2 = cc.p(100, 100);
    var point3 = cc.p(point2);
    var point4 = cc.p({x: 100, y: 100});
    Parameters:
    {Number|cc.Point} x
    a Number or a size object
    {Number} y
    Returns:
    {cc.Point}
  • <static> {cc.Point} cc.pAdd(v1, v2)
    Calculates sum of two points.
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v1
    {cc.Point} v2
    Returns:
    {cc.Point}
  • <static> cc.pAddIn(v1, v2)
    adds one point to another (inplace)
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v1
    {cc.point} v2
  • <static> {cc.PageTurn3D} cc.pageTurn3D(duration, gridSize)
    create PageTurn3D action
    Defined in: CCActionPageTurn3D.js.
    Parameters:
    {Number} duration
    {cc.Size} gridSize
    Returns:
    {cc.PageTurn3D}
  • <static> {Number} cc.pAngle(a, b)

    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} a
    {cc.Point} b
    Returns:
    {Number} the angle in radians between two vector directions
  • <static> {Number} cc.pAngleSigned(a, b)

    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} a
    {cc.Point} b
    Returns:
    {Number} the signed angle in radians between two vector directions
  • <static> {cc.Point} cc.pClamp(p, min_inclusive, max_inclusive)
    Clamp a point between from and to.
    Defined in: CCPointExtension.js.
    Parameters:
    {Point} p
    {Number} min_inclusive
    {Number} max_inclusive
    Returns:
    {cc.Point}
  • <static> {cc.Point} cc.pCompMult(a, b)
    Multiplies a nd b components, a.x*b.x, a.y*b.y
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} a
    {cc.Point} b
    Returns:
    {cc.Point}
  • <static> {cc.Point} cc.pCompOp(p, opFunc)
    Run a math operation function on each point component
    Math.abs, Math.fllor, Math.ceil, Math.round.
    Defined in: CCPointExtension.js.
    //For example: let's try to take the floor of x,y
    var p = cc.pCompOp(cc.p(10,10),Math.abs);
    Parameters:
    {cc.Point} p
    {Function} opFunc
    Returns:
    {cc.Point}
  • <static> {Number} cc.pCross(v1, v2)
    Calculates cross product of two points.
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v1
    {cc.Point} v2
    Returns:
    {Number}
  • <static> {Number} cc.pDistance(v1, v2)
    Calculates the distance between two points
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v1
    {cc.Point} v2
    Returns:
    {Number}
  • <static> {Number} cc.pDistanceSQ(point1, point2)
    Calculates the square distance between two points (not calling sqrt() )
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} point1
    {cc.Point} point2
    Returns:
    {Number}
  • <static> {Number} cc.pDot(v1, v2)
    Calculates dot product of two points.
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v1
    {cc.Point} v2
    Returns:
    {Number}
  • <static> {cc.Point} cc.pForAngle(a)
    Converts radians to a normalized vector.
    Defined in: CCPointExtension.js.
    Parameters:
    {Number} a
    Returns:
    {cc.Point}
  • <static> {cc.Point} cc.pFromSize(s)
    Quickly convert cc.Size to a cc.Point
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Size} s
    Returns:
    {cc.Point}
  • <static> {Boolean} cc.pFuzzyEqual(a, b, variance)

    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} a
    {cc.Point} b
    {Number} variance
    Returns:
    {Boolean} if points have fuzzy equality which means equal with some degree of variance.
  • <static> cc.pIn(v1, v2)
    copies the position of one point to another
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v1
    {cc.Point} v2
  • <static> {cc.Point} cc.pIntersectPoint(A, B, C, D)
    ccpIntersectPoint return the intersection point of line A-B, C-D
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} A
    {cc.Point} B
    {cc.Point} C
    {cc.Point} D
    Returns:
    {cc.Point}
  • <static> {cc.Place} cc.place(pos, y)
    Creates a Place action with a position.
    Defined in: CCActionInstant.js.
    // example
    var placeAction = cc.place(cc.p(200, 200));
    var placeAction = cc.place(200, 200);
    Parameters:
    {cc.Point|Number} pos
    {Number} y Optional
    Returns:
    {cc.Place}
  • <static> {Number} cc.pLength(v)
    Calculates distance between point an origin
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v
    Returns:
    {Number}
  • <static> {Number} cc.pLengthSQ(v)
    Calculates the square length of a cc.Point (not calling sqrt() )
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v
    Returns:
    {Number}
  • <static> {cc.pAdd} cc.pLerp(a, b, alpha)
    Linear Interpolation between two points a and b alpha == 0 ? a alpha == 1 ? b otherwise a value between a..b
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} a
    {cc.Point} b
    {Number} alpha
    Returns:
    {cc.pAdd}
  • <static> {Boolean} cc.pLineIntersect(A, B, C, D, retP)
    A general line-line intersection test indicating successful intersection of a line
    note that to truly test intersection for segments we have to make
    sure that s & t lie within [0..1] and for rays, make sure s & t > 0
    the hit point is p3 + t * (p4 - p3);
    the hit point also is p1 + s * (p2 - p1);
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} A
    A is the startpoint for the first line P1 = (p1 - p2).
    {cc.Point} B
    B is the endpoint for the first line P1 = (p1 - p2).
    {cc.Point} C
    C is the startpoint for the second line P2 = (p3 - p4).
    {cc.Point} D
    D is the endpoint for the second line P2 = (p3 - p4).
    {cc.Point} retP
    retP.x is the range for a hitpoint in P1 (pa = p1 + s*(p2 - p1)),
    retP.y is the range for a hitpoint in P3 (pa = p2 + t*(p4 - p3)).
    Returns:
    {Boolean}
  • <static> {cc.pMult} cc.pMidpoint(v1, v2)
    Calculates midpoint between two points.
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v1
    {cc.Point} v2
    Returns:
    {cc.pMult}
  • <static> {cc.Point} cc.pMult(point, floatVar)
    Returns point multiplied by given factor.
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} point
    {Number} floatVar
    Returns:
    {cc.Point}
  • <static> cc.pMultIn(point, floatVar)
    multiplies the point with the given factor (inplace)
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} point
    {Number} floatVar
  • <static> {cc.Point} cc.pNeg(point)
    Returns opposite of point.
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} point
    Returns:
    {cc.Point}
  • <static> {cc.Point} cc.pNormalize(v)
    Returns point multiplied to a length of 1.
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v
    Returns:
    {cc.Point}
  • <static> cc.pNormalizeIn(v)
    normalizes the point (inplace)
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v
  • <static> {cc.Point} cc.pointApplyAffineTransform(point, transOrY, t)
    Apply the affine transformation on a point.
    Defined in: CCAffineTransform.js.
    Parameters:
    {cc.Point|Number} point
    or x
    {cc.AffineTransform|Number} transOrY
    transform matrix or y
    {cc.AffineTransform} t
    transform matrix or y
    Returns:
    {cc.Point}
  • <static> {Boolean} cc.pointEqualToPoint(point1, point2)
    Check whether a point's value equals to another
    Defined in: CCGeometry.js.
    Parameters:
    {cc.Point} point1
    {cc.Point} point2
    Returns:
    {Boolean}
  • <static> {cc.Point} cc.pointPixelsToPoints(pixels)
    Converts a Point in pixels to points
    Defined in: CCMacro.js.
    Parameters:
    {cc.Rect} pixels
    Returns:
    {cc.Point}
  • <static> {cc.Point} cc.pointPointsToPixels(points)
    Converts a Point in points to pixels
    Defined in: CCMacro.js.
    Parameters:
    {cc.Point} points
    Returns:
    {cc.Point}
  • <static> {cc.Point} cc.pPerp(point)
    Calculates perpendicular of v, rotated 90 degrees counter-clockwise -- cross(v, perp(v)) >= 0
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} point
    Returns:
    {cc.Point}
  • <static> {cc.pMult} cc.pProject(v1, v2)
    Calculates the projection of v1 over v2.
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v1
    {cc.Point} v2
    Returns:
    {cc.pMult}
  • <static> {cc.ProgressFromTo} cc.progressFromTo(duration, fromPercentage, toPercentage)
    Creates and initializes the action with a duration, a "from" percentage and a "to" percentage
    Defined in: CCActionProgressTimer.js.
    // example
     var fromTo = cc.progressFromTo(2, 100.0, 0.0);
    Parameters:
    {Number} duration
    duration in seconds
    {Number} fromPercentage
    {Number} toPercentage
    Returns:
    {cc.ProgressFromTo}
  • <static> {cc.ProgressTo} cc.progressTo(duration, percent)
    Creates and initializes with a duration and a percent
    Defined in: CCActionProgressTimer.js.
    // example
    var to = cc.progressTo(2, 100);
    Parameters:
    {Number} duration
    duration in seconds
    {Number} percent
    Returns:
    {cc.ProgressTo}
  • <static> {cc.Point} cc.pRotate(v1, v2)
    Rotates two points.
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v1
    {cc.Point} v2
    Returns:
    {cc.Point}
  • <static> {cc.Point} cc.pRotateByAngle(v, pivot, angle)
    Rotates a point counter clockwise by the angle around a pivot
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v
    v is the point to rotate
    {cc.Point} pivot
    pivot is the pivot, naturally
    {Number} angle
    angle is the angle of rotation cw in radians
    Returns:
    {cc.Point} the rotated point
  • <static> {cc.Point} cc.pRPerp(point)
    Calculates perpendicular of v, rotated 90 degrees clockwise -- cross(v, rperp(v)) <= 0
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} point
    Returns:
    {cc.Point}
  • <static> {Boolean} cc.pSameAs(A, B)
    check to see if both points are equal
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} A
    A ccp a
    {cc.Point} B
    B ccp b to be compared
    Returns:
    {Boolean} the true if both ccp are same
  • <static> {Boolean} cc.pSegmentIntersect(A, B, C, D)
    ccpSegmentIntersect return YES if Segment A-B intersects with segment C-D.
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} A
    {cc.Point} B
    {cc.Point} C
    {cc.Point} D
    Returns:
    {Boolean}
  • <static> {cc.Point} cc.pSub(v1, v2)
    Calculates difference of two points.
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v1
    {cc.Point} v2
    Returns:
    {cc.Point}
  • <static> cc.pSubIn(v1, v2)
    subtracts one point from another (inplace)
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v1
    {cc.Point} v2
  • <static> {Number} cc.pToAngle(v)
    Converts a vector to radians.
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v
    Returns:
    {Number}
  • <static> {cc.Point} cc.pUnrotate(v1, v2)
    Unrotates two points.
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v1
    {cc.Point} v2
    Returns:
    {cc.Point}
  • <static> cc.pZeroIn(v)
    sets the position of the point to 0
    Defined in: CCPointExtension.js.
    Parameters:
    {cc.Point} v
  • <static> {Number} cc.radiansToDegrees(angle)
    converts radians to degrees
    Defined in: CCMacro.js.
    Parameters:
    {Number} angle
    Returns:
    {Number}
  • <static> {Number} cc.radiansToDegress(angle)
    converts radians to degrees
    Defined in: CCMacro.js.
    Parameters:
    {Number} angle
    Returns:
    {Number}
  • <static> {number} cc.rand()
    get a random number from 0 to 0xffffff
    Defined in: CCMacro.js.
    Returns:
    {number}
  • <static> {Number} cc.random0To1()
    returns a random float between 0 and 1
    Defined in: CCMacro.js.
    Returns:
    {Number}
  • <static> {Number} cc.randomMinus1To1()
    returns a random float between -1 and 1
    Defined in: CCMacro.js.
    Returns:
    {Number}
  • <static> {cc.Rect} cc.rect(x, y, w, h)
    Helper function that creates a cc.Rect.
    Defined in: CCGeometry.js.
    var rect1 = cc.rect();
    var rect2 = cc.rect(100,100,100,100);
    var rect3 = cc.rect(rect2);
    var rect4 = cc.rect({x: 100, y: 100, width: 100, height: 100});
    Parameters:
    {Number|cc.Rect} x
    a number or a rect object
    {Number} y
    {Number} w
    {Number} h
    Returns:
    {cc.Rect}
  • <static> {cc.Rect} cc.rectApplyAffineTransform(rect, anAffineTransform)
    Apply the affine transformation on a rect.
    Defined in: CCAffineTransform.js.
    Parameters:
    {cc.Rect} rect
    {cc.AffineTransform} anAffineTransform
    Returns:
    {cc.Rect}
  • <static> {Boolean} cc.rectContainsPoint(rect, point)
    Check whether a rect contains a point
    Defined in: CCGeometry.js.
    Parameters:
    {cc.Rect} rect
    {cc.Point} point
    Returns:
    {Boolean}
  • <static> {Boolean} cc.rectContainsRect(rect1, rect2)
    Check whether the rect1 contains rect2
    Defined in: CCGeometry.js.
    Parameters:
    {cc.Rect} rect1
    {cc.Rect} rect2
    Returns:
    {Boolean}
  • <static> {Boolean} cc.rectEqualToRect(rect1, rect2)
    Check whether a rect's value equals to another
    Defined in: CCGeometry.js.
    Parameters:
    {cc.Rect} rect1
    {cc.Rect} rect2
    Returns:
    {Boolean}
  • <static> {Number} cc.rectGetMaxX(rect)
    Returns the rightmost x-value of a rect
    Defined in: CCGeometry.js.
    Parameters:
    {cc.Rect} rect
    Returns:
    {Number} The rightmost x value
  • <static> {Number} cc.rectGetMaxY(rect)
    Return the topmost y-value of a rect
    Defined in: CCGeometry.js.
    Parameters:
    {cc.Rect} rect
    Returns:
    {Number} The topmost y value
  • <static> {Number} cc.rectGetMidX(rect)
    Return the midpoint x-value of a rect
    Defined in: CCGeometry.js.
    Parameters:
    {cc.Rect} rect
    Returns:
    {Number} The midpoint x value
  • <static> {Number} cc.rectGetMidY(rect)
    Return the midpoint y-value of `rect'
    Defined in: CCGeometry.js.
    Parameters:
    {cc.Rect} rect
    Returns:
    {Number} The midpoint y value
  • <static> {Number} cc.rectGetMinX(rect)
    Returns the leftmost x-value of a rect
    Defined in: CCGeometry.js.
    Parameters:
    {cc.Rect} rect
    Returns:
    {Number} The leftmost x value
  • <static> {Number} cc.rectGetMinY(rect)
    Return the bottommost y-value of a rect
    Defined in: CCGeometry.js.
    Parameters:
    {cc.Rect} rect
    Returns:
    {Number} The bottommost y value
  • <static> {cc.Rect} cc.rectIntersection(rectA, rectB)
    Returns the overlapping portion of 2 rectangles
    Defined in: CCGeometry.js.
    Parameters:
    {cc.Rect} rectA
    {cc.Rect} rectB
    Returns:
    {cc.Rect}
  • <static> {Boolean} cc.rectIntersectsRect(rectA, rectB)
    Check whether a rect intersect with another
    Defined in: CCGeometry.js.
    Parameters:
    {cc.Rect} rectA
    {cc.Rect} rectB
    Returns:
    {Boolean}
  • <static> {Boolean} cc.rectOverlapsRect(rectA, rectB)
    Check whether a rect overlaps another
    Defined in: CCGeometry.js.
    Parameters:
    {cc.Rect} rectA
    {cc.Rect} rectB
    Returns:
    {Boolean}
  • <static> {cc.Rect} cc.rectPixelsToPoints(pixel)
    Converts a rect in pixels to points
    Defined in: CCMacro.js.
    Parameters:
    {cc.Rect} pixel
    Returns:
    {cc.Rect}
  • <static> {cc.Rect} cc.rectPointsToPixels(point)
    Converts a rect in points to pixels
    Defined in: CCMacro.js.
    Parameters:
    {cc.Rect} point
    Returns:
    {cc.Rect}
  • <static> {cc.Rect} cc.rectUnion(rectA, rectB)
    Returns the smallest rectangle that contains the two source rectangles.
    Defined in: CCGeometry.js.
    Parameters:
    {cc.Rect} rectA
    {cc.Rect} rectB
    Returns:
    {cc.Rect}
  • <static> {cc.RemoveSelf} cc.removeSelf(isNeedCleanUp)
    Create a RemoveSelf object with a flag indicate whether the target should be cleaned up while removing.
    Defined in: CCActionInstant.js.
    // example
    var removeSelfAction = cc.removeSelf();
    Parameters:
    {Boolean} isNeedCleanUp Optional, Default: true
    Returns:
    {cc.RemoveSelf}
  • <static> {cc.Repeat} cc.repeat(action, times)
    Creates a Repeat action. Times is an unsigned integer between 1 and pow(2,30)
    Defined in: CCActionInterval.js.
    // example
    var rep = cc.repeat(cc.sequence(jump2, jump1), 5);
    Parameters:
    {cc.FiniteTimeAction} action
    {Number} times
    Returns:
    {cc.Repeat}
  • <static> {cc.RepeatForever} cc.repeatForever(action)
    Create a acton which repeat forever
    Defined in: CCActionInterval.js.
    // example
    var repeat = cc.repeatForever(cc.rotateBy(1.0, 360));
    Parameters:
    {cc.FiniteTimeAction} action
    Returns:
    {cc.RepeatForever}
  • <static> {cc.ReuseGrid} cc.reuseGrid(times)
    creates an action with the number of times that the current grid will be reused
    Defined in: CCActionGrid.js.
    Parameters:
    {Number} times
    Returns:
    {cc.ReuseGrid}
  • <static> {Array} cc.reverseControlPoints(controlPoints)
    returns a new copy of the array reversed.
    Defined in: CCActionCatmullRom.js.
    Parameters:
    controlPoints
    Returns:
    {Array}
  • <static> cc.reverseControlPointsInline(controlPoints)
    reverse the current control point array inline, without generating a new one

    Defined in: CCActionCatmullRom.js.
    Parameters:
    controlPoints
  • <static> {cc.ReverseTime} cc.reverseTime(action)
    Executes an action in reverse order, from time=duration to time=0.
    Defined in: CCActionInterval.js.
    // example
     var reverse = cc.reverseTime(this);
    Parameters:
    {cc.FiniteTimeAction} action
    Returns:
    {cc.ReverseTime}
  • <static> {cc.Ripple3D} cc.ripple3D(duration, gridSize, position, radius, waves, amplitude)
    creates a ripple 3d action with radius, number of waves, amplitude
    Defined in: CCActionGrid3D.js.
    Parameters:
    {Number} duration
    {cc.Size} gridSize
    {cc.Point} position
    {Number} radius
    {Number} waves
    {Number} amplitude
    Returns:
    {cc.Ripple3D}
  • <static> {cc.RotateBy} cc.rotateBy(duration, deltaAngleX, deltaAngleY)
    Rotates a cc.Node object clockwise a number of degrees by modifying it's rotation attribute. Relative to its properties to modify.
    Defined in: CCActionInterval.js.
    // example
    var actionBy = cc.rotateBy(2, 360);
    Parameters:
    {Number} duration
    duration in seconds
    {Number} deltaAngleX
    deltaAngleX in degrees
    {Number} deltaAngleY Optional
    deltaAngleY in degrees
    Returns:
    {cc.RotateBy}
  • <static> {cc.RotateTo} cc.rotateTo(duration, deltaAngleX, deltaAngleY)
    Creates a RotateTo action with separate rotation angles. To specify the angle of rotation.
    Defined in: CCActionInterval.js.
    // example
    var rotateTo = cc.rotateTo(2, 61.0);
    Parameters:
    {Number} duration
    duration in seconds
    {Number} deltaAngleX
    deltaAngleX in degrees.
    {Number} deltaAngleY Optional
    deltaAngleY in degrees.
    Returns:
    {cc.RotateTo}
  • <static> {cc.ScaleBy} cc.scaleBy(duration, sx, sy)
    Scales a cc.Node object a zoom factor by modifying it's scale attribute. Relative to its changes.
    Defined in: CCActionInterval.js.
    // example without sy, it scales by 2 both in X and Y
    var actionBy = cc.scaleBy(2, 2);
    
    //example with sy, it scales by 0.25 in X and 4.5 in Y
    var actionBy2 = cc.scaleBy(2, 0.25, 4.5);
    Parameters:
    {Number} duration
    duration in seconds
    {Number} sx
    sx scale parameter in X
    {Number|Null} sy Optional
    sy scale parameter in Y, if Null equal to sx
    Returns:
    {cc.ScaleBy}
  • <static> {cc.ScaleTo} cc.scaleTo(duration, sx, sy)
    Scales a cc.Node object to a zoom factor by modifying it's scale attribute.
    Defined in: CCActionInterval.js.
    // example
    // It scales to 0.5 in both X and Y.
    var actionTo = cc.scaleTo(2, 0.5);
    
    // It scales to 0.5 in x and 2 in Y
    var actionTo = cc.scaleTo(2, 0.5, 2);
    Parameters:
    {Number} duration
    {Number} sx
    scale parameter in X
    {Number} sy Optional
    scale parameter in Y, if Null equal to sx
    Returns:
    {cc.ScaleTo}
  • <static> {cc.Sequence} cc.sequence(tempArray)
    helper constructor to create an array of sequenceable actions
    Defined in: CCActionInterval.js.
    // example
    // create sequence with actions
    var seq = cc.sequence(act1, act2);
    
    // create sequence with array
    var seq = cc.sequence(actArray);
    todo: It should be use new
    Parameters:
    {Array|cc.FiniteTimeAction} tempArray
    Returns:
    {cc.Sequence}
  • <static> cc.setBlending(sfactor, dfactor)

    Defined in: CCGLStateCache.js.
    Parameters:
    {Number} sfactor
    {Number} dfactor
  • <static> cc.setProgram(node, program)

    Sets the shader program for this node Since v2.0, each rendering node must set its shader program. It should be set in initialize phase.


    Defined in: CCGLProgram.js.
    cc.setGLProgram(node, cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURECOLOR));
    Parameters:
    {cc.Node} node
    {cc.GLProgram} program
    The shader program which fetches from CCShaderCache.
  • <static> cc.setProjectionMatrixDirty()
    sets the projection matrix as dirty
    Defined in: CCGLStateCache.js.
  • <static> {cc.Shaky3D} cc.shaky3D(duration, gridSize, range, shakeZ)
    creates the action with a range, shake Z vertices, a grid and duration
    Defined in: CCActionGrid3D.js.
    Parameters:
    {Number} duration
    {cc.Size} gridSize
    {Number} range
    {Boolean} shakeZ
    Returns:
    {cc.Shaky3D}
  • <static> {cc.ShakyTiles3D} cc.shakyTiles3D(duration, gridSize, range, shakeZ)
    Creates the action with a range, whether or not to shake Z vertices, a grid size, and duration.
    Reference the test cases (Effects Test)
    Defined in: CCActionTiledGrid.js.
    Parameters:
    {Number} duration
    {cc.Size} gridSize
    {Number} range
    {Boolean} shakeZ
    Returns:
    {cc.ShakyTiles3D}
  • <static> {cc.ShatteredTiles3D} cc.shatteredTiles3D(duration, gridSize, range, shatterZ)
    Creates the action with a range, whether of not to shatter Z vertices, a grid size and duration.
    Reference the test cases (Effects Test)
    Defined in: CCActionTiledGrid.js.
    Parameters:
    {Number} duration
    {cc.Size} gridSize
    {Number} range
    {Boolean} shatterZ
    Returns:
    {cc.ShatteredTiles3D}
  • <static> {cc.Show} cc.show()
    Show the Node.
    Defined in: CCActionInstant.js.
    // example
    var showAction = cc.show();
    Returns:
    {cc.Show}
  • <static> {cc.ShuffleTiles} cc.shuffleTiles(duration, gridSize, seed)
    Creates the action with a random seed, the grid size and the duration.
    Reference the test cases (Effects Test)
    Defined in: CCActionTiledGrid.js.
    Parameters:
    {Number} duration
    {cc.Size} gridSize
    {Number} seed
    Returns:
    {cc.ShuffleTiles}
  • <static> {cc.Size} cc.size(w, h)
    Helper function that creates a cc.Size.
    Defined in: CCGeometry.js.
    var size1 = cc.size();
    var size2 = cc.size(100,100);
    var size3 = cc.size(size2);
    var size4 = cc.size({width: 100, height: 100});
    Parameters:
    {Number|cc.Size} w
    width or a size object
    {Number} h
    height
    Returns:
    {cc.Size}
  • <static> {cc.Size} cc.sizeApplyAffineTransform(size, t)
    Apply the affine transformation on a size.
    Defined in: CCAffineTransform.js.
    Parameters:
    {cc.Size} size
    {cc.AffineTransform} t
    Returns:
    {cc.Size}
  • <static> {Boolean} cc.sizeEqualToSize(size1, size2)
    Check whether a point's value equals to another
    Defined in: CCGeometry.js.
    Parameters:
    {cc.Size} size1
    {cc.Size} size2
    Returns:
    {Boolean}
  • <static> {cc.Size} cc.sizePixelsToPoints(sizeInPixels)
    Converts a size in pixels to points
    Defined in: CCMacro.js.
    Parameters:
    {cc.Size} sizeInPixels
    Returns:
    {cc.Size}
  • <static> {cc.Size} cc.sizePointsToPixels(sizeInPoints)
    Converts a Size in points to pixels
    Defined in: CCMacro.js.
    Parameters:
    {cc.Size} sizeInPoints
    Returns:
    {cc.Size}
  • <static> {cc.SkewBy} cc.skewBy(t, sx, sy)
    Skews a cc.Node object by skewX and skewY degrees.
    Relative to its attribute modification.
    Defined in: CCActionInterval.js.
    // example
    var actionBy = cc.skewBy(2, 0, -90);
    Parameters:
    {Number} t
    time in seconds
    {Number} sx
    sx skew in degrees for X axis
    {Number} sy
    sy skew in degrees for Y axis
    Returns:
    {cc.SkewBy}
  • <static> {cc.SkewTo} cc.skewTo(t, sx, sy)
    Create new action. Skews a cc.Node object to given angles by modifying it's skewX and skewY attributes. Changes to the specified value.
    Defined in: CCActionInterval.js.
    // example
    var actionTo = cc.skewTo(2, 37.2, -37.2);
    Parameters:
    {Number} t
    time in seconds
    {Number} sx
    {Number} sy
    Returns:
    {cc.SkewTo}
  • <static> {cc.FiniteTimeAction} cc.spawn(tempArray)
    Create a spawn action which runs several actions in parallel.
    Defined in: CCActionInterval.js.
    // example
    var action = cc.spawn(cc.jumpBy(2, cc.p(300, 0), 50, 4), cc.rotateBy(2, 720));
    todo:It should be the direct use new
    Parameters:
    {Array|cc.FiniteTimeAction} tempArray
    Returns:
    {cc.FiniteTimeAction}
  • <static> {cc.Speed} cc.speed(action, speed)
    creates the speed action.
    Defined in: CCAction.js.
    Parameters:
    {cc.ActionInterval} action
    {Number} speed
    Returns:
    {cc.Speed}
  • <static> {cc.SplitCols} cc.splitCols(duration, cols)
    creates the action with the number of columns to split and the duration.
    Reference the test cases (Effects Test)
    Defined in: CCActionTiledGrid.js.
    Parameters:
    {Number} duration
    {Number} cols
    Returns:
    {cc.SplitCols}
  • <static> {cc.SplitRows} cc.splitRows(duration, rows)
    creates the action with the number of rows to split and the duration.
    Reference the test cases (Effects Test)
    Defined in: CCActionTiledGrid.js.
    Parameters:
    {Number} duration
    {Number} rows
    Returns:
    {cc.SplitRows}
  • <static> {cc.StopGrid} cc.stopGrid()
    Allocates and initializes the action
    Defined in: CCActionGrid.js.
    Returns:
    {cc.StopGrid}
  • <static> cc.swap(x, y, ref)

    simple macro that swaps 2 variables
    modified from c++ macro, you need to pass in the x and y variables names in string,
    and then a reference to the whole object as third variable


    Defined in: CCMacro.js.
    Parameters:
    {String} x
    {String} y
    {Object} ref
    Deprecated:
    since v3.0
  • <static> {cc.TargetedAction} cc.targetedAction(target, action)
    Create an action with the specified action and forced target
    Defined in: CCActionInterval.js.
    Parameters:
    {cc.Node} target
    {cc.FiniteTimeAction} action
    Returns:
    {cc.TargetedAction}
  • <static> {cc.Tex2F} cc.tex2(u, v)
    Helper macro that creates an Tex2F type: A texcoord composed of 2 floats: u, y
    Defined in: CCTypes.js.
    Parameters:
    {Number} u
    {Number} v
    Returns:
    {cc.Tex2F}
  • <static> cc.tgaDestroy(psInfo)
    releases the memory used for the image
    Defined in: CCTGAlib.js.
    Parameters:
    {cc.ImageTGA} psInfo
  • <static> cc.tgaFlipImage(psInfo)
    ImageTGA Flip
    Defined in: CCTGAlib.js.
    Parameters:
    {cc.ImageTGA} psInfo
  • <static> {Boolean} cc.tgaLoadHeader(buffer, bufSize, psInfo)
    load the image header field from stream. We only keep those that matter!
    Defined in: CCTGAlib.js.
    Parameters:
    {Array} buffer
    {Number} bufSize
    {cc.ImageTGA} psInfo
    Returns:
    {Boolean}
  • <static> {Boolean} cc.tgaLoadImageData(buffer, bufSize, psInfo)
    loads the image pixels. You shouldn't call this function directly.
    Defined in: CCTGAlib.js.
    Parameters:
    {Array} buffer
    {Number} bufSize
    {cc.ImageTGA} psInfo
    Returns:
    {Boolean}
  • <static> {boolean} cc.tgaLoadRLEImageData(buffer, bufSize, psInfo)
    Load RLE image data
    Defined in: CCTGAlib.js.
    Parameters:
    buffer
    bufSize
    psInfo
    Returns:
    {boolean}
  • <static> cc.tgaRGBtogreyscale(psInfo)
    converts RGB to grayscale
    Defined in: CCTGAlib.js.
    Parameters:
    {cc.ImageTGA} psInfo
  • <static> {cc.TiledGrid3DAction} cc.tiledGrid3DAction(duration, gridSize)
    Creates the action with duration and grid size
    Defined in: CCActionGrid.js.
    Parameters:
    {Number} duration
    {cc.Size} gridSize
    Returns:
    {cc.TiledGrid3DAction}
  • <static> {cc.TintBy} cc.tintBy(duration, deltaRed, deltaGreen, deltaBlue)
    Tints a cc.Node that implements the cc.NodeRGB protocol from current tint to a custom one. Relative to their own color change.
    Defined in: CCActionInterval.js.
    // example
    var action = cc.tintBy(2, -127, -255, -127);
    Parameters:
    {Number} duration
    duration in seconds
    {Number} deltaRed
    {Number} deltaGreen
    {Number} deltaBlue
    Returns:
    {cc.TintBy}
  • <static> {cc.TintTo} cc.tintTo(duration, red, green, blue)
    Tints a cc.Node that implements the cc.NodeRGB protocol from current tint to a custom one.
    Defined in: CCActionInterval.js.
    // example
    var action = cc.tintTo(2, 255, 0, 255);
    Parameters:
    {Number} duration
    {Number} red
    0-255
    {Number} green
    0-255
    {Number} blue
    0-255
    Returns:
    {cc.TintTo}
  • <static> {cc.ToggleVisibility} cc.toggleVisibility()
    Toggles the visibility of a node.
    Defined in: CCActionInstant.js.
    // example
    var toggleVisibilityAction = cc.toggleVisibility();
    Returns:
    {cc.ToggleVisibility}
  • <static> {cc.TurnOffTiles} cc.turnOffTiles(duration, gridSize, seed)
    Creates the action with a random seed, the grid size and the duration.
    Reference the test cases (Effects Test)
    Defined in: CCActionTiledGrid.js.
    // example
    // turnOffTiles without seed
    var toff = cc.turnOffTiles(this._duration, cc.size(x, y));
    
    // turnOffTiles with seed
    var toff = cc.turnOffTiles(this._duration, cc.size(x, y), 0);
    Parameters:
    {Number} duration
    {cc.Size} gridSize
    {Number|Null} seed Optional, Default: 0
    Returns:
    {cc.TurnOffTiles}
  • <static> {cc.Twirl} cc.twirl(duration, gridSize, position, twirls, amplitude)
    creates the action with center position, number of twirls, amplitude, a grid size and duration
    Defined in: CCActionGrid3D.js.
    Parameters:
    {Number} duration
    {cc.Size} gridSize
    {cc.Point} position
    {Number} twirls
    {Number} amplitude
    Returns:
    {cc.Twirl}
  • <static> cc.v2fzero()
    Code copied & pasted from SpacePatrol game https://github.com/slembcke/SpacePatrol Renamed and added some changes for cocos2d
    Defined in: CCDrawNode.js.
  • <static> {cc.Vertex2F} cc.vertex2(x, y)
    Helper macro that creates an Vertex2F type composed of 2 floats: x, y
    Defined in: CCTypes.js.
    Parameters:
    {Number} x
    {Number} y
    Returns:
    {cc.Vertex2F}
  • <static> {cc.Vertex3F} cc.vertex3(x, y, z)
    Helper macro that creates an Vertex3F type composed of 3 floats: x, y, z
    Defined in: CCTypes.js.
    Parameters:
    {Number} x
    {Number} y
    {Number} z
    Returns:
    {cc.Vertex3F}
  • <static> {Object} cc.vertexLineIntersect(Ax, Ay, Bx, By, Cx, Cy, Dx, Dy)
    returns whether or not the line intersects
    Defined in: CCVertex.js.
    Parameters:
    {Number} Ax
    {Number} Ay
    {Number} Bx
    {Number} By
    {Number} Cx
    {Number} Cy
    {Number} Dx
    {Number} Dy
    Returns:
    {Object}
  • <static> cc.vertexLineToPolygon(points, stroke, vertices, offset, nuPoints)
    converts a line to a polygon
    Defined in: CCVertex.js.
    Parameters:
    {Float32Array} points
    {Number} stroke
    {Float32Array} vertices
    {Number} offset
    {Number} nuPoints
  • <static> {Boolean} cc.vertexListIsClockwise(verts)
    returns wheter or not polygon defined by vertex list is clockwise
    Defined in: CCVertex.js.
    Parameters:
    {Array} verts
    Returns:
    {Boolean}
  • <static> {cc.Waves} cc.waves(duration, gridSize, waves, amplitude, horizontal, vertical)
    initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration
    Defined in: CCActionGrid3D.js.
    Parameters:
    {Number} duration
    {cc.Size} gridSize
    {Number} waves
    {Number} amplitude
    {Boolean} horizontal
    {Boolean} vertical
    Returns:
    {cc.Waves}
  • <static> cc.waves3D(duration, gridSize, waves, amplitude)
    Create a wave 3d action with duration, grid size, waves and amplitude.
    Defined in: CCActionGrid3D.js.
    Parameters:
    {Number} duration
    {cc.Size} gridSize
    {Number} waves
    {Number} amplitude
  • <static> {cc.WavesTiles3D} cc.wavesTiles3D(duration, gridSize, waves, amplitude)
    creates the action with a number of waves, the waves amplitude, the grid size and the duration.
    Reference the test cases (Effects Test)
    Defined in: CCActionTiledGrid.js.
    Parameters:
    {Number} duration
    {cc.Size} gridSize
    {Number} waves
    {Number} amplitude
    Returns:
    {cc.WavesTiles3D}