Posted on Sunday 1 October 2006
Building on the last experiment, here is the same kind of transition, this time with envelope distortion, that warps a rectangle into an inward curved "thing"; it looks as though is it being pinched, while the 4 corners stay put. Here's the source. The function to generate the displacement map is simple enough:
function createPinchMap(width, height)
{
var bmp:BitmapData = new BitmapData(width, height, false, 0xffffff);
for(var j = 0; j < height; j++)
{
for(var i = 0; i < width; i++)
{
var blueCol = 127 + (i - width/2) /(width/2) *127*(1 - Math.pow((j - height/2)/(height/2), 2));
var greenCol = 127 + (j - height/2)/(height/2)*127*(1 - Math.pow((i - width/2) /(width/2) , 2));
bmp.setPixel(i, j, (greenCol << 8) | blueCol);
}
}
return bmp;
}
Home exercise: you've all seen Grant Skinner's morphing Mike Chambers contest. Instead of morphing Mike Chambers into Mike Chambers, morph him into somebody else (the person is up to you). This, I am confident, can be done quite simply with Fuse and DisplacementMap. If you need a head-start, read this article, but please don't morph Mike Chambers into a sheep! First prize gets recognition from everyone in the community, and the consequent money, sex, drugs, and/or rock and roll (not necessarily in that order).


