求教,2.0 多边形画图的方法是什么,各位大大指点下

刚接触ccc,很多api不熟悉,反了半天也没找到···········

官方文档 搜 绘图

哪个是·············
lineto么? 自己连接?

var drawDataArray=[100,100,100,100,100,100];//所有数据按比例缩放后的数据
var mCenterX=this.radar.x;//中心点x
var mCenterY=this.radar.y;//中心点y
var mAngle = Math.PI * 2 / 6; //角度
for(var i = 0; i < 6; i ++){
var x = mCenterX + Math.sin(mAngle * i)*drawDataArray[i]*1.5; //属性值要控制在100之内
console.log(“sin+”+Math.sin(mAngle * i));
var y = -(mCenterY + Math.cos(mAngle * i)*drawDataArray[i]*1.5);
console.log(“cos+”+Math.cos(mAngle * i));
if(i==0){
this.graphics.moveTo(x, y);
}
else{
this.graphics.lineTo(x, y);
}
}
this.graphics.stroke();
this.graphics.lineWidth = 0.1;
this.graphics.strokeColor = cc.hexToColor(’#0000ff’);
this.graphics.strokeColor = cc.hexToColor(’#0000ff’);
this.graphics.fillColor =cc.color(100, 100,255,100);
this.graphics.fill();

这是我自己的雷达图的画法 。脚本在的组件要挂 Graphisc

注释不要管 是我自己用的

谢谢,也就是只能用lineto了