[摘要]krpano 1.19-pr14新功能,在进入VR模式下,可以放大全景视频,即zoom-in, 看下面例子.
zoom-in方法: 进入vr模式后(点击“enter VR”),十字星看着某个位置不动2秒,即开始zoom-in, 要停止zoom-in并zoom-out到原始状态,只要十字星观看其他位置即可。
实现zoomin,需插入以下代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
<action name="webvr_zooming" scope="local" autorun="onstart"> set(movement_tolerance, 0.01); set(zoom_speed, 1.0); <!--set(max_zoom, 75);--> copy(last_tick, timertick); copy(last_movement_tick, last_tick); copy(last_view_hlookat, view.hlookat); copy(last_view_vlookat, view.vlookat); setinterval(webvr_zooming, 0.1, copy(cur_tick, timertick); if(webvr.isenabled, getlooktodistance(move_distance, last_view_hlookat, last_view_vlookat); calc(movespeed, move_distance / (cur_tick-last_tick)); calc(movement_tolerance, 0.01 / (webvr.zoom^0.5)); if(movespeed GT movement_tolerance, copy(last_movement_tick, cur_tick); tween(zoom_speed, 1.0, 0); Math.pow(movespeed, 0.5); ); if((cur_tick - last_movement_tick) GT 2000, tween(zoom_speed, 1.04); ); calc(new_zoom, webvr.zoom * (zoom_speed * (1.0 - movespeed)) ); clamp(new_zoom, 1, get(max_zoom)); tween(webvr.zoom, get(new_zoom), 0.1, linear); calc(webvr.friction, new_zoom GT 2.0 ? (new_zoom - 2.0) / 100.0 : 0); , copy(last_movement_tick, cur_tick); ); copy(last_tick, cur_tick); copy(last_view_hlookat, view.hlookat); copy(last_view_vlookat, view.vlookat); ); </action> max_zoom是自定义可以zoom-in的倍数,当前例子是75,您可以直接将代码中max_zoom改为75,也可以在启动时执行set(max_zoom,75)进行设定。 |
这功能用在巨幅照片正适合!!