Actionscript 翻译转换
您好,我正在开发 ActionScript 3,我必须使用平移旋转缩放到影片剪辑。 我的旋转和缩放工作正常,但是当我处理平移时,我发现平移会将对象移动到原点之外的问题,因此当我想旋转对象时,对象不再按预期旋转。 实现翻译的最佳方法是什么,以便在翻译原点的同时翻译影片剪辑....
最后一件事.. movieclip.scale 和 movieclip.transform.scale 函数有什么区别? 如果我使用 movieclip.scale,我仍然可以从 movieclip.scale 获取 movieclip.transform.matrix
Hi I am working on actionscript 3 which I have to use translation rotation scaling to a movieclip. I have the rotation and scaling working properly but when I dealing with translation I find the problem that the translation will move the object outside of the origin so when I wanted to rotate the object, the object no longer rotate as expected. What is the best way to implement the translation so that it translate the movieclip while translate the origin....
Last thing.. What is the difference between movieclip.scale and movieclip.transform.scale function? If i use movieclip.scale, do I still able to get the movieclip.transform.matrix from that movieclip.scale
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所有矩阵变换(包括旋转和缩放)均相对于剪辑所在坐标系的原点生效。 如果要围绕任何其他点旋转或缩放,则应将剪辑平移到该点,进行变换,然后再平移回来。 换句话说,这个:
与这个: 做同样的事情:
它的工作方式与比例变换完全相同。
对于您的另一个问题,MovieClip.scaleX/Y 和 Matrix.scale 之间的区别与旋转完全相同 - 您可以以任何一种方式应用旋转,但使用内置的 MC 属性,它们相对于剪辑的注册点生效,矩阵函数是相对于原点的。 如果剪辑的注册点位于 (0,0),则它们的工作方式相同。
All matrix transformations, including rotation and scale, take effect relative to the origin of the co-ordinate system where the clip lives. If you want to rotate or scale around any other point, you should translate the clip to that point, transform, and translate back. In other words, this:
does the same thing as this:
It works exactly the same way with scale transformation.
For your other question, the difference between MovieClip.scaleX/Y and Matrix.scale is exactly the same as with rotate - you can apply your rotations either way, but with the built in MC properties they take effect relative to the clip's registration point, and the Matrix functions are relative to the origin. If the clip's registration point is at (0,0) then they work the same.