Flex4.6类似迅雷的果冻弹窗效果的类
发布时间:2020-12-15 04:05:58 所属栏目:百科 来源:网络整理
导读:? ? ? ? 看到迅雷7的弹窗效果觉得非常酷,但搜遍全网,都没有发现类似的源码,只得自己动手写一下了,代码不是很难,只有两个方法,即弹出窗口及移除窗口,但回过头来想下,没有很好的空间想像力真的难实现,下面贴上代码: /** * 弹出窗口,果冻效果 * @par
? ? ? ? 看到迅雷7的弹窗效果觉得非常酷,但搜遍全网,都没有发现类似的源码,只得自己动手写一下了,代码不是很难,只有两个方法,即弹出窗口及移除窗口,但回过头来想下,没有很好的空间想像力真的难实现,下面贴上代码: /** * 弹出窗口,果冻效果 * @param control 窗口目标 * @param parent 父级 * @param modal * @param backfunction 回调函数 * */ public static function show(control:IFlexDisplayObject,parent:DisplayObject=null,modal:Boolean=true,backfunction:Function=null):void { if(!parent) parent=Sprite(FlexGlobals.topLevelApplication); var rotate3D:Rotate3D=new Rotate3D(); rotate3D.target=control; rotate3D.duration=180; rotate3D.autoCenterTransform=true; rotate3D.projectionX=(control.width); rotate3D.projectionY=(control.height); rotate3D.autoCenterProjection=false; rotate3D.angleXFrom=-5; rotate3D.angleXTo=0; rotate3D.angleYFrom=5; rotate3D.angleYTo=0; rotate3D.addEventListener(EffectEvent.EFFECT_END,function(e:EffectEvent):void { move3d.play(); }); var fade:Fade=new Fade(); fade.target=control; fade.duration=400; fade.repeatCount=1; fade.alphaFrom=0; fade.alphaTo=1; var move3d:Move3D=new Move3D(); move3d.target=control; move3d.duration=100; move3d.repeatBehavior="reverse"; move3d.xBy=-2; move3d.zBy=-2; move3d.repeatCount=2; move3d.addEventListener(EffectEvent.EFFECT_END,function(e:EffectEvent):void { if (backfunction != null) { backfunction(); } }); PopUpManager.addPopUp(control,parent,modal); PopUpManager.centerPopUp(control); rotate3D.play(); fade.play(); } /** * 关闭窗口 * @param control 目标 * @param backfunction 回调函数 * */ public static function remove(control:IFlexDisplayObject,backfunction:Function=null):void { var rotate3D:Rotate3D=new Rotate3D(); rotate3D.target=control; rotate3D.duration=400; rotate3D.autoCenterTransform=true; rotate3D.projectionX=0; rotate3D.projectionY=0; rotate3D.autoCenterProjection=false; rotate3D.angleXFrom=0; rotate3D.angleXTo=5; rotate3D.angleYFrom=0; rotate3D.angleYTo=-5; rotate3D.addEventListener(EffectEvent.EFFECT_END,function(e:EffectEvent):void { PopUpManager.removePopUp(control); if (backfunction != null) { backfunction(); } }); var fade:Fade=new Fade(); fade.target=control; fade.duration=250; fade.repeatCount=1; fade.alphaFrom=1; fade.alphaTo=0; var move3d:Move3D=new Move3D(); move3d.target=control; move3d.duration=400; move3d.xBy=50; move3d.zBy=50; move3d.repeatCount=1; rotate3D.play(); move3d.play(); fade.play(); } 代码原理就不讲了,大家自己捉摸吧,如果觉得效果不明显,可以自己设置里面的一些参数,运行起来是不是很酷?如需转载请注明出处,谢谢! http://my.csdn.net/neil89 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |