Actionscript 中是否有 Z 位置变化的偏移方程?
假设我有一个影片剪辑,加载时我将其 .z 位置设置为 2000,使其在背景中看起来很远...我到底如何才能确定它的 x 和 y 点将出现在哪里在舞台上?有方程式吗?
例如;
original.x = 200;
original.y = 200;
original.z = 0;
new.z = 2000;
new.x = original.x*10;
new.y = original.y*10;
Say I have a movie clip that when loaded I set it's .z position to 2000 to make it look far off in the background... How in the world can I set it's x and y points with any certainty as to where it will appear on the stage? Is there an equation?
E.g.;
original.x = 200;
original.y = 200;
original.z = 0;
new.z = 2000;
new.x = original.x*10;
new.y = original.y*10;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须将实际的 x 和 y 点与 3D 空间点分开(我使用 _x、_y 和 _z)。使用一个基本想法,即任何离你更远的东西都将是,你将需要定义消失点的原点和“焦距”(想想相机镜头),这将定义物体消失在背景中的速度。尝试使用值,但 200 左右的值通常效果很好。
这应该给你一些像这样简单的东西,其中 my_mc 是你想要产生效果的对象:
在 kirupa 有一些关于这个主题的非常好的教程,尝试这个(虽然它是在 as2 中,但理论是相同的)
http://www.kirupa.com/developer/actionscript/3dexplore.htm
you have to seperate out the actual x and y points with the 3D space points (i use _x, _y and _z). using a basic idea that anything further away from you is going to be you will need to define an origin for the vanishing point and a "focal length" (think of a camera lens) that will define how quickly things dissappear into the background. try playing with values, but something around 200 usually works fairly well.
this should give you something simple like this where my_mc is the object you want to have the effect on:
there are some really good tutorials at kirupa on this subject, try this one (though it is in as2 the theory is the same)
http://www.kirupa.com/developer/actionscript/3dexplore.htm