Tuesday, November 24, 2009

CatScope Gradient Mask



Ooh, masking! For those of you who have never messed around in Flash or any other graphics package, the idea of a "mask" may not be completely clear. The way I think about it is that a mask acts as a window over another image. Look out your window. Think of the outside as a single large image. Your window (NOT the wall!) is the mask. It's a bit misleading in that a mask actually SHOWS something instead of hiding it.

That being said, the above is an example of a mask. Not only is it a mask, but it's a GRADIENT mask (notice how it fades to black around the edges). Gradient masks can be tricky in Flash, as you have to use a dynamic mask via actionscript instead of simply plopping a mask onto the stage.

2 comments:

  1. I've got the actionscript for the mask, but you should start sharing yours, or your sources! I do a lot of tutorial hunting for AS, and I seem to be frequenting your blog...

    I'm guessing it sounds something like
    1.) AS to make a gradient ball grad mask
    2.) black solid on top
    3.) track ball to mouse, hide and/or swap mouse... whatever you do there, you see it all the time but i've only done it once

    ReplyDelete
  2. Sure thing. From here on out I'll post snippets of the code that actually make it unique. In this case, the gradient mask is the only unique feature, and the lines that allow for gradient masks are incredibly simple.

    The catch is that the movie clips involved (both mask and maskee) need to be cached as bitmaps or else the mask will just be an all-or-nothing deal. With bitmap data, however, alpha is considered by Flash.

    ReplyDelete