Class cc.ParallaxNode

Class Summary
Constructor Attributes Constructor Name and Description
 

cc.ParallaxNode: A node that simulates a parallax scroller
The children will be moved faster / slower than the parent according the the parallax ratio.

Method Summary

Class Detail

cc.ParallaxNode()

cc.ParallaxNode: A node that simulates a parallax scroller
The children will be moved faster / slower than the parent according the the parallax ratio.

Field Detail

{Array} parallaxArray
- Parallax nodes array

Method Detail

  • addChild(child, z, ratio, offset)
    Adds a child to the container with a z-order, a parallax ratio and a position offset It returns self, so you can chain several addChilds.
    //example
    voidNode.addChild(background, -1, cc.p(0.4, 0.5), cc.p(0,0));
    Parameters:
    {cc.Node} child
    {Number} z
    {cc.Point} ratio
    {cc.Point} offset
  • <static> {cc.ParallaxNode} cc.ParallaxNode.create()
    Create new parallax node.
    //example
    var voidNode = new cc.ParallaxNode();
    Deprecated:
    since v3.0 please use new cc.ParallaxNode() instead.
    Returns:
    {cc.ParallaxNode}
  • ctor()
    Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
  • {Array} getParallaxArray()
    Gets the parallax array.
    Returns:
    {Array}
  • removeAllChildren(cleanup)
    Remove all children with cleanup
    Parameters:
    {Boolean} cleanup
  • removeChild(child, cleanup)
    Remove Child
    //example
    voidNode.removeChild(background,true);
    Parameters:
    {cc.Node} child
    {Boolean} cleanup
  • setParallaxArray(value)
    Set parallax array.
    Parameters:
    {Array} value