Namespace cc
- Defined in: CCClass.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.
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.
Defined in: CCConfig.js.
Defined in: CCControl.js.
Defined in: CCControl.js.
Defined in: CCControl.js.
Defined in: CCMacro.js.
Defined in: CCConfig.js.
Defined in: CCMenu.js.
Defined in: CCSpriteBatchNode.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
Defined in: CCConfig.js.
Defined in: CCConfig.js.
Defined in: CCMacro.js.
Defined in: CCDirector.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Defined in: CCActionEase.js.
Defined in: CCActionEase.js.
Defined in: CCActionEase.js.
Defined in: CCActionEase.js.
Defined in: CCActionEase.js.
Defined in: CCActionEase.js.
Defined in: CCActionEase.js.
Defined in: CCActionEase.js.
Defined in: CCActionEase.js.
Defined in: CCActionEase.js.
Defined in: CCActionEase.js.
Defined in: CCActionEase.js.
Defined in: CCActionEase.js.
Defined in: CCActionEase.js.
Defined in: CCActionEase.js.
Defined in: CCActionEase.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.
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.
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: CCGrabber.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.
//Example //to mark a keydown cc.keyDown[65] = true; //or cc.keyMap[cc.KEY.a] //to mark a keyup do cc.keyDown[65] = false; //to find out if a key is down, check if(cc.keyDown[65]) //or if,(cc.keyDown[cc.KEY.space]) //if its undefined or false or null, its not pressed
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: aabb.js.
Defined in: CCMenu.js.
Defined in: CCMenu.js.
Defined in: CCMenu.js.
Defined in: aabb.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
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.
Defined in: CCConfig.js.
Defined in: CCParticleBatchNode.js.
Defined in: CCMacro.js.
Defined in: CCPNGReader.js.
Defined in: CCPointExtension.js.
Defined in: CCScheduler.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.
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.
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.
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)
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.
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: 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: CCVisibleRect.js.
Defined in: CCMacro.js.
Defined in: CCMacro.js.
Method Detail
-
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.Acceleration(x, y, z, timestamp)the device accelerometer reports values for each axis in units of g-force
Defined in: CCTypes.js.- Parameters:
- x
- y
- z
- timestamp
-
Allocates and initializes the action
Defined in: CCAction.js.// example 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}
-
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}
-
<static> cc.AffineTransform(a, b, c, d, tx, ty)
Defined in: CCAffineTransform.js.- Parameters:
- {Number} a
- {Number} b
- {Number} c
- {Number} d
- {Number} tx
- {Number} ty
-
- Parameters:
- {cc.AffineTransform} t1
- {cc.AffineTransform} t2
- Returns:
- {cc.AffineTransform} Constructor
-
<static> {Boolean} cc.affineTransformEqualToTransform(t1, t2)Return true if `t1' and `t2' are equal, false otherwise.
Defined in: CCAffineTransform.js.- Parameters:
- {cc.AffineTransform} t1
- {cc.AffineTransform} t2
- Returns:
- {Boolean} Constructor
-
Defined in: CCAffineTransform.js.- Returns:
- {cc.AffineTransform} Constructor
-
Get the invert value of an AffineTransform object
Defined in: CCAffineTransform.js.- Parameters:
- {cc.AffineTransform} t
- Returns:
- {cc.AffineTransform} Constructor
-
Defined in: CCAffineTransform.js.- Parameters:
- {Number} a
- {Number} b
- {Number} c
- {Number} d
- {Number} tx
- {Number} ty
- Returns:
- {cc.AffineTransform} Constructor
-
Defined in: CCAffineTransform.js.- Returns:
- {cc.AffineTransform} Constructor
-
Defined in: CCAffineTransform.js.- Parameters:
- {cc.AffineTransform} aTransform
- {Number} anAngle
- Returns:
- {cc.AffineTransform} Constructor
-
Defined in: CCAffineTransform.js.- Parameters:
- {cc.AffineTransform} t
- {Number} sx
- {Number} sy
- Returns:
- {cc.AffineTransform} Constructor
-
Defined in: CCAffineTransform.js.- Parameters:
- {cc.AffineTransform} t
- {Number} tx
- {Number} ty
- Returns:
- {cc.AffineTransform} Constructor
-
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: CCScheduler.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: CCScheduler.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: CCScheduler.js.- Parameters:
- {Array} arr
- Source Array
- {*} delObj
- remove object
-
<static> {Boolean} cc.arrayVerifyType(arr, type)Verify Array's Type
Defined in: CCScheduler.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> {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}
-
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}
-
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: 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> {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)copy an new object
- Parameters:
- {object|Array} obj
- source object
- Returns:
- {Array|object}
-
<static> cc.Color(r, g, b, a)************************************************************************* 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: CCTypes.js.- Parameters:
- r
- g
- b
- a
-
<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> cc.contentScaleFactor()
On Mac it returns 1;
On iPhone it returns 2 if RetinaDisplay is On. Otherwise it returns 1
Defined in: CCMacro.js. -
<static> {Array} cc.copyArray(arr)copy an array's item to a new array (its performance is better than Array.slice)
Defined in: CCEventManager.js.- Parameters:
- {Array} arr
- Returns:
- {Array}
-
<static> cc.defineGetterSetter(proto, prop, getter, setter, getterName, setterName)Common getter setter configuration function
- 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}
-
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> {Object} cc.easeBackIn()creates the action easing object
Defined in: CCActionEase.js.// example action.easing(cc.easeBackIn());
- Returns:
- {Object}
-
<static> {Object} cc.easeBackInOut()creates the action easing object
Defined in: CCActionEase.js.// example action.easing(cc.easeBackInOut());
- Returns:
- {Object}
-
<static> {Object} cc.easeBackOut()creates the action easing object
Defined in: CCActionEase.js.// example action.easing(cc.easeBackOut());
- Returns:
- {Object}
-
<static> {Object} cc.easeBezierAction(p0, p1, p2, p3)creates the action easing object
Defined in: CCActionEase.js.- 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
Defined in: CCActionEase.js.// example action.easing(cc.easeBounceIn());
- Returns:
- {Object}
-
<static> {Object} cc.easeBounceInOut()Creates the action easing object
Defined in: CCActionEase.js.// example action.easing(cc.easeBounceInOut());
- Returns:
- {Object}
-
<static> {Object} cc.easeBounceOut()Creates the action easing object
Defined in: CCActionEase.js.// example action.easing(cc.easeBounceOut());
- Returns:
- {Object}
-
<static> {Object} cc.easeCircleActionIn()creates the action easing object
Defined in: CCActionEase.js.- Returns:
- {Object}
-
<static> {Object} cc.easeCircleActionInOut()creates the action easing object
Defined in: CCActionEase.js.- Returns:
- {Object}
-
<static> {Object} cc.easeCircleActionOut()creates the action easing object
Defined in: CCActionEase.js.- Returns:
- {Object}
-
<static> {Object} cc.easeCubicActionIn()creates the action easing object
Defined in: CCActionEase.js.- Returns:
- {Object}
-
<static> {Object} cc.easeCubicActionInOut()creates the action easing object
Defined in: CCActionEase.js.- Returns:
- {Object}
-
<static> {Object} cc.easeCubicActionOut()creates the action easing object
Defined in: CCActionEase.js.- Returns:
- {Object}
-
<static> {Object} cc.easeElasticIn(period)Creates the action easing obejct with the period in radians (default is 0.3)
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)
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)
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
Defined in: CCActionEase.js.// example action.easing(cc.easeExponentialIn());
- Returns:
- {Object}
-
<static> {Object} cc.easeExponentialInOut()creates an EaseExponentialInOut action easing object
Defined in: CCActionEase.js.// example action.easing(cc.easeExponentialInOut());
- Returns:
- {Object}
-
creates the action easing object
Defined in: CCActionEase.js.// example action.easing(cc.easeExponentialOut());
- Returns:
- {cc.EaseExponentialOut}
-
<static> {Object} cc.easeIn(rate)Creates the action easing object with the rate parameter
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
Defined in: CCActionEase.js.// example 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
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
Defined in: CCActionEase.js.- Returns:
- {Object}
-
<static> {Object} cc.easeQuadraticActionInOut()creates the action easing object
Defined in: CCActionEase.js.- Returns:
- {Object}
-
<static> {Object} cc.easeQuadraticActionOut()creates the action easing object
Defined in: CCActionEase.js.- Returns:
- {Object}
-
<static> {Object} cc.easeQuarticActionIn()creates the action easing object
Defined in: CCActionEase.js.- Returns:
- {Object}
-
<static> {Object} cc.easeQuarticActionInOut()creates the action easing object
Defined in: CCActionEase.js.- Returns:
- {Object}
-
<static> {Object} cc.easeQuarticActionOut()creates the action easing object
Defined in: CCActionEase.js.- Returns:
- {Object}
-
<static> {Object} cc.easeQuinticActionIn()creates the action easing object
Defined in: CCActionEase.js.- Returns:
- {Object}
-
<static> {Object} cc.easeQuinticActionInOut()creates the action easing object
Defined in: CCActionEase.js.- Returns:
- {Object}
-
<static> {Object} cc.easeQuinticActionOut()creates the action easing object
Defined in: CCActionEase.js.- 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
Defined in: CCActionEase.js.// example action.easing(cc.easeSineIn());
- Returns:
- {Object}
-
creates the action easing object
Defined in: CCActionEase.js.// example action.easing(cc.easeSineInOut());
- Returns:
- {cc.EaseSineInOut}
-
<static> {Object} cc.easeSineOut()creates an EaseSineOut action easing object
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. -
Defined in: CCActionInterval.js.//example var action = cc.fadeIn(1.0);
- Parameters:
- {Number} duration
- duration in seconds
- Returns:
- {cc.FadeIn}
-
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
Defined in: CCActionTiledGrid.js.- Parameters:
- duration
- gridSize
- Returns:
- {cc.FadeOutBLTiles}
-
creates the action with the grid size and the duration
Defined in: CCActionTiledGrid.js.- Parameters:
- {Number} duration
- {cc.Size} gridSize
- Returns:
- {cc.FadeOutDownTiles}
-
creates the action with the grid size and the duration
Defined in: CCActionTiledGrid.js.- Parameters:
- duration
- gridSize
- Returns:
- {cc.FadeOutTRTiles}
-
creates the action with the grid size and the duration
Defined in: CCActionTiledGrid.js.- Parameters:
- {Number} duration
- {cc.Size} gridSize
- Returns:
- {cc.FadeOutUpTiles}
-
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}
-
Create a Flip X 3D action with duration
Defined in: CCActionGrid3D.js.- 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}
-
Create a flip Y 3d action with duration
Defined in: CCActionGrid3D.js.- 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 = cc.Sprite.create("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 = cc.Sprite.create("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> {Array} cc.generateTextureCacheForColor(texture)generate texture's cache for texture tint
Defined in: CCSprite.js.- Parameters:
- {HTMLImageElement} texture
- Returns:
- {Array}
-
<static> {HTMLCanvasElement} cc.generateTintImage(texture, tintedImgCache, color, rect, renderCanvas)generate tinted texture with lighter. lighter: The source and destination colors are added to each other, resulting in brighter colors, moving towards color values of 1 (maximum brightness for that color).
Defined in: CCSprite.js.- Parameters:
- {HTMLImageElement} texture
- {Array} tintedImgCache
- {cc.Color} color
- {cc.Rect} rect
- {HTMLCanvasElement} renderCanvas Optional
- Returns:
- {HTMLCanvasElement}
-
<static> {HTMLCanvasElement} cc.generateTintImageWithMultiply(image, color, rect, renderCanvas)Tint a texture using the "multiply" operation
Defined in: CCSprite.js.- Parameters:
- {HTMLImageElement} image
- {cc.Color} color
- {cc.Rect} rect Optional
- {HTMLCanvasElement} renderCanvas
- Returns:
- {HTMLCanvasElement}
-
<static> {Array} cc.getControlPointAt(controlPoints, pos)returns a point from the array
Defined in: CCActionCatmullRom.js.- Parameters:
- {Array} controlPoints
- {Number} pos
- Returns:
- {Array}
-
<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:
- 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.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}
-
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> {Boolean} cc.isspace_unicode(ch)
Defined in: CCLabelBMFont.js.- Parameters:
- {String} ch
- Returns:
- {Boolean} weather the character is a whitespace character.
-
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
Defined in: CCActionTiledGrid.js.- Parameters:
- {Number} duration
- {cc.Size} gridSize
- {Number} numberOfJumps
- {Number} amplitude
- Returns:
- {cc.JumpTiles3D}
-
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.kmAABB(min, max)A struture that represents an axis-aligned bounding box.
Defined in: aabb.js.- Parameters:
- min
- max
-
<static> cc.kmAABBAssign(pOut, pIn)Assigns pIn to pOut, returns pOut.
Defined in: aabb.js.- Parameters:
- pOut
- pIn
-
<static> cc.kmAABBContainsPoint(pPoint, pBox)Returns KM_TRUE if point is in the specified AABB, returns KM_FALSE otherwise.
Defined in: aabb.js.- Parameters:
- pPoint
- pBox
-
<static> cc.kmAABBScale(pOut, pIn, s)Scales pIn by s, stores the resulting AABB in pOut. Returns pOut
Defined in: aabb.js.- Parameters:
- pOut
- pIn
- s
-
<static> cc.kmMat4()
-
<static> cc.kmMat4AreEqual(pMat1, pMat2)Returns KM_TRUE if the 2 matrices are equal (approximately)
Defined in: mat4.js.- Parameters:
- pMat1
- pMat2
-
<static> cc.kmMat4Assign(pOut, pIn)Assigns the value of pIn to pOut
Defined in: mat4.js.- Parameters:
- pOut
- pIn
-
<static> cc.kmMat4ExtractRotation(pOut, pIn)Extract a 3x3 rotation matrix from the input 4x4 transformation. Stores the result in pOut, returns pOut
Defined in: mat4.js.- Parameters:
- pOut
- pIn
-
<static> cc.kmMat4Fill(pOut, pMat)Fills a kmMat4 structure with the values from a 16 element array of floats
Defined in: mat4.js.- Parameters:
- pOut
- pMat
-
<static> cc.kmMat4GetForwardVec3(pOut, pIn)Extract the forward vector from a 4x4 matrix. The result is stored in pOut. Returns pOut.
Defined in: mat4.js.- Parameters:
- pOut
- pIn
-
<static> cc.kmMat4GetRightVec3(pOut, pIn)Extract the right vector from a 4x4 matrix. The result is stored in pOut. Returns pOut.
Defined in: mat4.js.- Parameters:
- pOut
- pIn
-
<static> cc.kmMat4GetUpVec3(pOut, pIn)Get the up vector from a matrix. pIn is the matrix you wish to extract the vector from. pOut is a pointer to the kmVec3 structure that should hold the resulting vector
Defined in: mat4.js.- Parameters:
- pOut
- pIn
-
<static> cc.kmMat4Identity(pOut)Sets pOut to an identity matrix returns pOut
Defined in: mat4.js.- Parameters:
- pOut
-
<static> cc.kmMat4Inverse(pOut, pM)Calculates the inverse of pM and stores the result in pOut.
Defined in: mat4.js.- Parameters:
- pOut
- pM
-
<static> cc.kmMat4IsIdentity(pIn)Returns KM_TRUE if pIn is an identity matrix KM_FALSE otherwise
Defined in: mat4.js.- Parameters:
- pIn
-
<static> cc.kmMat4LookAt(pOut, pEye, pCenter, pUp)Builds a translation matrix in the same way as gluLookAt() the resulting matrix is stored in pOut. pOut is returned.
Defined in: mat4.js.- Parameters:
- pOut
- pEye
- pCenter
- pUp
-
<static> cc.kmMat4Multiply(pOut, pM1, pM2)Multiplies pM1 with pM2, stores the result in pOut, returns pOut
Defined in: mat4.js.- Parameters:
- pOut
- pM1
- pM2
-
<static> cc.kmMat4OrthographicProjection(pOut, left, right, bottom, top, nearVal, farVal)Creates an orthographic projection matrix like glOrtho
Defined in: mat4.js.- Parameters:
- pOut
- left
- right
- bottom
- top
- nearVal
- farVal
-
<static> cc.kmMat4PerspectiveProjection(pOut, fovY, aspect, zNear, zFar)Creates a perspective projection matrix in the same way as gluPerspective
Defined in: mat4.js.- Parameters:
- pOut
- fovY
- aspect
- zNear
- zFar
-
<static> cc.kmMat4RotationAxisAngle(pOut, axis, radians)Build a rotation matrix from an axis and an angle. Result is stored in pOut. pOut is returned.
Defined in: mat4.js.- Parameters:
- pOut
- axis
- radians
-
<static> cc.kmMat4RotationPitchYawRoll(pOut, pitch, yaw, roll)Builds a rotation matrix from pitch, yaw and roll. The resulting matrix is stored in pOut and pOut is returned
Defined in: mat4.js.- Parameters:
- pOut
- pitch
- yaw
- roll
-
<static> cc.kmMat4RotationQuaternion(pOut, pQ)Converts a quaternion to a rotation matrix, the result is stored in pOut, returns pOut
Defined in: mat4.js.- Parameters:
- pOut
- pQ
-
<static> cc.kmMat4RotationToAxisAngle(pAxis, radians, pIn)Take the rotation from a 4x4 transformation matrix, and return it as an axis and an angle (in radians) returns the output axis.
Defined in: mat4.js.- Parameters:
- pAxis
- radians
- pIn
-
<static> cc.kmMat4RotationTranslation(pOut, rotation, translation)Build a 4x4 OpenGL transformation matrix using a 3x3 rotation matrix, and a 3d vector representing a translation. Assign the result to pOut, pOut is also returned.
Defined in: mat4.js.- Parameters:
- pOut
- rotation
- translation
-
<static> cc.kmMat4RotationX(pOut, radians)Builds an X-axis rotation matrix and stores it in pOut, returns pOut
Defined in: mat4.js.- Parameters:
- pOut
- radians
-
<static> cc.kmMat4RotationY(pOut, radians)Builds a rotation matrix using the rotation around the Y-axis The result is stored in pOut, pOut is returned.
Defined in: mat4.js.- Parameters:
- pOut
- radians
-
<static> cc.kmMat4RotationZ(pOut, radians)Builds a rotation matrix around the Z-axis. The resulting matrix is stored in pOut. pOut is returned.
Defined in: mat4.js.- Parameters:
- pOut
- radians
-
<static> cc.kmMat4Scaling(pOut, x, y, z)Builds a scaling matrix
Defined in: mat4.js.- Parameters:
- pOut
- x
- y
- z
-
<static> cc.kmMat4Translation(pOut, x, y, z)Builds a translation matrix. All other elements in the matrix will be set to zero except for the diagonal which is set to 1.0
Defined in: mat4.js.- Parameters:
- pOut
- x
- y
- z
-
<static> cc.kmMat4Transpose(pOut, pIn)Sets pOut to the transpose of pIn, returns pOut
Defined in: mat4.js.- Parameters:
- pOut
- pIn
-
<static> cc.kmPlaneClassifyPoint(pIn, pP)Returns POINT_INFRONT_OF_PLANE if pP is infront of pIn. Returns POINT_BEHIND_PLANE if it is behind. Returns POINT_ON_PLANE otherwise
Defined in: plane.js.- Parameters:
- pIn
- pP
-
<static> cc.kmPlaneFromPoints(pOut, p1, p2, p3)Creates a plane from 3 points. The result is stored in pOut. pOut is returned.
Defined in: plane.js.- Parameters:
- pOut
- p1
- p2
- p3
-
<static> cc.kmQuaternionRotationBetweenVec3(pOut, vec1, vec2, fallback)Adapted from the OGRE engine! Gets the shortest arc quaternion to rotate this vector to the destination vector.
Defined in: quaternion.js.- Parameters:
- pOut
- vec1
- vec2
- fallback
-
<static> cc.kmSQR(s)Returns the square of s (e.g. s*s)
Defined in: utility.js.- Parameters:
- {Number} s
-
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
-
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}
-
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}
-
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
-
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:
- v1
- 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.- Parameters:
- v1
- v2
-
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
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} 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);
-
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:
- point
- 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:
- v
-
<static> cc.Point(x, y)************************************************************************* 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: CCGeometry.js.- Parameters:
- x
- y
-
Defined in: CCAffineTransform.js.- Parameters:
- {cc.Point} point
- {cc.AffineTransform} t
- Returns:
- {cc.Point} Constructor
-
<static> {Boolean} cc.pointEqualToPoint(point1, point2)
Defined in: CCGeometry.js.- Returns:
- {Boolean}
-
<static> cc.pointPixelsToPoints(pixels)Converts a Point in pixels to points
Defined in: CCMacro.js.- Parameters:
- {Point} pixels
-
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.- Parameters:
- v1
- v2
-
<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:
- v
-
<static> {Number} cc.radiansToDegrees(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.rectApplyAffineTransform(rect, anAffineTransform)
Defined in: CCAffineTransform.js.- Parameters:
- {cc.Rect} rect
- {cc.AffineTransform} anAffineTransform
- Returns:
- {cc.Rect} Constructor
-
<static> {Boolean} cc.rectContainsPoint(rect, point)
Defined in: CCGeometry.js.- Parameters:
- {cc.Rect} rect
- {cc.Point} point
- Returns:
- {Boolean}
-
<static> {Boolean} cc.rectContainsRect(rect1, rect2)return whether the rect1 contains rect2
Defined in: CCGeometry.js.- Parameters:
- {cc.Rect} rect1
- {cc.Rect} rect2
- Returns:
- {Boolean}
-
<static> {Boolean} cc.rectEqualToRect(rect1, rect2)whether the rect1 equals the rect2
Defined in: CCGeometry.js.- Parameters:
- {cc.Rect} rect1
- {cc.Rect} rect2
- Returns:
- {Boolean}
-
<static> {Number} cc.rectGetMaxX(rect)return the rightmost x-value of 'rect'
Defined in: CCGeometry.js.- Parameters:
- {cc.Rect} rect
- Returns:
- {Number}
-
<static> {Number} cc.rectGetMaxY(rect)Return the topmost y-value of `rect'
Defined in: CCGeometry.js.- Parameters:
- {cc.Rect} rect
- Returns:
- {Number}
-
<static> {Number} cc.rectGetMidX(rect)return the midpoint x-value of 'rect'
Defined in: CCGeometry.js.- Parameters:
- {cc.Rect} rect
- Returns:
- {Number}
-
<static> {Number} cc.rectGetMidY(rect)Return the midpoint y-value of `rect'
Defined in: CCGeometry.js.- Parameters:
- {cc.Rect} rect
- Returns:
- {Number}
-
<static> {Number} cc.rectGetMinX(rect)return the leftmost x-value of 'rect'
Defined in: CCGeometry.js.- Parameters:
- {cc.Rect} rect
- Returns:
- {Number}
-
<static> {Number} cc.rectGetMinY(rect)Return the bottommost y-value of `rect'
Defined in: CCGeometry.js.- Parameters:
- {cc.Rect} rect
- Returns:
- {Number}
-
<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)
Defined in: CCGeometry.js.- Parameters:
- {cc.Rect} rectA
- {cc.Rect} rectB
- Returns:
- {Boolean}
-
<static> {Boolean} cc.rectOverlapsRect(rectA, rectB)
Defined in: CCGeometry.js.- Parameters:
- {cc.Rect} rectA
- {cc.Rect} rectB
- Returns:
- {Boolean}
-
<static> cc.rectPixelsToPoints(pixel)Converts a rect in pixels to points
Defined in: CCMacro.js.- Parameters:
- {cc.Rect} pixel
-
<static> cc.rectPointsToPixels(point)Converts a rect in points to pixels
Defined in: CCMacro.js.- Parameters:
- {cc.Rect} point
-
<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}
-
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
-
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}
-
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
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}
-
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}
-
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);
- Parameters:
- {Array|cc.FiniteTimeAction} tempArray
- Returns:
- {cc.Sequence}
-
<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
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
Defined in: CCActionTiledGrid.js.- Parameters:
- {Number} duration
- {cc.Size} gridSize
- {Number} range
- {Boolean} shatterZ
- Returns:
- {cc.ShatteredTiles3D}
-
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
Defined in: CCActionTiledGrid.js.- Parameters:
- {Number} duration
- {cc.Size} gridSize
- {Number} seed
- Returns:
- {cc.ShuffleTiles}
-
<static> {cc.Size} cc.sizeApplyAffineTransform(size, t)
Defined in: CCAffineTransform.js.- Parameters:
- {cc.Size} size
- {cc.AffineTransform} t
- Returns:
- {cc.Size} Constructor
-
<static> {Boolean} cc.sizeEqualToSize(size1, size2)
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}
-
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}
-
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));
- 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
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
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:
- x
- y
- ref
-
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.tgaDestroy(psInfo)releases the memory used for the image
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> 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}
-
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}
-
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}
-
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
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.utf8_trim_from(str, index)Trims str st str=[0, index) after the operation. Return value: the trimmed string.
Defined in: CCLabelBMFont.js.- Parameters:
- {Array} str
- he string to trim
- {Number} index
- the index to start trimming from.
-
<static> cc.utf8_trim_ws(str)
Defined in: CCLabelBMFont.js.- Parameters:
- {Array} str
-
<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> {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
Defined in: CCActionTiledGrid.js.- Parameters:
- {Number} duration
- {cc.Size} gridSize
- {Number} waves
- {Number} amplitude
- Returns:
- {cc.WavesTiles3D}