krpano 添加指南针? krpano 添加指南针?

krpano 添加指南针?

首先讲examples\compass的指南针复制到根目录,然后两种方式,第一种复制到secene外面:


<!-- 表盘不动 表针动 -->
<layer name="compass1" url="compass_bg.png" keep="true" align="lefttop" x="10" y="10" children="false" scalechildren="true" destscale="1.0" onclick="switch(destscale,1.0,0.5);tween(scale,get(destscale));">
	<layer name="compass1_plate"   url="compass_plate.png" keep="true"    align="center"  zorder="1" />
	<layer name="compass1_pointer" url="compass_pointer.png" keep="true"  align="center"  zorder="2" />
	<layer name="compass1_ring"    url="compass_ring.png"  keep="true"   align="lefttop" zorder="3" />
</layer>
 
 
<!-- 视野改变事件 -->
<events name="compass_events" keep="true" onviewchange="compass_update_rotate();" />
 
<!-- 更新指南针旋转数值 -->
<action name="compass_update_rotate">
	calc(plugin[compass1_pointer].rotate, view.hlookat - global_heading);		
</action>
在secene调用:onstart="set(global_heading, 180);"
第二种样式:
 
<!-- 动态添加指南热点 -->
<action name="add_compass_spots">
	addspot(n,  calc(0 + global_heading),     0|0| 76|76, 1.0);
	addspot(no, calc(45 + global_heading),   78|0|118|76, 0.5);
	addspot(o,  calc(90 + global_heading),  202|0| 71|76, 1.0);
	addspot(so, calc(135 + global_heading), 281|0|109|76, 0.5);
	addspot(s,  calc(180 + global_heading), 400|0| 69|76, 1.0);
	addspot(sw, calc(225 + global_heading), 469|0|134|76, 0.5);
	addspot(w,  calc(270 + global_heading), 603|0| 86|76, 1.0);
	addspot(nw, calc(315 + global_heading), 689|0|141|76, 0.5);
</action>
 
<action name="addspot">
	addhotspot(%1);
	set(hotspot[%1].url, '%CURRENTXML%/hotspots.png');
	set(hotspot[%1].crop, '%3');
	set(hotspot[%1].ath, %2);
	set(hotspot[%1].atv, 0);
	set(hotspot[%1].scale, %4);
	set(hotspot[%1].scale1, %4);
	calc(hotspot[%1].scale2, %4 * 2);
	set(hotspot[%1].zoom,true);
	set(hotspot[%1].onover, tween(scale,get(scale2)); );
	set(hotspot[%1].onout, tween(scale,get(scale1)); );
	set(hotspot[%1].onclick, lookto(get(ath),get(atv),90); );
</action>
调用:
1
set(global_heading, 180);add_compass_spots();


分享本文至:

评论 0

挤眼 亲亲 咆哮 开心 想想 可怜 糗大了 委屈 哈哈 小声点 右哼哼 左哼哼 疑问 坏笑 赚钱啦 悲伤 耍酷 勾引 厉害 握手 耶 嘻嘻 害羞 鼓掌 馋嘴 抓狂 抱抱 围观 威武 给力
提交评论

清空信息
关闭评论