[摘要]下面是一段让热点图片跟随鼠标移动的代码,可以通过坐标转换实现跟随。
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 |
<krpano version="1.19" onstart="mousemove()"> <hotspot name="oval" url="pic.png" distorted="true" ath="0" atv="45" alpha="0.5" enabled="false" /> <action name="mousemove"> screentosphere(mouse.x, mouse.y, mth, mtv); set(hotspot[oval].ath, get(mth)); set(hotspot[oval].atv, get(mtv)); sub(a, -90, mtv); set(hotspot[oval].rx, get(a)); if(mtv GT 0 AND mtv LE 90, set(hotspot[oval].visible, true); , set(hotspot[oval].visible, false); ); mul(hotspot[oval].scale, mtv, 0.03); delayedcall(0, mousemove()); </action> </krpano> |