HOME | DD

psykopath — displacement

Published: 2009-07-30 06:17:28 +0000 UTC; Views: 371; Favourites: 3; Downloads: 13
Redirect to original
Description
//bitmap to use for displacement
// (this example just fills it with a solid color)
var distmap:BitmapData = new BitmapData(200, 200, true, 0x00000000)

//filter to offset distme using distmap.
var disp:DisplacementMapFilter = new DisplacementMapFilter(distmap, distmap.rect.topLeft, 1, 2, 4, 4)

//distme is the bitmap you want to distort
//im just drawing a square into this bitmap every frame

......

var a:Number = m.angle(BASEPOINT, {x:stage.mouseX, y:stage.mouseY})
var xm:Number = m.sin(a)+1
var ym:Number = m.cos(a)*-1+1
var ncol:uint = RGB(xm/2*255,ym/2*255,0)
distmap.fillRect(distmap.rect, 0xFF000000+ncol)
distme.applyFilter(distme, distme.rect, distme.rect.topLeft, disp)
Related content
Comments: 1

ElectricRain [2009-08-17 05:27:41 +0000 UTC]

trippy

👍: 0 ⏩: 0