AS3 绕舞台
我试图让闪光灯从舞台中心画一条线并围绕舞台递增。但不确定我会用什么数学来做到这一点。到目前为止,我已经将线延伸到某个点,但不确定如何更改该点,以便它围绕我的舞台尺寸旋转。
到目前为止,我有这个:
var linetox=0;
var linetoy=0;
var _stage=this;
var _stage_center_x = stage.stageWidth/2;
var _stage_center_y = stage.stageHeight/2;
trace(_stage_center_x);
function enterframe(e:Event):void {
linetox+=10;
linetoy+=10;
var lineDrawing:MovieClip = new MovieClip();
this.addChild(lineDrawing);
lineDrawing.graphics.lineStyle(1);
lineDrawing.graphics.moveTo(_stage_center_x,_stage_center_y);///This is where we start drawing
lineDrawing.graphics.lineTo(linetox, linetoy);
}
this.addEventListener(Event.ENTER_FRAME, enterframe);
这显然将线的目标结尾移动得越来越低,只是试图让它在屏幕上绘制(就像时钟一样)
I am trying to have flash draw a line from the center of the stage out and increment around the stage. Not sure what math I would use to do this though. So far I have the line going out to a certain point but not sure how to change that point so that it circles around whatever the dimensions of my stage would be.
So far I have this:
var linetox=0;
var linetoy=0;
var _stage=this;
var _stage_center_x = stage.stageWidth/2;
var _stage_center_y = stage.stageHeight/2;
trace(_stage_center_x);
function enterframe(e:Event):void {
linetox+=10;
linetoy+=10;
var lineDrawing:MovieClip = new MovieClip();
this.addChild(lineDrawing);
lineDrawing.graphics.lineStyle(1);
lineDrawing.graphics.moveTo(_stage_center_x,_stage_center_y);///This is where we start drawing
lineDrawing.graphics.lineTo(linetox, linetoy);
}
this.addEventListener(Event.ENTER_FRAME, enterframe);
which obviously moves the destination ending of the line lower and lower, just trying to get it to draw around the screen (like a clock)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)