[AS3]as3实现倒影效果as3倒影算法源代码实例
[AS3]as3实现倒影效果as3倒影算法源代码实例,as3倒影,as3倒影算法
[AS3]as3实现倒影效果as3倒影算法源代码实例
- function createRef(picSource:DisplayObject):void
- {
- // CuPlayer.com倒置
- var bd:BitmapData = new BitmapData(picSource.width, picSource.height, true, 0x12346f);
- var mtx:Matrix = new Matrix();
- mtx.d = -1;
- mtx.ty = bd.height;
- bd.draw(picSource, mtx);
- // CuPlayer.com添加渐变遮罩
- var width:int = bd.width;
- var height:int = bd.height;
- mtx = new Matrix();
- mtx.createGradientBox(width, height, 0.5 * Math.PI);
- var shape:Shape = new Shape();
- shape.graphics.beginGradientFill(GradientType.LINEAR, [0, 0], [0.9, 0.2], [0, 0xFF], mtx);
- shape.graphics.drawRect(0, 0, width, height);
- shape.graphics.endFill();
- var mask_bd:BitmapData = new BitmapData(width, height, true, 0);
- mask_bd.draw(shape);
- // CuPlayer.com生成最终效果
- bd.copyPixels(bd, bd.rect, new Point(0, 0), mask_bd, new Point(0, 0), false);
- // CuPlayer.com将倒影放置于图片下方
- var ref:Bitmap = new Bitmap();
- ref.y = picSource.height + picSource.y;
- ref.x = picSource.x;
- ref.bitmapData = bd;
- picSource.parent.addChild(ref);
- }
热门文章推荐
- [HLS]做自己的m3u8点播系统使用HTTP Live Streaming(HLS技术)
- [FMS]FMS流媒体服务器配置与使用相关的介绍
- [AS3]什么是M3U8,与HTML5的区别是什么
- AS2.0 让flash自适应全屏,并且不自动缩放
- [AS3]as3.0的sound类常用技巧整理
- [AS3]as3与ByteArray详解、ByteArray介绍、ByteArray用法
- 关于RTMP,RTMPT,RTMPS,RTMPE,RTMPTE协议的介绍
- [JS]分享浏览器弹出窗口不被拦截JS示例
请稍候...