漸層斜角濾鏡Flash Player 9 以及更新的版本,Adobe AIR 1.0 以及更新的版本 GradientBevelFilter 類別可讓您對顯示物件或 BitmapData 物件套用增強的斜角特效。在斜角上使用漸層顏色可大大改善斜角的空間深度,讓邊緣看起來更真實、更立體。 下列程式碼將使用 Shape 類別的 drawRect() 方法來建立一個矩形物件,並在其上套用漸層斜角濾鏡。 import flash.display.Shape; import flash.filters.BitmapFilterQuality; import flash.filters.GradientBevelFilter; // Draw a rectangle. var box:Shape = new Shape(); box.graphics.lineStyle(); box.graphics.beginFill(0xFEFE78); box.graphics.drawRect(100, 50, 90, 200); box.graphics.endFill(); // Apply a gradient bevel to the rectangle. var gradientBevel:GradientBevelFilter = new GradientBevelFilter(); gradientBevel.distance = 8; gradientBevel.angle = 225; // opposite of 45 degrees gradientBevel.colors = [0xFFFFCC, 0xFEFE78, 0x8F8E01]; gradientBevel.alphas = [1, 0, 1]; gradientBevel.ratios = [0, 128, 255]; gradientBevel.blurX = 8; gradientBevel.blurY = 8; gradientBevel.quality = BitmapFilterQuality.HIGH; // Other properties let you set the filter strength and set options // for inner bevel and knockout effects. box.filters = [gradientBevel]; // Add the graphic to the display list. addChild(box); |
|