SquishFilter 0.1

This is a demo of the very first version of my SquishFilter for flash.
SquishFilter 0.1

In this demo I’ve animated a wooden box in the timeline. In as3 I added the Pixel Bender filter (that I wrote) in the filters array of the animation. The filter is making the movieclip bulge and pinch when scaleY is more or less than 1.

You’ll see the difference with and without the filter, also I’ve provided a manual control of the filter and a rubber box that acts a bit like it was made of rubber. Click, drag and release within the flash application to the see rubber box in action.

The demo uses flash player 10:

[SWF]http://media.enedahl.com/2010/06/SquishFilterDemo3.swf, 620, 400[/SWF]

A bare bone code example on how to use the filter.
private var filter:SquishFilter;
public var animation:MovieClip;

private function init():void
filter = new SquishFilter();
animation.filters = [ filter ];
this.addEventListener(Event.ENTER_FRAME, onEnterFrame);

private function onEnterFrame(e:Event):void
animation.filters = [ SquishFilter.updateSquishFilter(filter, animation.box) ];

A SWC with the filter and some of the source code and flash files are available in the Flash Develop demo project file. Look at the demo code for an insight on how to use the filter.

When squishing extremly much the image get cropped. This is easily avoided by increasing the leftExtension and rightExtension properties on the filter. Now they are set to 12.

Feel free to use for non commercial projects.
/Christoffer Enedahl

Tags: , ,

Leave a Reply