此文章只针对 1.19 pr14-pr15有效!
krpano 1.19pr3之后的版本的默认皮肤有小行星功能,在 skin_settings 中设置是否启用小行星开场,如下:
开场场景实现小行星
一、在tour.xml中
把 littleplanetintro="false" 中false改为 true
<skin_settings maps="true"
.....
littleplanetintro="true"
.....
/>
二、在vtourskin.xml 中找到 skin_setup_littleplanetintro
<action name="skin_setup_littleplanetintro">
copy(lp_scene, xml.scene);
copy(lp_hlookat, view.hlookat);
copy(lp_vlookat, view.vlookat);
copy(lp_fov, view.fov);
copy(lp_fovmax, view.fovmax);
copy(lp_limitview, view.limitview);
set(view.fovmax, 170);
set(view.limitview, lookto);
set(view.vlookatmin, 90);
set(view.vlookatmax, 90);
lookat(calc(lp_hlookat - 180), 90, 150, 1, 0, 0);
set(events[lp_events].onloadcomplete,
delayedcall(0.5,
if(lp_scene === xml.scene,
set(control.usercontrol, off);
copy(view.limitview, lp_limitview);
set(view.vlookatmin, null);
set(view.vlookatmax, null);
tween(view.hlookat|view.vlookat|view.fov|view.distortion, calc('' + lp_hlookat + '|' + lp_vlookat + '|' + lp_fov + '|' + 0.0),
3.0, easeOutQuad,
set(control.usercontrol, all);
tween(view.fovmax, get(lp_fovmax));
);
);
);
);
</action>
首先找到 delayedcall(0.5,这里将0.5改为其它数宇,这是小行星效果特续的时同。这里默认是0.5 秒,你如最希望效果特续时同长点,可以改为3秒,如果要短点,可以改得更小。
另外我们在krpano 1.19 pr3≥后版本 需要处理两个细节
第一个细节,只显示小行星而不任何皮肤,包括官方模版的皮肤,只待小行星结束以后,恢复正常视图时我们才让皮肤显示。
第二个细节,保证在HTML5以及Flash下热点hotspot都不会在小行星视图中出现。
因比我们找到上面skin setup_itteplanetinto这感acton,替换为:
<action name="skin_setup_littleplanetintro">
copy(lp_scene, xml.scene);
copy(lp_hlookat, view.hlookat);
copy(lp_vlookat, view.vlookat);
copy(lp_fov, view.fov);
copy(lp_fovmax, view.fovmax);
copy(lp_limitview, view.limitview);
set(view.fovmax, 170);
set(view.limitview, lookto);
set(view.vlookatmin, 90);
set(view.vlookatmax, 90);
set_hotspot_visible(false);
set(layer[skin_layer].visible,false);set(layer[skin_layer].alpha,0);
set(layer[skin_control_bar].visible,false);set(layer[skin_control_bar].alpha,0);
set(layer[skin_splitter_bottom].visible,false);set(layer[skin_splitter_bottom].alpha,0);
lookat(calc(lp_hlookat - 180), 90, 150, 1, 0, 0);
set(lp_running,true);
set(events[lp_events].onloadcomplete,
delayedcall(2.5,
if(lp_scene === xml.scene,
set(control.usercontrol, off);
copy(view.limitview, lp_limitview);
set(view.vlookatmin, null);
set(view.vlookatmax, null);
tween(view.hlookat|view.vlookat|view.fov|view.distortion, calc('' + lp_hlookat + '|' + lp_vlookat + '|' + 130 + '|' + 0.0),5.0, easeOutQuad,
set(control.usercontrol, all);
tween(view.fovmax, get(lp_fovmax));
);
set(lp_running,false);
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);
);
);
);
</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>
想了解更详细的 可以参考:移花接木(16)- 小行星开场 - krpano教程 (krpano360.com)