【原创】制作Flash图像渐变倒影

本文介绍了一种使用ActionScript创建图像倒影的方法。该方法通过BitmapData操作原图,并利用矩阵变换和渐变填充实现倒影及透明度渐变效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

private function createRef(p_source:Bitmap):BitmapData//制作倒影bitmapData
		{
			var bd:BitmapData=new BitmapData(p_source.width, p_source.height, true, 0);
			var mtx:Matrix = new Matrix();
			mtx.d=-1;
			mtx.ty=bd.height;
			bd.draw(p_source, mtx);
			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);
			bd.copyPixels(bd, bd.rect, new Point(0, 0), mask_bd, new Point(0, 0), false);
			return bd;
		}

 在另一篇博客  Away3D图片墙 中用到了此方法

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值