I would prefer to use actual Mode7... it's more suited for parallax. With some work, you can adapt the following mode7 engine to your needs:
http://www.gotoandplay.it/_articles/2005/10/mode7.php (source FLA provided on the page). Regards, Newsdee. On 3/10/07, Latcho <[EMAIL PROTECTED]> wrote:
///////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////// http://sandy.media-box.net/blog/distortimage-20-the-fastest-way-to-freely-distort-image-with-flash-in-actionscript.html //////////////////////////////////////////////////////////////////////////////////////////// or (not my code, difficult to control :) --> //////////////////////////////////////////////////////////////////////////////////////////// import flash.display.BitmapData; import flash.filters.DisplacementMapFilter; Stage.scaleMode = "noScale"; var W:Number = 120; var H:Number = 120; var org:BitmapData = new BitmapData(W, H, false); var map:BitmapData = org.clone(); var hrs:BitmapData = org.clone(); var vrs:BitmapData = org.clone(); createEmptyMovieClip("mc0", 0).attachBitmap(org, 0); createEmptyMovieClip("mc1", 1).attachBitmap(map, 0); createEmptyMovieClip("mc2", 2).attachBitmap(hrs, 0); createEmptyMovieClip("mc3", 3).attachBitmap(vrs, 0); for (var i = 1; i < 4; ++i) { getInstanceAtDepth(i)._x = W * i; } for (var y = H - 1; y >= 0; --y) { var compG = (Math.round(0x100 * y * (4 / (H + y) - 2 / H)) + 0x80) << 8; for (var x = W - 1; x >= 0; --x) { map.setPixel(x, y, Math.round(0x100 * (0.5 - x / W) * y / H) + 0x80 | compG); if (x == W >> 2 || x == y * W / H >> 2) { org.setPixel(x, y, 0xFF0000); } else { org.setPixel(x, y, (x ^ y) & 0x08 ? 0xCCCCCC : 0xFFFFFF); } } } var persh:DisplacementMapFilter = new DisplacementMapFilter(map, null, 4, 2, 0, 0, "ignore"); var persv:DisplacementMapFilter = persh.clone(); persh.scaleX = W / 2; persv.scaleY = H / 2; hrs.applyFilter(org, org.rectangle, null, persh); vrs.applyFilter(hrs, hrs.rectangle, null, persv); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Regards, Stijn AKA latcho Henry Cooke wrote: > 'lo all > > Apologies if this is an old topic, but I can't find anything in the > Flashcoders archives, and Google just throws up some gnomic "it's > possible" > blog comments without any actual hints on *how* it's possible... > > I'm attempting to perspective distort a bitmap to use as a floor in a > parallax scene - I achieved a similar effect in oldskool Flash 6 (lots of > progressively xscaled, 1px high masked MCs, yuck) at > http://www.pd3.co.uk, > but I'm sure such a thing should be possible in Flash 8 using a > DisplacementMap filter. > > Does anyone have a good idea how this could be achieved? I've been > spending > a very long time staring at Photoshop, trying to come up with the right > combination of gradients for the displacement map, but all I have to > show is > a headache and a nagging sense that I'm missing something... > > Of course, a more direct approach would be to slice & scale the source > image > using a whole bunch of draw()s and a Matrix with a changing xscale, > but it > feels like a Displacement would be a cleaner option? > > Happy Friday! > Henry > _______________________________________________ > [email protected] > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > _______________________________________________ [email protected] To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
_______________________________________________ [email protected] To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com

