Iris效果通过扩展或收缩集中在目标上的矩形遮罩为效果目标设置动画。该效果可以从目标的中心放大遮罩来显示目标,也可以向中心收缩遮罩来隐藏目标。演示:
源码如下:
- <?xml version="1.0"?>
- <!-- Simple example to demonstrate the Iris effect. -->
- <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" height="352"
- width="450">
- <mx:Iris id="irisOut" duration="1000" showTarget="true"/>
- <mx:Iris id="irisIn" duration="1000" showTarget="false"/>
- <mx:Panel title="Iris Effect Example" width="351" height="304"
- horizontalAlign="center" layout="absolute">
- <mx:Text width="100%" color="blue" fontSize="12"
- text="使用Iris效果显示和隐藏图片."/>
- <mx:Image id="img" source="@Embed(source='meinv.jpg')"
- visible="true"
- showEffect="{irisIn}" hideEffect="{irisOut}" x="25.5" y="28"/>
- <mx:Button x="97" y="236" label="显示" fontSize="12"
- click="img.visible=true"/>
- <mx:Button x="170" y="236" label="隐藏" fontSize="12"
- click="img.visible=false"/>
- </mx:Panel>
- </mx:Application>
简要说明:showTarget="true"表示组件缓缓出现,false则为消失。第14行showEffect事件表示显示时的效果,hideEffect事件表示隐藏时的效果。duration属性表示效果的时间间隔