Hello, not sure if anyone has done stuff like this before, so thought I would post it and see what people think.
Try it:
http://flash.sitdap.com/pixelmover
Download source:
…you create an instance of pixelmover, and give it a sprite with any graphics in.
**[U]methods:
[/U]**spreadPixels(maxRadius:int) - maxRadius default value is 200
- will randomly splay the pixels of your given sprite about the place, staying within the maximum radius
movePixels(speed:int) - speed default is 6, lower is faster. - at the moment, all this does is move back the pixels to their original position, then when they arrive it fades back to the original bitmap and removes itself from its parent. When it is all done, it dispatches an event called "PIXELS_MOVED".
so this is how I would use it:
var myPixelMover:PixelMover = new PixelMover(mySprite);
myPixelMover.spreadPixels(100);
addChild();
myPixelMover.addEventListener("PIXELS_MOVED", moveHandler);
myPixelMover.movePixels(4);
function moveHandler(evt:Event) {[INDENT]trace("the pixels are back where they were")
[/INDENT]}
…It should adapt to any size you make your sprite, but I fear about performance issues with so many pixels and all.
Comments are welcomed - bad or good as I don’t know whether everything is fully efficient as it could be. Feel free to add to it if you think it needs something!
cheers,
TD