cocos2d-js cc.DrawNode画图参考大全




new cc.DrawNode() 创建draw对象,画点,线段,多边形

var drawNode = new cc.DrawNode();

this.addChild(drawNode);              //加入Layer层   
     
drawNode.clear()                      //清除节点缓存

drawNode.ctor()                       //构造函数
  
drawNode.drawCardinalSpline(config, tension, segments, lineWidth, color)    //曲线    
     
//参数说明:
//congfig:点数组
//tension:张力
//segments:段落
//lineWidth:线条宽度
//color:颜色
  
drawNode.drawCatmullRom(points, segments, lineWidth, color)   //同上
  
drawNode.drawCircle(center, radius, angle, segments, drawLineToCenter, lineWidth, color)   //画圆
//参数说明: 原点,半径,弧度,分段(越大越接近圆),原点到弧度的线(boolean),线条宽度,颜色
  
drawNode.drawCubicBezier(origin, control1, control2, destination, segments, lineWidth, color)  //画三次贝塞尔曲线
//drawNode.drawCubicBezier(cc.p(s.width - 250, 40), cc.p(s.width - 70, 100), cc.p(s.width - 30, 250), cc.p(s.width - 10, s.height - 50),10,1, cc.color(0, 1, 0, 1));
drawNode.drawQuadBezier(origin, control, destination, segments, lineWidth, color)          //画二次贝塞尔曲线 参考三次贝塞尔曲线
drawNode.drawDot(pos, radius, color)         //画点
//drawNode.drawDot(cc.p(60, 100), 20, cc.color(0.5,0.6,0,1)); 
drawNode.drawDots(points, radius, color)     //画点  points  点数组
  
drawNode.drawPoly(verts, fillColor, lineWidth, color)       //画多边形
drawNode.drawRect(origin, destination, fillColor, lineWidth, lineColor)  //画矩形
drawNode.drawSegment(from, to, lineWidth, color)  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值