宜昌本地软件开发与弱电工程服务商
项目咨询 · 快速响应
您当前的位置: > 博客2 > AS2与AS3技术

[AS3]as3实现倒影效果as3倒影算法源代码实例

2016-10-13 00:16:48 点击量:8 标签: 收藏本文

[AS3]as3实现倒影效果as3倒影算法源代码实例

  1. function createRef(picSource:DisplayObject):void 
  2.     // CuPlayer.com倒置 
  3.     var bd:BitmapData = new BitmapData(picSource.width, picSource.height, true, 0x12346f); 
  4.     var mtx:Matrix = new Matrix(); 
  5.     mtx.d = -1; 
  6.     mtx.ty = bd.height; 
  7.     bd.draw(picSource, mtx); 
  8.     // CuPlayer.com添加渐变遮罩 
  9.     var width:int = bd.width; 
  10.     var height:int = bd.height; 
  11.     mtx = new Matrix(); 
  12.     mtx.createGradientBox(width, height, 0.5 * Math.PI); 
  13.     var shape:Shape = new Shape(); 
  14.     shape.graphics.beginGradientFill(GradientType.LINEAR, [0, 0], [0.9, 0.2], [0, 0xFF], mtx); 
  15.     shape.graphics.drawRect(0, 0, width, height); 
  16.     shape.graphics.endFill(); 
  17.     var mask_bd:BitmapData = new BitmapData(width, height, true, 0); 
  18.     mask_bd.draw(shape); 
  19.     // CuPlayer.com生成最终效果 
  20.     bd.copyPixels(bd, bd.rect, new Point(0, 0), mask_bd, new Point(0, 0), false); 
  21.     // CuPlayer.com将倒影放置于图片下方 
  22.     var ref:Bitmap = new Bitmap(); 
  23.     ref.y = picSource.height + picSource.y; 
  24.     ref.x = picSource.x; 
  25.     ref.bitmapData = bd
  26.     picSource.parent.addChild(ref); 

 

ABOUT US
宜昌农人网络科技有限公司

我们是一家提供综合软件外包与弱电工程服务的技术公司。

业务涵盖定制软件、管理系统、网站、小程序、APP、系统集成、网络布线、监控安防、门禁、机房建设及长期技术维护。

公司地址:湖北省宜昌市伍家岗区东站二路6号三峡(宜昌)大数据产业园海洋馆二楼A203室