17Jun
Blur Animation with Scroll Method
No commentsIf you edit the Scroll method parameters you can easily change the horizontal and vertical direction of the blur from the image.
package
{
import flash.display.Sprite;
import flash.display.Loader;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.filters.BitmapFilter;
import flash.filters.BitmapFilterQuality;
import flash.filters.GlowFilter;
import flash.filters.BlurFilter;
import flash.geom.Point;
import flash.net.URLRequest;
import flash.events.Event;
public class BlurAnimation extends Sprite
{
private var sp:Sprite;
private var bmd:BitmapData = new BitmapData(700, 700, true, 0x000000);
private var blur:BlurFilter = new BlurFilter(2,10,3);
private var imageHolder:Sprite;
private var loader:Loader;
public function BlurAnimation()
{
var isPlaying:Boolean = false;
addEventListener(Event.ENTER_FRAME, loop);
var bm:Bitmap = new Bitmap(bmd);
addChild(bm);
var sp:Sprite = new Sprite();
addChild(sp);
var loader:Loader = new Loader();
// configureListeners(loader.contentLoaderInfo);
var request:URLRequest = new URLRequest( "http://manewc.com/projects/flash/i/wheel.png" );
loader.load(request);
imageHolder = new Sprite();
addChild ( imageHolder );
imageHolder.addChild(loader);
sp.addChild ( imageHolder );
sp.x = stage.stageWidth / 2 - 50;
sp.y = stage.stageHeight / 2;
}
private function loop(e:Event):void
{
bmd.draw(this);
bmd.applyFilter(bmd,bmd.rect,new Point(),blur);
// first parameter is left/right, second parameter is up down
bmd.scroll(10,-10);
}
}
}
Categories: Actionscript 3, Image Effects
Tuesday, June 17th, 2008 at 10:40 am and is filed under Actionscript 3, Image Effects. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.