Re: [Flashcoders] fisheye dislpacement

2009-09-11 Thread Hans Wichman
Hi,
maybe this will help;
http://www.unitzeroone.com/blog/2005/10/26/2-new-flash-8-examples-displace-smoke-displacement-spheres-source/
it's as2 but the id is the same.

hth
JC

On Thu, Sep 10, 2009 at 4:58 PM, Mendelsohn, Michael 
michael.mendels...@fmglobal.com wrote:

 Hi list...

 I'm trying to render a spherical earth using a DisplacementMapFilter out of
 a flat movieclip of the landmasses but it isn't working too well for me.
  Any suggestions?  I'd appreciate hearing any ideas.

 Thanks,
 - Michael M.

 private function renderOrnament():Sprite{
var makeCirc:Function = function(isFront:Boolean, diam:uint):Shape{
// used for masks and displacement
var c:Shape = new Shape();
var m:Matrix = new Matrix();
m.createGradientBox(diam,diam);
var colors:Array = (isFront !=
 true)?[0xFF,0x00]:[0x00,0xFF];
c.graphics.beginGradientFill(GradientType.RADIAL,
 colors,[1,1],[0,255],m);
c.graphics.drawEllipse(0,0,diam,diam);
c.graphics.endFill();
return c;
}
// container
var orn:Sprite = new Sprite();
// front hemisphere
var fh:Sprite = new Sprite();
orn.addChild(fh);
// front world (World is a mc of all the continents)
frontWorld = new World();
fh.addChild(frontWorld);
// front world mask
var circleMask:Shape = makeCirc(true,200);
fh.addChild(circleMask);
frontWorld.mask = circleMask;
// front world displacement
fh.filters = [new DisplacementMapFilter(new BitmapData(200,200), new
 Point(0,0), 1, 1,75, 75, DisplacementMapFilterMode.IGNORE, 1,0)];
return orn;
 }



 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] fisheye dislpacement

2009-09-11 Thread Mendelsohn, Michael
Thanks for the link Hans.  That's exactly what I was looking for.  I think I 
figured out the issue I was having.  In the DisplacementMapFilter constructor, 
you have to assign color channels for it to displace along x and y, and I was 
setting the displacement map to a black and white gradient.  When I created a 
red/green gradient, it worked.

Unfortunately, I can't download the zip source on that page.  :-/

Regards,
- Michael M.

 maybe this will help;
http://www.unitzeroone.com/blog/2005/10/26/2-new-flash-8-examples-displace-smoke-displacement-spheres-source/
it's as2 but the id is the same.

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] fisheye dislpacement

2009-09-10 Thread Mendelsohn, Michael
Hi list...

I'm trying to render a spherical earth using a DisplacementMapFilter out of a 
flat movieclip of the landmasses but it isn't working too well for me.  Any 
suggestions?  I'd appreciate hearing any ideas.

Thanks,
- Michael M.

private function renderOrnament():Sprite{
var makeCirc:Function = function(isFront:Boolean, diam:uint):Shape{
// used for masks and displacement
var c:Shape = new Shape();
var m:Matrix = new Matrix();
m.createGradientBox(diam,diam);
var colors:Array = (isFront != 
true)?[0xFF,0x00]:[0x00,0xFF];
c.graphics.beginGradientFill(GradientType.RADIAL, 
colors,[1,1],[0,255],m);
c.graphics.drawEllipse(0,0,diam,diam);
c.graphics.endFill();
return c;
}
// container
var orn:Sprite = new Sprite();
// front hemisphere
var fh:Sprite = new Sprite();
orn.addChild(fh);
// front world (World is a mc of all the continents)
frontWorld = new World();
fh.addChild(frontWorld);
// front world mask
var circleMask:Shape = makeCirc(true,200);
fh.addChild(circleMask);
frontWorld.mask = circleMask;
// front world displacement
fh.filters = [new DisplacementMapFilter(new BitmapData(200,200), new 
Point(0,0), 1, 1,75, 75, DisplacementMapFilterMode.IGNORE, 1,0)];  
return orn;
}



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders