compass.xml 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <!--
  2. krpano - compass example
  3. - it rotates images accordingly to the viewing direction
  4. -->
  5. <krpano>
  6. <!-- compass with rotating pointer -->
  7. <!-- <layer name="compass1" visible="true" keep="true" url="%SWFPATH%/compass/compass_bg.png" align="righttop" x="150" y="10" children="false" scalechildren="true" destscale="1.0" onclick="switch(destscale,1.0,0.5);tween(scale,get(destscale));">
  8. <layer name="compass1_plate" url="%SWFPATH%/compass/compass_plate.png" align="center" zorder="1" />
  9. <layer name="compass1_pointer" url="%SWFPATH%/compass/compass_pointer.png" align="center" zorder="2" />
  10. <layer name="compass1_ring" url="%SWFPATH%/compass/compass_ring.png" align="lefttop" zorder="3" />
  11. </layer>
  12. -->
  13. <!-- compass with rotating plate -->
  14. <layer name="compass2" visible="true" keep="true" url="%SWFPATH%/compass/compass_bg.png" align="righttop" x="15" y="15" children="false" scalechildren="true" scale="0.7">
  15. <layer name="compass2_plate" url="%SWFPATH%/compass/compass_plate.png" align="center" zorder="1" />
  16. <layer name="compass2_pointer" url="%SWFPATH%/compass/compass_pointer.png" align="center" zorder="2" />
  17. <layer name="compass2_ring" url="%SWFPATH%/compass/compass_ring.png" align="lefttop" zorder="3" />
  18. </layer>
  19. <!-- view changing eeent -->
  20. <events name="compass_events" keep="true" onviewchange="compass_update_rotate();" />
  21. <!-- update the rotation values -->
  22. <action name="compass_update_rotate">
  23. trace('compass_update_rotate');
  24. set(global_heading, 180);
  25. calc(plugin[compass1_pointer].rotate, view.hlookat - global_heading);
  26. calc(plugin[compass2_plate].rotate, global_heading - view.hlookat);
  27. </action>
  28. <!-- add some hotspots -->
  29. <!-- <action name="add_compass_spots" autorun="onstart">
  30. showlog();
  31. set(layer[compass2].visible,true);
  32. addspot(n, 0, 0|0| 76|76, 1.0);
  33. addspot(no, 45, 78|0|118|76, 0.5);
  34. addspot(o, 90, 202|0| 71|76, 1.0);
  35. addspot(so, 135, 281|0|109|76, 0.5);
  36. addspot(s, 180, 400|0| 69|76, 1.0);
  37. addspot(sw, 225, 469|0|134|76, 0.5);
  38. addspot(w, 270, 603|0| 86|76, 1.0);
  39. addspot(nw, 315, 689|0|141|76, 0.5);
  40. </action> -->
  41. <!-- <action name="addspot">
  42. addhotspot(%1);
  43. set(hotspot[%1].url, '%SWFPATH%/compass/hotspots.png');
  44. set(hotspot[%1].crop, '%3');
  45. set(hotspot[%1].ath, %2);
  46. set(hotspot[%1].atv, 0);
  47. set(hotspot[%1].scale, %4);
  48. set(hotspot[%1].scale1, %4);
  49. calc(hotspot[%1].scale2, %4 * 2);
  50. set(hotspot[%1].zoom,true);
  51. set(hotspot[%1].onover, tween(scale,get(scale2)); );
  52. set(hotspot[%1].onout, tween(scale,get(scale1)); );
  53. set(hotspot[%1].onclick, lookto(get(ath),get(atv),90); );
  54. </action> -->
  55. </krpano>