最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
AS3位图扭曲
时间:2022-07-02 17:10:36 编辑:袖梨 来源:一聚教程网
DisplacementMapFilter 类使用指定的 BitmapData 对象(称为置换图图像)的像素值执行对象置换。 您可以使用此滤镜将扭曲或斑点效果应用于从 DisplayObject 类中继承的任何对象,例如 MovieClip、SimpleButton、TextField 和 Video 对象,以及 BitmapData 对象。
import .display.Bitmap;
import flash.display.BitmapData;
var picWidth:Number = 450;
var picHeight:Number = 450;
var endColor:uint = 0xff8080;//红色
var startColor:uint = 0x008080;//蓝色
var middleColor:uint = 0x808080;//中间色(灰色)
var myBitmapData:BitmapData = new BitmapData(picWidth,picHeight);
function drawMapBitmap(targetData:BitmapData,width:Number,height:Number):BitmapData {
var colorDistH = (middleColor - startColor)/picHeight;
for (var h=0; h
var thisEndColor:uint = endColor - h*colorDistH;
var thisColorDistW = (thisEndColor - thisStartColor)/picWidth;
for (var w=0; w
targetData.setPixel(w,h,pixelColor);
}
}
return targetData;
}
var myBitmap:Bitmap = new Bitmap(drawMapBitmap(myBitmapData,picWidth,picHeight));
addChild(myBitmap);
相关文章
- 月圆之夜CCG中速树龙卡组玩法搭配 10-17
- 新三国志曹操传历战列传1-5顶分攻略 10-17
- 山海进化录霸主小磁石狩猎攻略分享 10-17
- 洛伊的移动要塞街机摇杆获取方法 10-17
- 不朽箴言不同商店优先购买推荐 10-17
- 新三国志曹操传定军山之战关卡攻略 10-17