我是靠谱客的博主 霸气大白,这篇文章主要介绍给全景添加动态热点,现在分享给大家,希望可以做个参考。

这里写图片描述

做一个上图箭头指向的热点信息。

打开 tour.xml 文件,找到里的scene ,选择一个你将要添加热点的场景。
添加一下代码:

复制代码
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<style name="skin_hotspotstyle_title" url="img/default.png" scale="0.5" edge="top" oy="0" distorted="false" tooltip="" onclick="if(linkedscene, skin_hidetooltips(); tween(scale,0.25,0.5); tween(oy,-20,0.5); tween(alpha,0,0.5); looktohotspot(); loadscene(get(linkedscene),null,get(skin_settings.loadscene_flags),get(skin_settings.loadscene_blend)); skin_updatescroll(); );" onloaded="add_all_the_time_tooltip();do_crop_animation(120,100, 50);" /> <style name="lookup_textfiled" background="true" backgroundalpha="0.5" backgroundcolor="0x000000" css="calc:skin_settings.design_text_css + ' text-align:center; font-size:16px; color:#ffffff;'" /> <style name="text_title_up" background="true" backgroundalpha="0.6" backgroundcolor="0x000000" css="text-align:center; font-size:16px; color:#ffffff; padding:2px 8px; border-radius:5px;" y="50" /> <style name="text_title_down" background="true" backgroundalpha="0.6" backgroundcolor="0x000000" css="text-align:center; font-size:16px; color:#ffffff; padding:2px 8px; border-radius:5px;" y="-50" /> <!-- 热点标题显示 set_titlevalue(父热点名,子热点名); 父热点必须设置tooltip属性 --> <action name="set_titlevalue"> set(layer[%2].html,get(hotspot[%1].tooltip)); </action> <!-- 动画action --> <action name="do_crop_animation"> <!-- add attributes to the hotspot --> registerattribute(xframes, calc((imagewidth / %1) BOR 0)); registerattribute(yframes, calc((imageheight / %2) BOR 0)); registerattribute(frames, calc(xframes * yframes)); registerattribute(frame, 0); set(crop, '0|0|%1|%2'); setinterval(calc('crop_anim_' + name), calc(1.0 / %3), if(loaded, inc(frame); if(frame GE frames, if(onlastframe !== null, onlastframe() ); set(frame,0); ); mod(xpos, frame, xframes); div(ypos, frame, xframes); Math.floor(ypos); mul(xpos, %1); mul(ypos, %2); calc(crop, xpos + '|' + ypos + '|%1|%2'); , clearinterval(calc('crop_anim_' + name)); ); ); </action> <!-- 动态热点图 --> <hotspot name="animation1" tooltip="大门" style="skin_hotspotstyle_title" ath="41" atv="-30" linkedscene="scene_all02" /> <layer name="text_ani" url="%SWFPATH%/plugins/textfield.swf" bgroundedge="10" onloaded="set_titlevalue(animation1,text_ani);" parent="hotspot[animation1]" align="bottom" style="text_title_up" onclick="" /> <hotspot name="skin_buy" tooltip="商品名" url="img/skin_buy_min.png" onloaded="do_crop_animation(128,128, 1000);" scale="0.5" zoom="true" ath="45" atv="-40" onclick="" /> <!-- <layer name="skin_buy_title" url="%SWFPATH%/plugins/textfield.swf" parent="hotspot[skin_buy]" style="text_title_up" onloaded="set_titlevalue(skin_buy,skin_buy_title);" onclick="hotspot_lookto(skin_buy);" scale="0.5" /> --> <!-- 跳转至香港 --> <hotspot tooltip="香港是一个好地方" name="goto-xianggang" url="img/new_spotd01_txt_gif.png" onloaded="do_crop_animation(100,120, 20);" scale="0.5" align="bottomcenter" ath="40" atv="-5" onclick="" /> <layer name="title-xianggang" url="%SWFPATH%/plugins/textfield.swf" parent="hotspot[goto-xianggang]" align="bottom" y="-20" onloaded="set_titlevalue(goto-xianggang,title-xianggang);" style="text_title_down" handcursor="true" onclick="" />

这样就做好了如图的几个动态热点图.

注意 这里用了动画函数(do_crop_animation(x_width,y_height, time)), 动画函数加载图片时 是一帧一帧的 顺序是 从左向右 从上至下…

具体代码包在我的资源处可下载。

最后

以上就是霸气大白最近收集整理的关于给全景添加动态热点的全部内容,更多相关给全景添加动态热点内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(58)

评论列表共有 0 条评论

立即
投稿
返回
顶部