Namespace cc
- Defined in: CCBoot.js
Method Summary
Field Detail
Defined in: CCAction.js.
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.
Defined in: CCTexture2D.js.
Defined in: CCTexture2D.js.
Defined in: CCTexture2D.js.
Defined in: CCTexture2D.js.
Defined in: CCTexture2D.js.
Defined in: CCTexture2D.js.
Defined in: CCTexture2D.js.
Defined in: CCTexture2D.js.
Defined in: CCTexture2D.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCAudio.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
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.
Defined in: CCMacro.js.
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.
Defined in: CCControl.js.
Defined in: CCControl.js.
Defined in: CCControl.js.
Defined in: CCActionCatmullRom.js.
- Deprecated:
- since v3.0 please use cc.cloneControlPoints() instead.
Defined in: CCMacro.js.
Defined in: CCConfig.js.
Defined in: CCMenu.js.
Defined in: CCDirector.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
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.
To modify it, in Web engine please refer to CCConfig.js, in JSB please refer to CCConfig.h
Defined in: CCConfig.js.
Defined in: CCMacro.js.
Defined in: CCDirector.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCEditBox.js.
Defined in: CCEditBox.js.
Defined in: CCEditBox.js.
Defined in: CCEditBox.js.
Defined in: CCEditBox.js.
Defined in: CCEditBox.js.
Defined in: CCEditBox.js.
Defined in: CCEditBox.js.
Defined in: CCEditBox.js.
Defined in: CCEditBox.js.
Defined in: CCEditBox.js.
Defined in: CCEditBox.js.
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.
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.
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.
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.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCCommon.js.
Defined in: CCCommon.js.
Defined in: CCCommon.js.
Defined in: CCCommon.js.
Defined in: CCCommon.js.
Defined in: CCCommon.js.
Defined in: CCDirector.js.
Defined in: CCMacro.js.
Defined in: CCScheduler.js.
Defined in: CCScheduler.js.
Defined in: CCRenderTexture.js.
Defined in: CCRenderTexture.js.
Defined in: CCRenderTexture.js.
Defined in: CCMacro.js.
Defined in: CCConfig.js.
Defined in: CCMacro.js.
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);
Defined in: CCEditBox.js.
Defined in: CCEditBox.js.
Defined in: CCEditBox.js.
Defined in: CCEditBox.js.
Defined in: CCEditBox.js.
Defined in: CCLabelBMFont.js.
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.
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.
Defined in: CCMacro.js.
Defined in: CCScheduler.js.
Defined in: CCMenu.js.
Defined in: CCMenu.js.
Defined in: CCMenu.js.
Defined in: CCMacro.js.
Defined in: CCNode.js.
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.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
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.
Defined in: CCParticleBatchNode.js.
Defined in: CCMacro.js.
Defined in: CCDrawingPrimitivesCanvas.js.
Defined in: CCPointExtension.js.
Defined in: CCScheduler.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
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.
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.
Defined in: CCNode.js.
Defined in: CCTransition.js.
Defined in: CCTransitionProgress.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCShaders.js.
Defined in: CCShaders.js.
Defined in: CCShaders.js.
Defined in: CCShaders.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCShaders.js.
Defined in: CCShaders.js.
Defined in: CCShaders.js.
Defined in: CCShaders.js.
Defined in: CCShaders.js.
Defined in: CCShaders.js.
Defined in: CCMacro.js.
Defined in: CCShaders.js.
Defined in: CCShaders.js.
Defined in: CCShaders.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCShaders.js.
Defined in: CCShaders.js.
Defined in: CCShaders.js.
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.
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.
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.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCClippingNode.js.
Defined in: CCTableView.js.
Defined in: CCTableView.js.
Defined in: CCTableView.js.
Defined in: CCTableView.js.
Defined in: CCTypes.js.
Defined in: CCTypes.js.
Defined in: CCTypes.js.
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.
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.
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.
Defined in: CCTGAlib.js.
Defined in: CCTGAlib.js.
Defined in: CCTGAlib.js.
Defined in: CCTGAlib.js.
Defined in: CCTGAlib.js.
Defined in: CCTGAlib.js.
Defined in: CCTMXTiledMap.js.
Defined in: CCTMXTiledMap.js.
Defined in: CCTMXTiledMap.js.
Defined in: CCTMXXMLParser.js.
Defined in: CCTMXXMLParser.js.
Defined in: CCTMXXMLParser.js.
Defined in: CCTMXXMLParser.js.
Defined in: CCTMXXMLParser.js.
Defined in: CCTMXXMLParser.js.
Defined in: CCTMXXMLParser.js.
Defined in: CCTMXXMLParser.js.
Defined in: CCTMXXMLParser.js.
Defined in: CCTMXXMLParser.js.
Defined in: CCTMXXMLParser.js.
Defined in: CCTransition.js.
Defined in: CCTransition.js.
Defined in: CCTransition.js.
Defined in: CCTransition.js.
Defined in: CCInputManager.js.
Defined in: CCInputManager.js.
Defined in: CCInputManager.js.
Defined in: CCInputManager.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
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.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCTypes.js.
Defined in: CCTypes.js.
Defined in: CCTypes.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Method Detail
-
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.$}
-
Creates a new element, and adds cc.$ methods
Defined in: miniFramework.js.- Parameters:
- {String} x
- name of the element tag to create
- Returns:
- {cc.$}
-
Allocates and initializes the action.
Defined in: CCAction.js.// return {cc.Action} var action = cc.action();
- Returns:
- {cc.Action}
-
creates the action of ActionEase
Defined in: CCActionEase.js.// example var moveEase = cc.actionEase(action);
- Parameters:
- {cc.ActionInterval} action
- Returns:
- {cc.ActionEase}
-
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}
-
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}
-
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
-
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}
-
- Deprecated:
- since v3.0, please use cc.affineTransformMakeIdentity() instead
- Returns:
- {cc.AffineTransform}
- See:
- cc.affineTransformMakeIdentity
-
Get the invert transform of an AffineTransform object
Defined in: CCAffineTransform.js.- Parameters:
- {cc.AffineTransform} t
- Returns:
- {cc.AffineTransform} The inverted transform object
-
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}
-
- Returns:
- {cc.AffineTransform}
-
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}
-
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}
-
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}
-
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}
-
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}
-
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
-
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}
-
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}
-
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.- Returns:
- {cc.Point}
-
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}
-
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}
-
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}
-
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}
-
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.- 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}
-
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()
// 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}
-
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}
-
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}
-
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}
-
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}
-
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}
-
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}
-
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}
-
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}
-
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}
-
- Parameters:
- {Number} duration
- Returns:
- {cc.FlipX3D}
-
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}
-
- Parameters:
- {Number} duration
- Returns:
- {cc.FlipY3D}
-
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);
- 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
-
creates the action with size and duration
Defined in: CCActionGrid.js.- Parameters:
- {Number} duration
- {cc.Size} gridSize
- Returns:
- {cc.Grid3DAction}
-
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
-
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}
-
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. -
<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}
-
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}
-
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}
-
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}
-
creates a lens 3d action with center position, radius
Defined in: CCActionGrid3D.js.- 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
-
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}
-
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}
-
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
-
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}
-
Calculates sum of two points.
Defined in: CCPointExtension.js.- 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
-
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.- Returns:
- {Number} the angle in radians between two vector directions
-
<static> {Number} cc.pAngleSigned(a, b)
Defined in: CCPointExtension.js.- Returns:
- {Number} the signed angle in radians between two vector directions
-
Clamp a point between from and to.
Defined in: CCPointExtension.js.- Parameters:
- {Point} p
- {Number} min_inclusive
- {Number} max_inclusive
- Returns:
- {cc.Point}
-
Multiplies a nd b components, a.x*b.x, a.y*b.y
Defined in: CCPointExtension.js.- Returns:
- {cc.Point}
-
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.- Returns:
- {Number}
-
<static> {Number} cc.pDistance(v1, v2)Calculates the distance between two points
Defined in: CCPointExtension.js.- Returns:
- {Number}
-
<static> {Number} cc.pDistanceSQ(point1, point2)Calculates the square distance between two points (not calling sqrt() )
Defined in: CCPointExtension.js.- Returns:
- {Number}
-
<static> {Number} cc.pDot(v1, v2)Calculates dot product of two points.
Defined in: CCPointExtension.js.- Returns:
- {Number}
-
Converts radians to a normalized vector.
Defined in: CCPointExtension.js.- Parameters:
- {Number} a
- Returns:
- {cc.Point}
-
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.- 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. -
ccpIntersectPoint return the intersection point of line A-B, C-D
Defined in: CCPointExtension.js.- Returns:
- {cc.Point}
-
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}
-
Linear Interpolation between two points a and b alpha == 0 ? a alpha == 1 ? b otherwise a value between a..b
Defined in: CCPointExtension.js.- 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}
-
Calculates midpoint between two points.
Defined in: CCPointExtension.js.- Returns:
- {cc.pMult}
-
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
-
Returns opposite of point.
Defined in: CCPointExtension.js.- Parameters:
- {cc.Point} point
- Returns:
- {cc.Point}
-
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
-
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.- Returns:
- {Boolean}
-
Converts a Point in pixels to points
Defined in: CCMacro.js.- Parameters:
- {cc.Rect} pixels
- Returns:
- {cc.Point}
-
Converts a Point in points to pixels
Defined in: CCMacro.js.- Parameters:
- {cc.Point} points
- Returns:
- {cc.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}
-
Calculates the projection of v1 over v2.
Defined in: CCPointExtension.js.- Returns:
- {cc.pMult}
-
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}
-
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}
-
Rotates two points.
Defined in: CCPointExtension.js.- Returns:
- {cc.Point}
-
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
-
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.- 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.- Returns:
- {Boolean}
-
Calculates difference of two points.
Defined in: CCPointExtension.js.- Returns:
- {cc.Point}
-
<static> cc.pSubIn(v1, v2)subtracts one point from another (inplace)
Defined in: CCPointExtension.js. -
<static> {Number} cc.pToAngle(v)Converts a vector to radians.
Defined in: CCPointExtension.js.- Parameters:
- {cc.Point} v
- Returns:
- {Number}
-
Unrotates two points.
Defined in: CCPointExtension.js.- 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}
-
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}
-
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.- Returns:
- {Boolean}
-
<static> {Boolean} cc.rectContainsRect(rect1, rect2)Check whether the rect1 contains rect2
Defined in: CCGeometry.js.- Returns:
- {Boolean}
-
<static> {Boolean} cc.rectEqualToRect(rect1, rect2)Check whether a rect's value equals to another
Defined in: CCGeometry.js.- 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
-
Returns the overlapping portion of 2 rectangles
Defined in: CCGeometry.js.- Returns:
- {cc.Rect}
-
<static> {Boolean} cc.rectIntersectsRect(rectA, rectB)Check whether a rect intersect with another
Defined in: CCGeometry.js.- Returns:
- {Boolean}
-
<static> {Boolean} cc.rectOverlapsRect(rectA, rectB)Check whether a rect overlaps another
Defined in: CCGeometry.js.- Returns:
- {Boolean}
-
Converts a rect in pixels to points
Defined in: CCMacro.js.- Parameters:
- {cc.Rect} pixel
- Returns:
- {cc.Rect}
-
Converts a rect in points to pixels
Defined in: CCMacro.js.- Parameters:
- {cc.Rect} point
- Returns:
- {cc.Rect}
-
Returns the smallest rectangle that contains the two source rectangles.
Defined in: CCGeometry.js.- Returns:
- {cc.Rect}
-
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}
-
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}
-
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}
-
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
-
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}
-
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}
-
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}
-
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}
-
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}
-
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}
-
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. -
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}
-
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}
-
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}
-
Show the Node.
Defined in: CCActionInstant.js.// example var showAction = cc.show();
- Returns:
- {cc.Show}
-
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}
-
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}
-
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.- Returns:
- {Boolean}
-
Converts a size in pixels to points
Defined in: CCMacro.js.- Parameters:
- {cc.Size} sizeInPixels
- Returns:
- {cc.Size}
-
Converts a Size in points to pixels
Defined in: CCMacro.js.- Parameters:
- {cc.Size} sizeInPoints
- Returns:
- {cc.Size}
-
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}
-
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}
-
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}
-
creates the speed action.
Defined in: CCAction.js.- Parameters:
- {cc.ActionInterval} action
- {Number} speed
- Returns:
- {cc.Speed}
-
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}
-
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}
-
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
-
Create an action with the specified action and forced target
Defined in: CCActionInterval.js.- Parameters:
- {cc.Node} target
- {cc.FiniteTimeAction} action
- Returns:
- {cc.TargetedAction}
-
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
-
Creates the action with duration and grid size
Defined in: CCActionGrid.js.- Parameters:
- {Number} duration
- {cc.Size} gridSize
- Returns:
- {cc.TiledGrid3DAction}
-
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}
-
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}
-
Toggles the visibility of a node.
Defined in: CCActionInstant.js.// example var toggleVisibilityAction = cc.toggleVisibility();
- Returns:
- {cc.ToggleVisibility}
-
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}
-
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. -
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}
-
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}
-
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
-
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}