[英]How to draw an angle in flex using graphics tool
如何在flex中绘制角度在flex中有用于绘制矩形,椭圆等的工具没有找到要绘制角度的任何东西
If you mean simple arcs you can use 如果您指的是简单弧线,则可以使用
graphics.curveTo()
method. 方法。 Look : Adobe help about drawing lines and curves. 外观: Adobe关于绘制直线和曲线的帮助。
If you want something better look : Here 如果您想要更好的东西,请看: 这里
And for Angles a modified version of Emanuele Feronoto's algorithm: 对于Angles,Emanuele Feronoto算法的修改版本:
package {
import flash.display.Sprite;
public class angle extends Sprite {
var my_canvas:Sprite = new Sprite();
var deg_to_rad=0.0174532925;
public function angle() {
addChild(my_canvas);
my_canvas.graphics.lineStyle(20,0xff0000,1);
draw_angle(my_canvas,250,200,150,14,180);
}
public function
draw_angle(movieclip,center_x,center_y,radius,angle_from,angle_to) {
var angle=angle_from;
var px=center_x+radius*Math.cos(angle*deg_to_rad);
var py=center_y+radius*Math.sin(angle*deg_to_rad);
movieclip.graphics.moveTo(center_x, center_y);
movieclip.graphics.lineTo(px,py);
angle=angle_to;
px=center_x+radius*Math.cos(angle*deg_to_rad);
py=center_y+radius*Math.sin(angle*deg_to_rad);
movieclip.graphics.moveTo(center_x, center_y);
movieclip.graphics.lineTo(px,py);
}
}
}
There are no any special tools for drawing angels in .graphics. .graphics中没有用于绘制天使的任何特殊工具。 You can make angle-drawing utility yourself, using standart graphics.lineTo(x,y) tool. 您可以使用standart graphics.lineTo(x,y)工具自己制作绘图工具。 If you'll concretize your goal, I can help you. 如果您将自己的目标具体化,我可以为您提供帮助。
Well, your question is a bit unclear as angles are units of measure, so you can't in fact 'draw' them like you would with other graphical objects. 嗯,您的问题还不清楚,因为角度是度量单位,因此实际上您不能像使用其他图形对象那样“绘制”它们。 That would be the same if I ask how to draw celsius degrees of temperature - i did search for that method but i can't find it. 如果我问如何绘制摄氏温度,那将是相同的-我确实在搜索该方法,但找不到。 So you either want 1. to draw 2 lines (or rays) forming an certain angle, or 2. draw an 'graphical' angle representation - that you can do with arcs like answered already. 因此,您要么想要1.绘制形成一定角度的2条线(或射线),要么2.绘制“图形”角度表示-您可以使用已经回答的弧来完成。 Furthermore, angles can be expressed in radians, degrees and grads, so you must decide what will be your preferred unit for inputing. 此外,角度可以用弧度,度和渐变表示,因此您必须确定将首选的输入单位。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.