Class cc.DrawNode

Class Summary
Constructor Attributes Constructor Name and Description
 

CCDrawNode
Node that draws dots, segments and polygons.

Method Summary

Class Detail

cc.DrawNode()

CCDrawNode
Node that draws dots, segments and polygons.
Faster than the "drawing primitives" since they it draws everything in one single batch.

Method Detail

  • clear()
    Clear the geometry in the node's buffer.
  • <static> {cc.DrawNode} cc.DrawNode.create()
    Creates a DrawNode
    Deprecated:
    since v3.0 please use new cc.DrawNode() instead.
    Returns:
    {cc.DrawNode}
  • ctor()

    The cc.DrawNodeCanvas's constructor.
    This function will automatically be invoked when you create a node using new construction: "var node = new cc.DrawNodeCanvas()".
    Override it to extend its behavior, remember to call "this._super()" in the extended "ctor" function.

  • drawCardinalSpline(config, tension, segments, lineWidth, color)
    draw a cardinal spline path
    Parameters:
    {Array} config
    {Number} tension
    {Number} segments
    {Number} lineWidth
    {cc.Color} color
  • drawCatmullRom(points, segments, lineWidth, color)
    draw a CatmullRom curve
    Parameters:
    {Array} points
    {Number} segments
    {Number} lineWidth
    {cc.Color} color
  • drawCircle(center, radius, angle, segments, drawLineToCenter, lineWidth, color)
    draws a circle given the center, radius and number of segments.
    Parameters:
    {cc.Point} center
    center of circle
    {Number} radius
    {Number} angle
    angle in radians
    {Number} segments
    {Boolean} drawLineToCenter
    {Number} lineWidth
    {cc.Color} color
  • drawCubicBezier(origin, control1, control2, destination, segments, lineWidth, color)
    draws a cubic bezier path
    Parameters:
    {cc.Point} origin
    {cc.Point} control1
    {cc.Point} control2
    {cc.Point} destination
    {Number} segments
    {Number} lineWidth
    {cc.Color} color
  • drawDot(pos, radius, color)
    draw a dot at a position, with a given radius and color
    Parameters:
    {cc.Point} pos
    {Number} radius
    {cc.Color} color
  • drawDots(points, radius, color)
    draws an array of points.
    Parameters:
    {Array} points
    point of array
    {Number} radius
    {cc.Color} color
  • drawPoly(verts, fillColor, lineWidth, color)
    draw a polygon with a fill color and line color, copying the vertex list
    Parameters:
    {Array} verts
    {cc.Color} fillColor
    {Number} lineWidth
    {cc.Color} color
  • drawPoly_(verts, fillColor, lineWidth, color)
    draw a polygon with a fill color and line color without copying the vertex list
    Parameters:
    {Array} verts
    {cc.Color} fillColor
    {Number} lineWidth
    {cc.Color} color
  • drawQuadBezier(origin, control, destination, segments, lineWidth, color)
    draws a quad bezier path
    Parameters:
    {cc.Point} origin
    {cc.Point} control
    {cc.Point} destination
    {Number} segments
    {Number} lineWidth
    {cc.Color} color
  • drawRect(origin, destination, fillColor, lineWidth, lineColor)
    draws a rectangle given the origin and destination point measured in points.
    Parameters:
    {cc.Point} origin
    {cc.Point} destination
    {cc.Color} fillColor
    {Number} lineWidth
    {cc.Color} lineColor
  • drawSegment(from, to, lineWidth, color)
    draw a segment with a radius and color
    Parameters:
    {cc.Point} from
    {cc.Point} to
    {Number} lineWidth
    {cc.Color} color
  • {Object} getBlendFunc()
    Gets the blend func
    Returns:
    {Object}
  • {cc.Color} getDrawColor()
    draw color getter
    Returns:
    {cc.Color}
  • {Number} getLineWidth()
    line width getter
    Returns:
    {Number}
  • setBlendFunc(blendFunc, dst)
    Set the blend func
    Parameters:
    blendFunc
    dst
  • setDrawColor(color)
    draw color setter
    Parameters:
    {cc.Color} color
  • setLineWidth(width)
    line width setter
    Parameters:
    {Number} width