最新下载
热门教程
- 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 flash.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);
相关文章
- 碧蓝航线的里雅斯特期待的便当时间皮肤有什么 04-30
- 明日之后踏浪逐星服装展示攻略 04-30
- 深空之眼幽月塞勒涅刻印搭配核心思路 04-30
- 明日之后红杉茶会护卫队首领BOSS有哪些 04-30
- CF手游段位奖励汇总攻略 04-30
- 无期迷途5-13怎么走攻略 04-30