/** * Copyright 2008 (c) muta * * http://unbland.net/ * http://unbland.net/blog/ * * Licensed under the MIT License * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package { import flash.display.Shader; import flash.filters.ShaderFilter; import flash.utils.ByteArray; public class RadialBlurFilter extends ShaderFilter { [Embed (source="RadialBlur.pbj", mimeType="application/octet-stream")] private var _data:Class; private var _centerX:Number = 1; private var _centerY:Number = 1; private var _amount:Number = 1; private var _rotation:Number = 0; public function RadialBlurFilter( centerX:Number = 1, centerY:Number = 1, amount:Number = 1, rotation:Number = 0):void { super(new Shader(ByteArray(new _data()))); this.centerX = centerX; this.centerY = centerY; this.amount = amount; this.rotation = rotation; } public function get centerX():Number { return _centerX; } public function set centerX(value:Number):void { _centerX = value; setData("center", centerX, centerY); } public function get centerY():Number { return _centerY; } public function set centerY(value:Number):void { _centerY = value; setData("center", centerX, centerY); } public function get amount():Number { return _amount; } public function set amount(value:Number):void { _amount = value; setData("amount", amount); } public function get rotation():Number { return _rotation; } public function set rotation(value:Number):void { _rotation = value; setData("rotation", rotation); } /** * @private */ private function setData(name:String, ...params):void { shader.data[name].value = params; } } }