Class cc.ClippingNode

Class Summary
Constructor Attributes Constructor Name and Description
 

cc.ClippingNode is a subclass of cc.Node.

Method Summary

Class Detail

cc.ClippingNode()

cc.ClippingNode is a subclass of cc.Node.
It draws its content (childs) 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).

Field Detail

init
Initializes a clipping node with an other node as its stencil.
The stencil node will be retained, and its parent will be set to this clipping node.
setStencil

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.
    Parameters:
    {cc.Node} stencil Optional, Default: null
    Returns:
    {cc.ClippingNode}
  • {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}
  • {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}
  • setAlphaThreshold(alphaThreshold)
    set alpha threshold.
    Parameters:
    {Number} alphaThreshold
  • setInverted(inverted)
    set whether or not invert of stencil
    Parameters:
    {Boolean} inverted