When you wear a mask, you hide parts of
your face, but not your eyes. It is said
that the mask filters out your face (it hides
everything except your eyes).
Flash 8 users might want to see this other tutorial on creating a better looking mask with smooth edges.
Masking is a familiar
technique in computer graphics (and computer science in
general). It basically refers to a method of hiding
or filtering data. You have a set of data, when a
mask is applied to that data, you get a new set of data
which is a filtered version of the original
Data > Mask >
For instance, say you have a secret number written on a paper, and you
other people to be able to see only the 3rd
digit. What can be done? Let's see.
Here's the number written on a
nice orange paper:
Since you want others to be able to see only the 3rd digit,
you can erase
everything except the 3rd digit. Or, you can cut the
paper, leaving out only the 3rd digit. But what if you
don't want to
mess up the paper and you want to keep all the numbers intact
(because, for example you might want to allow
some other people to see the 4th digits, instead of the 3rd, in
here's an idea, you can get another paper and put a
hole on the location of the 3rd digit. You can then put this paper on top of
the other paper. Here's the paper cutout.
When you put this paper on top of your digits,
you essentially only show the 3rd digit.
Congratulations, you've just made a mask. The paper with the hole is a metaphor for a mask.
Now, if, for example, you want the last digit also to be
visible, you can cut another hole on the mask
Then, if so some reason, you want to show each digit
sequentially, you could move around the mask, like this (I'm
making the mask paper a bit transparent here so you can see
what's going on behind the mask):
Notice one thing here: I had to make the mask larger than
before to cover the number; otherwise, some unwanted areas
might be showing up. (This is an
important point to remember because when you get into
graphical software such as Flash or Photoshop, you will
understand why they don't exactly follow this metaphor.)
|Bad mask (too small) to
hide the "11" at the beginning.
Now you have an idea what a mask is, and what it
can be used for. Eq:
- To filter data.
- To hide parts of data.
- To compose a new sequence of data (example: in animation).
Now, the important thing to remember is that:
- With mask, you can do all of those without
destroying/modifying the original data.
- A mask can be applied on different data source (eq:
you can use the same mask on the previous example to
show the 3rd digit of any number, not just
Let's move on to the Flash mask.