AS2:椭圆周围的补间
我在舞台上有 7 个影片剪辑,我想从不同的起点围绕椭圆进行补间。我在做这件事时遇到了很多麻烦......我首先使用了圆形公式,然后将 y 值除以椭圆的宽度除以高度。这种方法可行,但每次旋转后 y 值都会变小。该代码是:
this._x += (Math.cos(angle * Math.PI/180) * radius); this._y += (Math.sin(角度 * Math.PI/180) *半径)/1.54;
我也很难找到起点的角度,如果它关闭,它们将不会在同一个椭圆中行进,但它们都有不同的起始角度。
有什么线索吗?
I have 7 movieclips on stage I want to tween around an ellipse from different start points. I am having lots of trouble doing this.... I used a circle formula at first and then divided the y value by the width of the ellipse over the height. This sort of worked but after every rotation the y value was a little of. That code is:
this._x += (Math.cos(angle * Math.PI/180) * radius);
this._y += (Math.sin(angle * Math.PI/180) *radius)/1.54;
I also have trouble finding the angle of the start point, if it is off they won't travel in the same ellipse but they all have different starting angles.
Any clues?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用以下代码片段计算个别偏移量:
设置每次更新的位置而不是移动,这样就不会产生任何漂移。
使用此代码更新每个对象,增加
angle
变量以使其旋转。Calculate the incidvidual offsets using this snippet:
Set the position each update instead of moving, that way you wont get any drift.
Update each object using this code, incrementing the
angle
var to get it to spin.这几乎是解决了,这段脚本将获取数组按钮的项目(可以添加任意数量),将它们围绕您设置的椭圆(原点+半径)间隔开,并根据您的速度在其周围补间它们放。唯一的问题是间距不均匀,有些很近,有些很远,我不明白为什么。
请注意,我从 http://www 获取此脚本的基础.actionscript.org/forums/showthread.php3?t=161830&page=2 将其转换为 AS2 并使其通过数组工作。
This is almost soved, this piece of script will take the items of the array buttons (can add as many as you want), space them around the ellipse you set (origin + radius), and tween them around it according to the speed you set. The only problem is the spacing isn't even and some are close and some far apart and I don't understand why.
Please note I got the base of this script from http://www.actionscript.org/forums/showthread.php3?t=161830&page=2 converted it to AS2 and made it work from an array.