https://blog.csdn.net/weixin_39644462/article/details/105257965
刚接触krpano,发现这个神奇的玩意,做全景图开发的工具。不过这几年也是不温不火。不过感觉还是挺新奇。
刚好遇到了一些问题,比如,默认皮肤的情况下,使用小行星在加载的时候就会出现各个热点,这样子并不好看。
接下来实现小行星加载完成再显示所有的热点。说明一下,我的krpano版本是1.19 pr16的。
其他方法可以参考肥宗的文档。》》http://www.krpano360.com/little-planet/
(我的也是参考他的)
首先在tour.xml文件skin_settings里设置littleplanetintro为true(开启小行星还在模式)
littleplanetintro="true"
然后在skin目录下vtourskin.xml文件里找到skin_setup_littleplanetintro
-
<action name="skin_setup_littleplanetintro" scope="local">
-
set(global.lpinfo,
-
scene=get(xml.scene),
-
hlookat=get(view.hlookat),
-
vlookat=get(view.vlookat),
-
fov=get(view.fov),
-
fovmax=get(view.fovmax),
-
limitview=get(view.limitview)
-
);
-
set(view,
-
fovmax=170,
-
limitview=lookto,
-
vlookatmin=90,
-
vlookatmax=90
-
);
-
lookat(calc(lp_hlookat - 180), 90, 150, 1, 0, 0);
-
set(events[lp_events].onloadcomplete,
-
delayedcall(0.5,
-
if(lpinfo.scene === xml.scene,
-
set(control.usercontrol, off);
-
set(view,
-
limitview=get(lpinfo.limitview),
-
vlookatmin=null,
-
view.vlookatmax=null
-
);
-
tween(
-
view.hlookat|view.vlookat|view.fov|view.distortion,
-
calc('' + lpinfo.hlookat + '|' + lpinfo.vlookat + '|' + lpinfo.fov + '|' + 0.0),
-
3.0, easeOutQuad,
-
set(control.usercontrol, all);
-
tween(view.fovmax, get(lpinfo.fovmax));
-
skin_deeplinking_update_url();
-
delete(global.lpinfo);
-
);
-
,
-
delete(global.lpinfo);
-
);
-
);
-
);
-
</action>
将这里修改为如下
-
<action name="skin_setup_littleplanetintro" scope="local">
-
set(global.lpinfo,
-
scene=get(xml.scene),
-
hlookat=get(view.hlookat),
-
vlookat=get(view.vlookat),
-
fov=get(view.fov),
-
fovmax=get(view.fovmax),
-
limitview=get(view.limitview)
-
);
-
set(view,
-
fovmax=170,
-
limitview=lookto,
-
vlookatmin=90,
-
vlookatmax=90
-
);
-
<!-- 新增 -->
-
set_hotspot_visible(false);
-
set(layer[skin_layer],visible=false,alpha=0);
-
set(layer[skin_control_bar],visible=false,alpha=0);
-
set(layer[skin_splitter_bottom],visible=false,alpha=0);
-
lookat(calc(lp_hlookat - 180), 90, 150, 1, 0, 0);
-
set(events[lp_events].onloadcomplete,
-
delayedcall(0.5,
-
if(lpinfo.scene === xml.scene,
-
set(control.usercontrol, off);
-
set(view,
-
limitview=get(lpinfo.limitview),
-
vlookatmin=null,
-
view.vlookatmax=null
-
);
-
tween(
-
view.hlookat|view.vlookat|view.fov|view.distortion,
-
calc('' + lpinfo.hlookat + '|' + lpinfo.vlookat + '|' + lpinfo.fov + '|' + 0.0),
-
3.0, easeOutQuad,
-
set(control.usercontrol, all);
-
tween(view.fovmax, get(lpinfo.fovmax));
-
<!-- 新增 -->
-
set_hotspot_visible(true);
-
set(layer[skin_layer].visible,true);tween(layer[skin_layer].alpha,1,1);
-
set(layer[skin_control_bar].visible,true);tween(layer[skin_control_bar].alpha,1,1);
-
set(layer[skin_splitter_bottom].visible,true);tween(layer[skin_splitter_bottom].alpha,1,1);
-
skin_deeplinking_update_url();
-
delete(global.lpinfo);
-
);
-
,
-
delete(global.lpinfo);
-
);
-
);
-
);
-
</action>
-
<!-- 自定义小行星加载完成前隐藏热点 -->
-
<action name="set_hotspot_visible">
-
for(set(i,0),i LT hotspot.count,inc(i),
-
if(%1 == false,
-
if(hotspot[get(i)].visible == true,
-
set(hotspot[get(i)].mark,true);set(hotspot[get(i)].visible,%1);
-
);
-
,
-
if(hotspot[get(i)].mark == true OR hotspot[get(i)].mark2 == true,
-
set(hotspot[get(i)].visible,%1);
-
);
-
);
-
);
-
</action>
这里外加了一个set_hotspot_visible的action元素,用来循环查找hotspot并设置其属性visible为false。然后在skin_setup_littleplanetintro加载小行星之前传false隐藏热点,然后在加载完小行星后再传true显示热点。