Question: Bitmap distorting the bottom half of the Stage?

Peart

Before I start digging into code, I pose this question out there to those in the interactive community – you may have a bit of code that I could use to save myself some time. If you look at the image above, what I would like to do is to have a Stage with a DisplayObject or perhaps several DisplayObjects – which can animate around.

When these objects pass the boundary (marked with the horizontal red line), I would like to distort all those images by applying a Bitmap transformation… but only to the portion that crosses that boundary.

The bottom half of the Stage would need to update itself constantly to properly display the effect in real time. I’ve done some Bitmap things in the past, but I am not quite sure what the correct approach for this might be.

I’ve seen plenty of stuff where you can drag the corners of a photograph around (like this good example from Edvard Toth), but I’ve not seen where this could be applied to something like what you see above. Without digging too deeply I think I just need to update the BitmapData for the bottom Bitmap every frame – but curious about the offset stuff…

I am looking for sage advice or even some code to get this rolling. If it takes a while it might be interesting to see how you landed where you did and how I approached the problem.

Thanks for any and all consideration.

Related Posts Plugin for WordPress, Blogger...

One thought on “Question: Bitmap distorting the bottom half of the Stage?

  1. Eric Post author

    I got this to work… I snap the whole stage and then copy bits of it into a bitmap:

    var bitmapdata:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight,true, 0xFF333333);
    bitmapdata.draw(stage);
    var bitmapDataA: BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight/2, true);
    bitmapDataA.copyPixels(bitmapdata, new Rectangle(0, stage.stageHeight/2, stage.stageWidth, stage.stageHeight/2), new Point(0, 0), null, null,false);
    var b:Bitmap = new Bitmap(bitmapDataA);
    b.y = stage.stageHeight/2;
    b.x = 10;
    addChild(b);

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *


seven − 3 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>