[摘要]为全景添加蒙版,可以实现各种不同的特殊效果。本案例不同于加png蒙版,本案例使用jpg图片,通过混码模式调用实现半透明蒙版,本案例方式只支持flash模型下显示,png则无此限制。
代码说明
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 58 59 60 61 62 63 64 65 66 67 68 |
<!-- 默认先设置一张隐藏蒙版图片,必须设置blendmode属性,否则只作普通图片显示 --> <plugin name="mask" devices="flash" url="darkmask.jpg" blendmode="multiply" align="lefttop" width="100%" height="100%" enabled="false" zorder="-1" /> <!-- 设置按钮消失的动作 --> <action name="nomask"> set(plugin[mask].visible,false); </action> <!-- 设置点击按钮显示不同的蒙版,代入jpg名称和blendmode模型两个参数 --> <action name="setmask"> if(isflash, set(plugin[mask].visible, true); set(plugin[mask].url, '%CURRENTXML%/%1.jpg'); set(plugin[mask].blendmode, %2); ); </action> <!-- 按钮样式 --> <style name="button" url="%SWFPATH%/plugins/textfield.swf" css="text-align:center; color:#FFFFFF; font-family:Arial; font-weight:bold; font-size:10px;" children="false" width="100" height="22" vcenter="true" backgroundcolor="0x000000" backgroundalpha="0.667" roundedge="10" border="false" shadow="0.1" shadowrange="8" shadowcolor="0xFFFFFF" /> <!-- 通过各个按钮控制显示的蒙版图片,并设置混合模型参数 --> <plugin name="nomask_button" style="button" html="No Mask" align="bottom" x="-330" y="25" onclick="action(nomask);" /> <plugin name="darkmask_button" style="button" html="Dark Shadow" align="bottom" x="-220" y="25" onclick="action(setmask,darkmask,multiply);" /> <plugin name="darkermask_button" style="button" html="Darker" align="bottom" x="-110" y="25" onclick="action(setmask,invdarkmask,subtract);" /> <plugin name="flashlight_button" style="button" html="Flashlight" align="bottom" x="0" y="25" onclick="action(setmask,xraymask,multiply);" /> <plugin name="xray_button" style="button" html="X-Ray" align="bottom" x="+110" y="25" onclick="action(setmask,xraymask,difference);" /> <plugin name="alien_button" style="button" html="Alien View" align="bottom" x="+220" y="25" onclick="action(setmask,alienmask,multiply);" /> <plugin name="hc_button" style="button" html="HighContrast" align="bottom" x="+330" y="25" onclick="action(setmask,darkmask,overlay);" /> |
下载地址