Class cc.ClippingNode

Class Summary
Constructor Attributes Constructor Name and Description
 
cc.ClippingNode(stencil)

cc.ClippingNode is a subclass of cc.Node.

Method Summary

Class Detail

cc.ClippingNode(stencil)

cc.ClippingNode is a subclass of cc.Node.
It draws its content (children) clipped using a stencil.
The stencil is an other cc.Node that will not be drawn.
The clipping is done using the alpha part of the stencil (adjusted with an alphaThreshold).

Parameters:
{cc.Node} stencil Optional, Default: null

Field Detail

{Number} alphaThreshold
- Threshold for alpha value.
{Boolean} inverted
- Indicate whether in inverted mode.
{cc.Node} stencil
- he cc.Node to use as a stencil to do the clipping.

Method Detail

  • <static> {cc.ClippingNode} cc.ClippingNode.create(stencil)
    Creates and initializes a clipping node with an other node as its stencil.
    The stencil node will be retained.
    //example
    new cc.ClippingNode(stencil);
    Parameters:
    {cc.Node} stencil Optional, Default: null
    Deprecated:
    since v3.0, please use "new cc.ClippingNode(stencil)" instead
    Returns:
    {cc.ClippingNode}
  • ctor(stencil)
    Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
    Parameters:
    {cc.Node} stencil Optional, Default: null
  • {Number} getAlphaThreshold()

    The alpha threshold.
    The content is drawn only where the stencil have pixel with alpha greater than the alphaThreshold.
    Should be a float between 0 and 1.
    This default to 1 (so alpha test is disabled).

    Returns:
    {Number}
  • {cc.Node} getStencil()
    The cc.Node to use as a stencil to do the clipping.
    The stencil node will be retained. This default to nil.
    Returns:
    {cc.Node}
  • init(stencil)
    Initialization of the node, please do not call this function by yourself, you should pass the parameters to constructor to initialize it
.
    Parameters:
    {cc.Node} stencil Optional, Default: null
  • {Boolean} isInverted()

    Inverted. If this is set to YES,
    the stencil is inverted, so the content is drawn where the stencil is NOT drawn.
    This default to NO.

    Returns:
    {Boolean}
  • onEnter()

    Event callback that is invoked every time when node enters the 'stage'.
    If the CCNode enters the 'stage' with a transition, this event is called when the transition starts.
    During onEnter you can't access a "sister/brother" node.
    If you override onEnter, you must call its parent's onEnter function with this._super().

  • onEnterTransitionDidFinish()

    Event callback that is invoked when the node enters in the 'stage'.
    If the node enters the 'stage' with a transition, this event is called when the transition finishes.
    If you override onEnterTransitionDidFinish, you shall call its parent's onEnterTransitionDidFinish with this._super()

  • onExit()

    callback that is called every time the node leaves the 'stage'.
    If the node leaves the 'stage' with a transition, this callback is called when the transition finishes.
    During onExit you can't access a sibling node.
    If you override onExit, you shall call its parent's onExit with this._super().

  • onExitTransitionDidStart()

    callback that is called every time the node leaves the 'stage'.
    If the node leaves the 'stage' with a transition, this callback is called when the transition starts.
    If you override onExitTransitionDidStart, you shall call its parent's onExitTransitionDidStart with this._super()

  • setAlphaThreshold(alphaThreshold)
    set alpha threshold.
    Parameters:
    {Number} alphaThreshold
  • setInverted(inverted)
    set whether or not invert of stencil
    Parameters:
    {Boolean} inverted
  • setStencil(stencil)
    Set stencil.
    Parameters:
    {cc.Node} stencil