cocos2d-js cc.DrawNode用法示例

cocos2d-js cc.DrawNode用法示例,第1张

概述var draw = new cc.DrawNode();                 //创建drawnode对象        this.addChild(draw, 10);        var centerPos = cc.p(winSize.width / 2, winSize.height / 2);                 //drawSegment --- 绘
vardraw=newcc.DrawNode();//创建drawnode对象this.addChild(draw,10);varcenterPos=cc.p(winSize.wIDth/2,winSize.height/2);//drawSegment---绘制直线//用法:draw.drawSegment(from,to,linewidth,color)//参数//from:起始点//to:终点//linewidth:线条宽度//color:线条颜色draw.drawSegment(cc.p(0,0),cc.p(winSize.wIDth,winSize.height),1,cc.color(255,255,255));draw.drawSegment(cc.p(0,5,255));//drawDot---绘制圆点//draw.drawDot(pos,radius,color)//draw.drawDots(points,color)//画点points点数组draw.drawDot(cc.p(winSize.wIDth/2,winSize.height/2),40,cc.color(0,128));varpoints=[cc.p(60,60),cc.p(70,70),cc.p(60,60)];draw.drawDots(points,4,255));//drawCircle---绘制圆形//draw.drawCircle(center,angle,segments,drawlinetoCenter,color)draw.drawCircle(cc.p(winSize.wIDth/2,100,10,false,7,255));draw.drawCircle(cc.p(winSize.wIDth/2,50,cc.degreesToradians(90),true,2,255));//drawpoly---绘制多边形//draw.drawpoly(verts,fillcolor,color)//notfillvarvertices=[cc.p(0,cc.p(50,50),cc.p(100,100),100)];draw.drawpoly(vertices,null,255));varvertices2=[cc.p(30,130),cc.p(30,230),200)];draw.drawpoly(vertices2,255));//fillvarvertices3=[cc.p(60,cc.p(80,200)];draw.drawpoly(vertices3,255));//drawrect---绘制矩形//draw.drawRect(origin,destination,linecolor)//notfilldraw.drawRect(cc.p(120,120),cc.p(200,200),255));//filldraw.drawRect(cc.p(120,220),300),180),cc.color(128,128,255));//drawquadbezIErpath---绘制二次贝塞尔曲线//draw.drawQuadBezIEr(origin,control,color)draw.drawQuadBezIEr(cc.p(0,cc.p(centerPos.x,centerPos.y),255));//drawcubicbezIErpath---绘制三次贝塞尔曲线//draw.drawCubicBezIEr(origin,control1,control2,color)draw.drawCubicBezIEr(cc.p(winSize.wIDth/2,cc.p(winSize.wIDth/2+30,winSize.height/2+50),cc.p(winSize.wIDth/2+60,winSize.height/2-50),255));//drawcardinalspline---绘制曲线//drawNode.drawCardinalSpline(config,tension,color)varvertices4=[cc.p(centerPos.x-130,centerPos.y-130),cc.p(centerPos.x-130,centerPos.y+130),cc.p(centerPos.x+130,centerPos.y-130)];draw.drawCardinalSpline(vertices4,0.5,255));
总结

以上是内存溢出为你收集整理的cocos2d-js cc.DrawNode用法示例全部内容,希望文章能够帮你解决cocos2d-js cc.DrawNode用法示例所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1077102.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存