1

我在Flash(as3)中的专有全景查看器应用程序的顶部覆盖了一些可点击的热点,我需要确保热点根据不断变化的视野进行缩放放大/缩小,但我不知道使用什么公式。缩放对象以匹配视野

我设置了分别为90和25的最大和最小视场。我一直在考虑如何计算图标的规模提出了一些建议:从全景软件的制造商

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) 

但这也不是很正确。一切都变得太大或太小。

任何想法?

回答

1

您可能会想过它。如果他们没有对他们的中心点注册

//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; 

你可能以后做唯一的事情就是重新定位。

+0

嘿,你是对的,我正在反思这个。我需要首先计算FOV中的百分比变化:(lastFOV-curFieldOfView)/ lastFOV;)然后将相同的百分比变化应用于剪辑的比例。 – mheavers