MovieClip.prototype.Line=function(p1,p2){
this.moveTo(p1.x,p1.y);
this.lineTo(p2.x,p2.y);
};
//三角形
MovieClip.prototype.Tri=function(p1,p2,p3){
this.moveTo(p1.x,p1.y);
this.lineTo(p2.x,p2.y);
this.lineTo(p3.x,p3.y);
this.lineTo(p1.x,p1.y);
};
//正方形
MovieClip.prototype.Square=function(p,width){
this.moveTo(p.x,p.y);
this.lineTo(p.x+width,p.y);
this.lineTo(p.x+width,p.y+width);
this.lineTo(p.x,p.y+width);
this.lineTo(p.x,p.y);
};
//矩形
MovieClip.prototype.Rect=function(p,width,height){
this.moveTo(p.x,p.y);
this.lineTo(p.x+width,p.y);
this.lineTo(p.x+width,p.y+height);
this.lineTo(p.x,p.y+height);
};
//四边形
MovieClip.prototype.Quad=function(p1,p2,p3,p4){
this.moveTo(p1.x,p1.y);
this.lineTo(p2.x,p2.y);
this.lineTo(p3.x,p3.y);
this.lineTo(p4.x,p4.y);
this.lineTo(p1.x,p1.y);
};
//多边形
MovieClip.prototype.Poly=function(points){
this.moveTo(points[0].x,points[0].y);
var i=points.length;
while(i--) this.lineTo(points[i].x,points[i].y);
};
//正多边形
MovieClip.prototype.regPoly=function(x,y,r,PointsNum,rotation){
var angle=(rotation-90)*(Math.PI/180);
var dAngle=2*Math.PI/PointsNum;
var cos=Math.cos,sin=Math.sin;
this.moveTo(r*cos(angle)+x,r*sin(angle)+y);
while(PointsNum--){
angle+=dAngle;
this.lineTo(r*cos(angle)+x,r*sin(angle)+y);
}
};
//椭圆
MovieClip.prototype.Oval=function(x,y,rx,ry){
this.moveTo(x+rx,y);
this.curveTo(x+rx,0.4142*ry+y,0.7071*rx+x,0.7071*ry+y);
this.curveTo(0.4142*rx+x,ry+y,x,ry+y);
this.curveTo(-0.4142*rx+x,ry+y,-0.7071*rx+x,0.7071*ry+y);
this.curveTo(-rx+x,0.4142*ry+y,-rx+x,y);
this.curveTo(-rx+x,-0.4142*ry+y,-0.7071*rx+x,-0.7071*ry+y);
this.curveTo(-0.4142*rx+x,-ry+y,x,-ry+y);
this.curveTo(0.4142*rx+x,-ry+y,0.7071*rx+x,-0.7071*ry+y);
this.curveTo(rx+x,-0.4142*ry+y,rx+x,y);
}
//画圆
MovieClip.prototype.regOval=function(x,y,r){
var rx=ry=r;
this.moveTo(x+rx,y);
this.curveTo(x+rx,0.4142*ry+y,0.7071*rx+x,0.7071*ry+y);
this.curveTo(0.4142*rx+x,ry+y,x,ry+y);
this.curveTo(-0.4142*rx+x,ry+y,-0.7071*rx+x,0.7071*ry+y);
this.curveTo(-rx+x,0.4142*ry+y,-rx+x,y);
this.curveTo(-rx+x,-0.4142*ry+y,-0.7071*rx+x,-0.7071*ry+y);
this.curveTo(-0.4142*rx+x,-ry+y,x,-ry+y);
this.curveTo(0.4142*rx+x,-ry+y,0.7071*rx+x,-0.7071*ry+y);
this.curveTo(rx+x,-0.4142*ry+y,rx+x,y);
}