Actionscript 3 缩放对象以匹配视野
我在flash(as3)中的专有全景查看器应用程序上覆盖了一些可点击的热点,我需要确保热点在用户放大/缩小时根据不断变化的视野进行缩放,但我不确定使用什么公式 我将最大和最小视场分别设置为90和25。我得到了一些关于如何计算图标比例的建议: 来自panorama软件制造商:Actionscript 3 缩放对象以匹配视野,actionscript-3,flash,trigonometry,image-scaling,fieldofview,Actionscript 3,Flash,Trigonometry,Image Scaling,Fieldofview,我在flash(as3)中的专有全景查看器应用程序上覆盖了一些可点击的热点,我需要确保热点在用户放大/缩小时根据不断变化的视野进行缩放,但我不确定使用什么公式 我将最大和最小视场分别设置为90和25。我得到了一些关于如何计算图标比例的建议: 来自panorama软件制造商: Scale => 1/tan(FoV) 这似乎对我不起作用。以及: scalar += (ZOOM_SCALE_UPPER - ZOOM_SCALE_LOWER) * ( ZOOM_LIMIT_OUT - tempF
Scale => 1/tan(FoV)
这似乎对我不起作用。以及:
scalar += (ZOOM_SCALE_UPPER - ZOOM_SCALE_LOWER) * ( ZOOM_LIMIT_OUT - tempFOV )/( ZOOM_LIMIT_OUT-ZOOM_LIMIT_IN) ;
hotspot.scaleX = hotspot.scaleY = scalar;
使我靠近,但在某个点,即使全景继续缩放,热点也停止缩放。我想我可以做一些事情,比如:
diffFOV = previousFOV - currentFOV.
hotspot.scale = currentScale*(1-diffFov)
但这也不完全正确。一切都变得太大或太小
有什么想法吗?你可能想得太多了
//assume we change the scale
var NEW_SCALE:Number = currentScale*(1-(previousFOV-currentFOV));
//1. change the scale of the parent containing both the view and the hotspots
viewSprite.scale = NEW_SCALE;
//this way the hotspot and the panorama will scale together
//2. if they are not in the same parent... then set them both to the same view
hotspot.scale = panorama.scale;
如果他们没有在他们的中心点注册,你唯一需要做的就是重新定位。你可能想得太多了
//assume we change the scale
var NEW_SCALE:Number = currentScale*(1-(previousFOV-currentFOV));
//1. change the scale of the parent containing both the view and the hotspots
viewSprite.scale = NEW_SCALE;
//this way the hotspot and the panorama will scale together
//2. if they are not in the same parent... then set them both to the same view
hotspot.scale = panorama.scale;
之后你可能要做的唯一一件事是,如果它们没有在中心点注册,则重新定位。嘿,你说得对,我想得太多了。我需要首先计算FOV的百分比变化:(lastFOV curFieldOfView)/lastFOV;)然后将同样的百分比变化应用到剪辑的比例上。嘿,你是对的,我想得太多了。我需要首先计算FOV的百分比变化:(lastFOV curFieldOfView)/lastFOV;)然后将相同的百分比更改应用于剪辑的比例。